[NTG-context] rules with different thickness

Reviczky, Adam adam.reviczky at kcl.ac.uk
Wed Apr 20 10:36:58 CEST 2011


> I slightly modified the code and the output is now better than before, please add it to the wiki.
> 
> \startuseMPgraphic{tableborders}
> 
> draw leftboundary   OverlayBox withpen pensquare scaled \frameddimension  {leftrulethickness} ;
> draw rightboundary  OverlayBox withpen pensquare scaled \frameddimension {rightrulethickness} ;
> draw topboundary    OverlayBox withpen pensquare scaled \frameddimension   {toprulethickness} ;
> draw bottomboundary OverlayBox withpen pensquare scaled \frameddimension{bottomrulethickness} ;
> 
> clip currentpicture to OverlayBox
> 	leftenlarged   (\frameddimension  {leftrulethickness}/2)
> 	rightenlarged  (\frameddimension {rightrulethickness}/2)
> 	topenlarged    (\frameddimension   {toprulethickness}/2)
> 	bottomenlarged (\frameddimension{bottomrulethickness}/2) ;
> 
> setbounds currentpicture to OverlayBox ;
> 
> \stopuseMPgraphic
> 
> \defineoverlay[tableborders][\useMPgraphic{tableborders}]
> 
> \startsetups tableborders
> 
> \setupTABLE
>   [         background={color,tableborders},
>                  frame=off,
>       backgroundoffset=0pt,
>      leftrulethickness=\framedparameter{rulethickness},
>     rightrulethickness=\framedparameter{rulethickness},
>       toprulethickness=\framedparameter{rulethickness},
>    bottomrulethickness=\framedparameter{rulethickness}]
> 
> \setupTABLE[row]  [odd]  [backgroundcolor=lightgray]
> \setupTABLE[row]  [first][backgroundcolor=gray,bottomrulethickness=2pt]
> \setupTABLE[row]  [last] [toprulethickness=2pt,bottomrulethickness=2pt]
> \setupTABLE[first][last] [leftrulethickness=2pt]
> \setupTABLE[last] [last] [rightrulethickness=2pt]
> 
> \stopsetups
> 
> \starttext
> 
> \bTABLE
> \dorecurse{7}{\bTR\dorecurse{3}{\bTD#1-##1\eTD}\eTR}
> \eTABLE
> 
> \blank
> 
> \bTABLE[setups=tableborders]
> \dorecurse{7}{\bTR\dorecurse{3}{\bTD#1-##1\eTD}\eTR}
> \eTABLE
> 
> \stoptext
> 
> Wolfgang

Thanks so much for this, it looks really nice (booth the implementation and the output).
I've added this to the TABLE wiki since this example above is a table, however I suspect this would work for any "frame".

Is there a reason why this doesn't work with mkii? I'm not using mkii for a long time now, just the wiki didn't rendered this example properly and also on my local machine it didn't show the thick rules, works perfectly with mkiv though.

Cheers
Adam


More information about the ntg-context mailing list