Difference between revisions of "Tables Overview"

From ConTeXt wiki
m (rewording of table mode recommendations, add hint to framed tables)
(new structure of features table)
Line 24: Line 24:
 
<table style="border:1px solid #DDDDDD; width:100%" align="left" valign="top">
 
<table style="border:1px solid #DDDDDD; width:100%" align="left" valign="top">
 
<tr style="background-color:#DDDDDD" align="left" valign="top">
 
<tr style="background-color:#DDDDDD" align="left" valign="top">
<th>Feature</th><th>[[Tabulate]]</th><th>[[Table]]</th>
+
<th>Feature</th>
<th>[[Tables]]</th><th>[[TABLE]]</th><th>[[Linetable]]</th><th>[[xtables]]</th>
+
<th>[[Tabulate]]</th><th>[[Table]]/[[Tables]]</th>
 +
<th>[[TABLE]]</th><th>[[xtables]]</th><th>[[Linetable]]</th><th>[[framedtable]]</th>
 
</tr>
 
</tr>
  
 
<tr align="left" valign="top">
 
<tr align="left" valign="top">
 
<th style="background-color:#DDDDDD">horizonal lines</th>
 
<th style="background-color:#DDDDDD">horizonal lines</th>
<td><cmd>HL</cmd></td>
 
 
<td><cmd>HL</cmd></td>
 
<td><cmd>HL</cmd></td>
 
<td><cmd>HL</cmd></td>
 
<td><cmd>HL</cmd></td>
Line 40: Line 40:
 
[bottomframe=on]
 
[bottomframe=on]
 
</texcode></td>
 
</texcode></td>
 +
<td><texcode>\setupxtable[...]</texcode></td>
 
<td>unknown</td>
 
<td>unknown</td>
 
<td>yes</td>
 
<td>yes</td>
Line 46: Line 47:
 
<tr align="left" valign="top" style="background-color:#EEEEEE;">
 
<tr align="left" valign="top" style="background-color:#EEEEEE;">
 
<th style="background-color:#DDDDDD">vertical lines</th>
 
<th style="background-color:#DDDDDD">vertical lines</th>
<td><cmd>VL</cmd></td>
 
 
<td><cmd>VL</cmd></td>
 
<td><cmd>VL</cmd></td>
 
<td><cmd>VL</cmd></td>
 
<td><cmd>VL</cmd></td>
Line 56: Line 56:
 
[rightframe=on]
 
[rightframe=on]
 
</texcode></td>
 
</texcode></td>
 +
<td><texcode>\setupxtable[...]</texcode></td>
 
<td>unknown</td>
 
<td>unknown</td>
 
<td>yes</td>
 
<td>yes</td>
Line 63: Line 64:
 
<th style="background-color:#DDDDDD">multipage</th>
 
<th style="background-color:#DDDDDD">multipage</th>
 
<td>yes</td>
 
<td>yes</td>
<td>no</td>
+
<td>no / yes (tables)</td>
<td>yes</td>
 
 
<td>yes, with <tt>split=yes</tt> or <tt>split=repeat</tt></td>
 
<td>yes, with <tt>split=yes</tt> or <tt>split=repeat</tt></td>
 +
<td>yes, even horizontally</td>
 
<td>yes, even horizontally</td>
 
<td>yes, even horizontally</td>
 
<td>yes</td>
 
<td>yes</td>
Line 80: Line 81:
 
</texcode>
 
</texcode>
 
only one line</td>
 
only one line</td>
<td>no</td>
+
<td>table<b>s</b> only:
<td><texcode>
+
<texcode>
 
\setuptables
 
\setuptables
 
   [split=repeat]
 
   [split=repeat]
Line 96: Line 97:
 
\eTABLEhead
 
\eTABLEhead
 
</texcode></td>
 
</texcode></td>
 +
<td>yes</td>
 
<td>yes</td>
 
<td>yes</td>
 
<td>yes</td>
 
<td>yes</td>
Line 103: Line 105:
 
