Re: [NTG-context] rules with different thickness
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
Am 20.04.2011 um 10:36 schrieb Reviczky, Adam:
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".
Yes because each table cell is a 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.
The problem with mkii is that pictures are reduced to the size of the bounding box. Wolfgang
participants (2)
-
Reviczky, Adam
-
Wolfgang Schuster