[NTG-context] More table questions

Aditya Mahajan adityam at umich.edu
Tue Sep 22 22:02:17 CEST 2020


On Tue, 22 Sep 2020, Peter M√ľnster wrote:

> On Tue, Sep 22 2020, Aditya Mahajan wrote:
> 
> > The same effect is rather easy to achieve when using natural tables as
> > well.
> 
> But it fails, when there is only one data-row... :(

Then don't create tables with only one data row :-)

A better solution is to create a dedicate framehandler which draws the bottom frame at half the thickness:

\startuseMPgraphic{booktabs_bottom}
   draw bottomboundary OverlayBox withpen pencircle scaled (OverlayLineWidth/2)
        withcolor OverlayColor;
   setbounds currentpicture to OverlayBox;
\stopuseMPgraphic

\defineoverlay[booktabs_bottom] [\uniqueMPgraphic{booktabs_bottom}]
\installbottomframerenderer{booktabs}{\uniqueMPgraphic{booktabs_bottom}}


\startsetups booktabs
  \setupTABLE[each][each][frame=off, rulethickness=1.2bp]
  \setupTABLE[row][first][topframe=on, bottomframe=booktabs]
  \setupTABLE[row][last] [bottomframe=on]

  \setupTABLE[row][first][style=bold]
\stopsetups

\starttext

\startTABLE[setups=booktabs]
  \NC Heading 1 \NC Heading 2 \NC Heading 3 \NC \NR
  \NC Value 1   \NC Value 2   \NC Value 3   \NC \NR
  \NC Value 1   \NC Value 2   \NC Value 3   \NC \NR
  \NC Value 1   \NC Value 2   \NC Value 3   \NC \NR
\stopTABLE

\blank[2*line]

\startTABLE[setups=booktabs]
  \NC Heading 1 \NC Heading 2 \NC Heading 3 \NC \NR
  \NC Value 1   \NC Value 2   \NC Value 3   \NC \NR
\stopTABLE
\stoptext

Aditya


More information about the ntg-context mailing list