<th style="background-color:#DDDDDD">repeated footer</th>
 
<th style="background-color:#DDDDDD">repeated footer</th>
 
<td>no</td>
 
<td>no</td>
<td>no</td>
+
<td>table<b>s</b> only:
<td><texcode>
+
<texcode>
 
\setuptables
 
\setuptables
 
   [split=repeat]
 
   [split=repeat]
Line 112: Line 114:
 
\stoptabletail
 
\stoptabletail
 
</texcode></td>
 
</texcode></td>
 +
<td>no?</td>
 +
<td>yes</td>
 
<td>no</td>
 
<td>no</td>
<td>no</td>
+
<td>unknown</td>
<td>yes</td>
 
 
</tr>
 
</tr>
  
Line 120: Line 123:
 
<th style="background-color:#DDDDDD">automatic fitting to given table width</th>
 
<th style="background-color:#DDDDDD">automatic fitting to given table width</th>
 
<td>no</td>
 
<td>no</td>
<td><cmd>SetTableToWidth</cmd></td>
 
 
<td><cmd>SetTableToWidth</cmd></td>
 
<td><cmd>SetTableToWidth</cmd></td>
 
<td>
 
<td>
Line 128: Line 130:
 
  textwidth=10cm]
 
  textwidth=10cm]
 
</texcode></td>
 
</texcode></td>
 +
<td>yes</td>
 +
<td>default</td>
 
<td>unknown</td>
 
<td>unknown</td>
<td>default</td>
 
 
</tr>
 
</tr>
  
Line 135: Line 138:
 
<th style="background-color:#DDDDDD">problems</th>
 
<th style="background-color:#DDDDDD">problems</th>
 
<td>very limited</td>
 
<td>very limited</td>
<td>limited</td>
+
<td>some limitations, problems with spacing
<td><texcode>
+
<texcode>
 
\starttext
 
\starttext
 
\starttablehead
 
\starttablehead
Line 152: Line 155:
 
</texcode></td>
 
</texcode></td>
 
<td>there may be problems in width and height calculation and perhaps the multipage features</td>
 
<td>there may be problems in width and height calculation and perhaps the multipage features</td>
<td>experimental, nearly no documentation</td>
 
 
<td>very verbose</td>
 
<td>very verbose</td>
 +
<td>lack of documentation, just experimental</td>
 +
<td>limitations, lack of documentation</td>
 
</tr>
 
</tr>
  
 +
<!-- Tabulate Table(s) TABLE xtable linetable framedtable -->
 
<tr align="left" valign="top" style="background-color:#EEEEEE;">
 
<tr align="left" valign="top" style="background-color:#EEEEEE;">
 
<th style="background-color:#DDDDDD">documentation (except wiki)</th>
 
<th style="background-color:#DDDDDD">documentation (except wiki)</th>
 
