Jump to navigation Jump to search
23 bytes added ,  13:24, 9 August 2020
Text replacement - "<cmd>" to "{{cmd|"
This is ConTeXts oldest table module. It uses the same formatting as [[Tabulate]] (see [[Tables Overview]]).
This mode is based on Michael Wichura's TaBlE package for PlainTeX. The official manual for it is commercial (about 40 USD), see [ PCTeX] -- but note that the TaBlE manual only talks about the original syntax, which does not use <{{cmd>|NC</cmd>}}, <{{cmd>|HL</cmd> }} cum suis.
The only ConTeXt docs are in [[manual:ms-cb-en.pdf|ConTeXt - an excursion]]. There is also two introductory articles in tugboat [ ConTeXt basics for users: Table macros] [ Table macros II] by Aditya Mahajan (2007 and 2008).
== Basic Commands ==
* You get vertical lines (rules), if you use <{{cmd>|VL</cmd> }} instead of <{{cmd>|NC</cmd>}}.* Better use <{{cmd>|SR</cmd>}}, <{{cmd>|FR</cmd>}}, <{{cmd>|MR</cmd>}}, <{{cmd>|LR</cmd> }} instead of <{{cmd>|NR</cmd>}}.* You can also use <{{cmd>|AR</cmd> }} instead of <{{cmd>|SR</cmd>}}, <{{cmd>|FR</cmd>}}, <{{cmd>|MR</cmd> }} and <{{cmd>|LR</cmd> }} (AR for automatic row).* You can leave out the <{{cmd>|NC</cmd> }} before the "row" command, but not if you use <{{cmd>|AR</cmd> }} in a last or single row (see example).* You can influence the table with <{{cmd>|setuptables</cmd>.* There are also <cmd>BL</cmd> and <cmd>CL</cmd> for colored backgrounds, see below}}.
==Column Definition==
The table is defined by the template enclosed in square brackets after <{{cmd>|starttable</cmd>}}. The template has the form
<tt>|keys for the first column|keys for the second column|...|keys for the last column|</tt>. Please note that each column is surrounded by <tt>|</tt> signs. These are necessary. The formatting keys for each column can be a choice of
\NC \type{r} \VL right-aligned column\AR
\NC \type{p(width)} \VL Set each cell as a paragraph\AR
\NC \type{s(width)} \VL Specify the inter-column width\AR
\NC \type{w} \VL Set minimum column width\AR
\NC \type{k} \VL Insert a kern both left and right of the column\AR
==Column Spans==
It's possible to create columnspans (i.e. cells that span more than one column) with the command <{{cmd>|use{<i>N</i>}</cmd> }} where ''N'' is the number of columns spanned by the cell. It's often necessary to use <{{cmd>|ReFormat[<i>new keys</i>]{}</cmd> }} to reformat this specific cell according to the ''new keys''.
(<{{cmd>|ReFormat</cmd> }} can be abbreviated <{{cmd>|REF</cmd> }} for brevity.)
== Row Spans==
It's also possible to create rowspans (i.e. cells that span more than one row) with the command <{{cmd>|Raise(<i>dimen</i>){<i>content</i>}</cmd> }} or <{{cmd>|Lower(<i>dimen</i>){</i>content</i>}</cmd> }} that raise or lower ''content'' by ''dimen''.
<table cols="2"><tr valign="top"><td>
(<{{cmd>|Lower(.5\lineheight){a}</cmd> }} can be abbreviated <{{cmd>|LOW{a}</cmd> }} for brevity.)
An alternative means of spanning rows by a tall object makes use of a bit of TeX magic:
<{{cmd>|smash{tall objextobject}}}</cmd>:
<table cols="2"><tr valign="top"><td>
* See [[Floating Objects]] in general.
* If you need information about <{{cmd>|placetable</cmd> }} look after <{{cmd>|placefloat</cmd> }} in the manual or texshow!
* If you do not want a caption for your table, to get rid of it altogether you have to add "none" to settings and then leave the braces empty; if you only leave the braces empty, your table will still be numbered ("Table 1" etc.).
==Background Colors==
Note: Adding color to tables using the `\CL` and `\BL` commands appears to be deprecated in MKIV; see:
A very nice application in table are background colors for rows/cells (a feature that doesn't work in [[Tabulate]]):
won't cover the whole cell.
* <{{cmd>|BL</cmd> }} makes a gray background: the optional argument tells BL how many cells it should color* <{{cmd>|CL</cmd> }} makes a colored row
==Fit Table Width==

Navigation menu