From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/71156 Path: news.gmane.org!not-for-mail From: Felix Ingram Newsgroups: gmane.comp.tex.context Subject: Re: Table headers and section titles Date: Thu, 15 Sep 2011 14:29:00 +0100 Message-ID: References: Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1316093366 29557 80.91.229.12 (15 Sep 2011 13:29:26 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 15 Sep 2011 13:29:26 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Thu Sep 15 15:29:22 2011 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from balder.ntg.nl ([195.12.62.10]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1R4C0H-0000AB-As for gctc-ntg-context-518@m.gmane.org; Thu, 15 Sep 2011 15:29:21 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id B6E35CAF97; Thu, 15 Sep 2011 15:29:20 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id doHdNqHJK1HW; Thu, 15 Sep 2011 15:29:05 +0200 (CEST) Original-Received: from balder.ntg.nl (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 184CACAF8E; Thu, 15 Sep 2011 15:29:05 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 3DA41CAF8E for ; Thu, 15 Sep 2011 15:29:04 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id m7qLUtYsW3hc for ; Thu, 15 Sep 2011 15:29:02 +0200 (CEST) Original-Received: from filter4-til.mf.surf.net (filter4-til.mf.surf.net [194.171.167.220]) by balder.ntg.nl (Postfix) with ESMTP id 4D8C9CAF8B for ; Thu, 15 Sep 2011 15:29:02 +0200 (CEST) Original-Received: from mail-vw0-f46.google.com (mail-vw0-f46.google.com [209.85.212.46]) by filter4-til.mf.surf.net (8.14.3/8.14.3/Debian-5+lenny1) with ESMTP id p8FDT0Vl018957 for ; Thu, 15 Sep 2011 15:29:01 +0200 Original-Received: by vws1 with SMTP id 1so4159384vws.5 for ; Thu, 15 Sep 2011 06:29:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; bh=yzDyoUYdbzch5K7gPNG/PqWV1Dmv2vivi3ZbNsQ3rO0=; b=nq0I/ajDqTluo97iVzRWE/PZ59j6y8X+xcYelwuQeIS6w4Mc/Yxl0ByCmSwQ1/9bfB HUaVfeYSRkkKlRDvKaFYfZl45mrTZDbg6clJpSjX6DnQ+KRPw6A/0WpEIcCSyEO6xZoc UWsCv8E7ZHEhumTDnWnyOyEX3UvzlY8ryiqn0= Original-Received: by 10.220.157.83 with SMTP id a19mr271612vcx.178.1316093340337; Thu, 15 Sep 2011 06:29:00 -0700 (PDT) Original-Received: by 10.220.176.65 with HTTP; Thu, 15 Sep 2011 06:29:00 -0700 (PDT) In-Reply-To: X-Bayes-Prob: 0.0001 (Score 0, tokens from: @@RPTN) X-CanIt-Geo: ip=209.85.212.46; country=US; region=CA; city=Mountain View; postalcode=94043; latitude=37.4192; longitude=-122.0574; metrocode=807; areacode=650; http://maps.google.com/maps?q=37.4192,-122.0574&z=6 X-CanItPRO-Stream: uu:ntg-context@ntg.nl (inherits from uu:default, base:default) X-Canit-Stats-ID: 05Fx1t1Gm - eae16205d0f5 - 20110915 X-Scanned-By: CanIt (www . roaringpenguin . com) on 194.171.167.216 X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.12 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: ntg-context-bounces@ntg.nl Errors-To: ntg-context-bounces@ntg.nl Xref: news.gmane.org gmane.comp.tex.context:71156 Archived-At: Some follow up notes in case anyone else is trying to do something similar On 13 September 2011 15:30, Felix Ingram wrote: > I've had another stab at converting our Word template to Context. I've > managed to draw some pretty shapes using MetaPost (and I'd like to add > my +1 for getting some alpha channel support for linear_shade) and I > got really close to getting my table headings working. Re: alpha channels - I'm now using TIKZ for the drawing and so this is now sorted. > I would like to have a gradient fill that runs the width of the table > header. The following shows where I've got to: > > %% GRADIENT SETUP > \definecolor[a][r=3D0.098039,g=3D0.223529,b=3D0.52549] > \definecolor[b][r=3D0.098039,g=3D0.654902,b=3D0.866667] > > \startuniqueMPgraphic{LinearShade} > path p ; > p :=3D unitsquare xscaled \overlaywidth yscaled \overlayheight ; > linear_shade(p,5,\MPcolor{a},\MPcolor{b}) ; > \stopuniqueMPgraphic > > \defineoverlay[shaded][\useMPgraphic{LinearShade}] > > \setupTABLE[row][1][background=3D{shaded},backgroundcolor=3Dblue,foregrou= ndcolor=3Dwhite] > > \starttext > \framed[background=3D{shaded}, width=3D\textwidth, frame=3Doff]{} > \bTABLE > \bTABLEhead > \bTR \bTH 1 \eTH \bTH 1 \eTH \bTH 1 \eTH \bTH 1 \eTH \bTH Page =A0\eTH \e= TR > \eTABLEhead > \bTABLEbody > \bTR \bTD 1 \eTD \bTD 1 \eTD \bTD 1 \eTD \bTD 1 \eTD \bTD 1 =A0 =A0 \eTD = \eTR > \eTABLEbody > \eTABLE > \stoptext > > > The output shows a framed element which is similar to what I want to > achieve and the table shows where I've got to. I believe that there > are only really two options as to how I can get what I want: > > 1. Recalculate the gradient fill for each cell. This will require > knowing the column width and the ability to change the cell's > background as appropriate. I have no idea how to do either. > 2. Draw the framed fill to the width of the table and then position it > behind the table header (which is actually how it gets done in Word). > However, I don't know how to determine the table width, or how to > accurately position the frame. Still no idea about these - I will probably try to draw something with tikz and then move it. Still not sure how to determine the table width, but we only have a few tables and they are fairly constant in size, so I might just fake it. > The next problem I have is with section headings. For each section > heading we are required to include a box that contains some meta > information. > This is what I have at the moment: > > \setuphead[section][color=3Dblue, aligntitle=3Dfloat] > > \definefloat[issueinfo][issueinfos] % Define our fancy boxout > \setupcaption[issueinfo][location=3Dnone] % Define our fancy boxout > \defineframedtext[issueinfo][] > > \starttext > > \section{My section header} > \placeissueinfo[right, y=3D-2cm]{}{ > \startissueinfo[width=3D4cm] > Ref: ref-1 \par > a: Medium \par > b: low \par > c: 9.0 > \stopissueinfo > } > Short loin shank rump pork belly ball tip pig. Spare ribs shank > tri-tip capicola strip steak. Frankfurter leberk=E4se filet mignon > boudin pork belly. Capicola shankle ribeye, hamburger brisket jerky > rump short ribs turkey ham hock andouille pork chop chicken tongue > pork belly. Ball tip tongue corned beef shoulder bresaola. Tri-tip > turducken salami ground round pork. Rump tenderloin pork loin ham hock > boudin, meatball venison pastrami prosciutto. > > \stoptext > > I'd like to be able to accurately place the box alongside the title > itself. Ideally I'd like to draw a line under the section header that > meets the left side of the box as well, though I'll take what I can > get at this point. After some careful reading of the Details manual I have something that I'm fairly happy with. \definefloat[issueinfo][issueinfos] \setupcaption[issueinfo][location=3Dnone] % Turn off caption \defineframedtext[issueinfo] \setupframedtext[issueinfo][ width=3D4cm, % set the width frame=3Don, % turn on the framw framecolor=3Dblue, % colour it ] \setupfloat[issueinfo] [ default=3D{inner, height, high, low, none}, % set up padding etc margin=3D\structdepth, rightmargindistance=3D2cm, maxwidth=3D0.5cm, color=3Dblue, ] I then place it with the following: \movesidefloat[-5*line] \placeissueinfo[right]{}{ \startissueinfo ... \stopissueinfo The movesidefloat shifts it up to where I want it to be. The only issue is that my section headings would overlap the box if the text was too long, so I redefined the heading like this: \setuphead[section] [before=3D\page, aligntitle=3Dfloat, % Redundant I believe, as the next option will prevent it being required width=3D12cm, % Set the width to something that won't impact our box. after=3D{{\color[red] \hrule width 125mm \vskip 2em}}, ] The 'after' settings draw the line that I was looking for and 125mm just happens to bring it to the edge of the box, so I'm a little happier. I hope this is useful to someone. Felix ___________________________________________________________________________= ________ If your question is of interest to others as well, please add an entry to t= he Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-cont= ext webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________= ________