<td>[http://pmrb.free.fr/contextref.pdf contextref.pdf], [[source:tabl-tbl.mkii|tabl-tbl.mkii]], [http://www.ntg.nl/maps/pdf/22_28.pdf MAPS article]</td>
 
<td>[http://pmrb.free.fr/contextref.pdf contextref.pdf], [[source:tabl-tbl.mkii|tabl-tbl.mkii]], [http://www.ntg.nl/maps/pdf/22_28.pdf MAPS article]</td>
 
<td>[[manual:mp-cb-en.pdf|ms-cb-en.pdf]], [[source:tabl-tab.mkii|tabl-tab.mkii]]</td>
 
<td>[[manual:mp-cb-en.pdf|ms-cb-en.pdf]], [[source:tabl-tab.mkii|tabl-tab.mkii]]</td>
<td>[[source:tabl-tab.mkii|tabl-tab.mkii]]</td>
 
 
<td>[[manual:enattab.pdf|enattab.pdf]], [http://dl.contextgarden.net/myway/NaturalTables.pdf NaturalTables.pdf], [[source:tabl-ntb.mkii|tabl-ntb.mkii]] / [[source:tabl-ntb.mkiv|tabl-ntb.mkiv]]</td>
 
<td>[[manual:enattab.pdf|enattab.pdf]], [http://dl.contextgarden.net/myway/NaturalTables.pdf NaturalTables.pdf], [[source:tabl-ntb.mkii|tabl-ntb.mkii]] / [[source:tabl-ntb.mkiv|tabl-ntb.mkiv]]</td>
 +
<td>[http://www.pragma-ade.com/general/manuals/xtables-mkiv.pdf xtables-mkiv.pdf], [[source:tabl-xtb.lua|tabl-xtb.lua]]</td>
 
<td>[[source:tabl-ltb.mkii|tabl-ltb.mkii]] / [[source:tabl-ltb.mkiv|tabl-ltb.mkiv]]</td>
 
<td>[[source:tabl-ltb.mkii|tabl-ltb.mkii]] / [[source:tabl-ltb.mkiv|tabl-ltb.mkiv]]</td>
<td>[http://www.pragma-ade.com/general/manuals/xtables-mkiv.pdf xtables-mkiv.pdf], [[source:tabl-xtb.lua|tabl-xtb.lua]]</td>
+
<td>?</td>
 
</tr>
 
</tr>
 
</table>
 
</table>
  
 
[[Category:Tables]]
 
[[Category:Tables]]

Revision as of 09:56, 13 September 2017

< Visuals | Structurals >

ConTeXt has a whole bunch of possibilities to typeset tables. Not each provides everything you may need.

  • Tabulate (tabulation, recommended for simple requirements)
  • TABLE (natural tables, HTML tables, recommended)
  • xtables (extreme tables – mostly compatible to natural tables, better for page breaking)
  • framed tables (for simple tables that span hundreds of pages)

Older ones:

  • Table (TaBlE, deprecated)
  • Tables (multipage TaBlE, deprecated)
  • Linetable ("new" multipage tables, experimental and probably obsolete)

Note that you can use natural and extreme tables with the old Table/Tabulate syntax. (To make this even more confusing...)

If you have simple tables with lots of contents, and you're tired of typing \bTR\bTDs or \NC\NRs, you can also have a look at

Features

Feature TabulateTable/Tables TABLExtablesLinetableframedtable
horizonal lines \HL \HL
\setupTABLE
[topframe=on]
or
\setupTABLE
[bottomframe=on]
\setupxtable[...]
unknown yes
vertical lines \VL \VL
\setupTABLE
[leftframe=on]
or
\setupTABLE
[rightframe=on]
\setupxtable[...]
unknown yes
multipage yes no / yes (tables) yes, with split=yes or split=repeat yes, even horizontally yes, even horizontally yes
repeated header
\setuptabulate
[header=repeat]
\starttabulatehead
...
\stoptabulatehead
only one line
tables only:
\setuptables
  [split=repeat]

\starttablehead
...
\stoptablehead
\bTABLE
[split=repeat]
\bTABLEhead
...
\eTABLEhead
yes yes yes
repeated footer no tables only:
\setuptables
  [split=repeat]

\starttabletail
...
\stoptabletail
no? yes no unknown
automatic fitting to given table width no \SetTableToWidth
\setupTABLE
[option=stretch,
 textwidth=10cm]
yes default unknown
problems very limited some limitations, problems with spacing
\starttext
\starttablehead
  \HL
\stoptablehead
\starttables[|l|l|]
\dorecurse{50}{%
  \VL SomeText
  \VL SomeText
  \VL \AR}
\stoptables
Problem: top margin on
first page is bigger.
\stoptext
there may be problems in width and height calculation and perhaps the multipage features very verbose lack of documentation, just experimental limitations, lack of documentation
documentation (except wiki) contextref.pdf, tabl-tbl.mkii, MAPS article ms-cb-en.pdf, tabl-tab.mkii enattab.pdf, NaturalTables.pdf, tabl-ntb.mkii / tabl-ntb.mkiv xtables-mkiv.pdf, tabl-xtb.lua tabl-ltb.mkii / tabl-ltb.mkiv ?