[NTG-context] professional looking tables

Aditya Mahajan adityam at umich.edu
Fri Dec 23 03:53:35 CET 2016


On Sun, 18 Dec 2016, Csikos Bela wrote:

> Dear context users:
>
> In latex I could make professional looking tables using booktabs module.
> Using longtable package I could make nice looking multipage tables.
>
> I see that context offers several table environments. Which one of them
> is suitable for making  professional (publication quality) tables?
>
> The requirements for such tables are the follows:
>
> - Only horizontal rules are needed
> - Ability to set the rule's thickness for top rule, bottom rule, middle rule
> - Ability to set the distance between rules and table content
> - Ability to set rule length shorter than cell or row width on both left and right sides
> - Ability to set rules for spanning only some of the columns

Natural tables can give the same visual output as booktabs but the only 
way to shorten rules is to either use a "fake" column as spacer or use 
metapost to draw borders. For simple tables, you could get around this by 
being a little creative.

For example, here is the example from the booktabs package with very 
little manual tweaking.

\startsetups booktabs
   \setupTABLE[frame=off, rulethickness=0.5bp, loffset=1em]
   \setupTABLE[column][first][loffset=0em]
   \setupTABLE[row][first][topframe=on, rulethickness=1.5bp]
   \setupTABLE[row][last] [bottomframe=on, rulethickness=1bp]
\stopsetups

\starttext
\bTABLE[setups=booktabs]
   \setupTABLE[column][3][align=flushright]
   \bTR[topframe=on]
     \bTD[nc=2, align=middle] Item \eTD
     \bTD \eTD
   \eTR
   \bTR[bottomframe=on]
     \bTD[topframe=on] Animal \eTD
     \bTD[topframe=on] Description \eTD
     \bTD Price (\$) \eTD
   \eTR
   \bTR
     \bTD Gnat     \eTD
     \bTD per gram \eTD
     \bTD 13.65    \eTD
   \eTR
   \bTR
     \bTD \eTD
     \bTD each \eTD
     \bTD 0.01 \eTD
   \eTR
   \bTR
     \bTD Gnu \eTD
     \bTD stuffed \eTD
     \bTD 92.50   \eTD
   \eTR
   \bTR
     \bTD Emu \eTD
     \bTD stuffed \eTD
     \bTD 33.33 \eTD
   \eTR
   \bTR
     \bTD Armadillo \eTD
     \bTD frozen    \eTD
     \bTD 8.99      \eTD
   \eTR
\eTABLE
\stoptext

Aditya


More information about the ntg-context mailing list