[NTG-context] rules with different thickness

Wolfgang Schuster schuster.wolfgang at googlemail.com
Tue Apr 19 19:46:22 CEST 2011


Am 19.04.2011 um 09:30 schrieb Reviczky, Adam:

>> It’s the same as in the past, use MetaPost but there are better ways to change values of certain borders:
> As much as I like and prefer this solution, I can't get it to work as the old one.
> 
> With the old one I had a frame 1pt, and just made a 2pt metapost frame around the last row.
> 
> With the new example of yours I've came up with a minimal example that I've attached.
> I have to do the table setups, since I'm making the table via a macro, but for the simplicity I left that out from the minimal example.
> The problem is, that every even row seems to have thicker right/left and top borders, why is that?
> 
> With both solution if I just draw a thicker bottom line it goes off on the right and left side. Can this be solved somehow?


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



More information about the ntg-context mailing list