Changes

Jump to navigation Jump to search
add line and dash factors
denoting the ''alignment'' within cells of this row.
For instance consider a two-column table: if any text in the
first column should be right aligned (''real''
[[right Right and left|<tt>flushright</tt>]]) and the second column
left aligned, the corresponding format string would be
<tt>|l|r|</tt>.
|}
* <{{cmd>|HL</cmd> }} draws a horizontal rule,* <{{cmd>|NC</cmd> }} marks a new column (or new cell),* <{{cmd>|NS}} marka a new cell that spans more than one column (LMTX only),* {{cmd|NN</cmd> }} marks a new math column/cell (see below),* <{{cmd>|NR</cmd> }} starts a new row,* <{{cmd>|NB</cmd> }} starts a new row as a block (avoids page breaking inside of a block, to keep some lines together<!--; available since beta of 2011-12-21-->);,* <{{cmd>|TB</cmd> }} (= "Table Blank") adds some vertical space between rows -- see an example bellowbelow,* {{cmd|VL}} (instead of {{cmd|NC}}) draws a vertical rule -- for more info see below
When using fixed width, you can use values relative to the
current page-width. For example: if you want the previous table
to take up all the width and having the second column taking three
quarters of the space, change the {{cmd|starttabulate}} to:
<texcode>
=Horizontal centering table on the page=
 
<!--(Solution from the mailing list)-->
<context source=yes>
}</context>
This can also be done with the start/stop syntax (showing only source here, since it does not compile on the wiki):
<context source=yes>
\stopplacetable
</context>
 
=Spanning columns=
 
Only LMTX since September 2021 supports wide cells:
 
<context source=yes>
\starttabulate[|r|l|c|]
\HL
\NC 123 \NC foo \NC bar \NC\NR
\NS[2][c] LMTX \NC\NR
\NC 123 \NC baz \NC bla \NC\NR
\HL
\stoptabulate
</context>
 
The two parameters of {{cmd|NS}} are the number of additional columns (i.e. 1 of you want to span 2 columns), and the formatting for it.
 
This works only with single-line cells, i.e. not with “p” columns.
=Spanning Multiple Pages=
[split=yes,
header=text,
title={\color[red] {Fenchurch St. Paul}\strut},
frame=on]
\starttext
\starttabulate[|p(1.2cm)|p(1.2cm)|]
\dorecurse{6}{
}
\stoptabulate
\stoptext
</context>
Tabulate supports header rows that can be repeated over new table
pages instead of the title.
There is a separate environment {{cmd|starttableheadstarttabulatehead}} where
this header row has to be specified in advance of its use in a
tabulation.
 
In ConTeXt MkIV the command requires an additional [], thus you need
to write {{cmd|starttabulatehead}}[] instead.
{|
\stoptabulate
</texcode>
 
In LMTX, the line commands understand one or two numerical parameters: the line factor and the dash factor. (The second is new as of 2024-02-22.)
 
<context source="yes">
\starttabulate
\FL[1,2] % linefactor (old) dashfactor (new)
\NC test \NC test and test and test and done \NC \NR
\ML[1,1]
\NC test \NC test and test and test and done \NC \NR
\NC test \NC test and test and test and done \NC \NR
\NC test \NC test and test and test and done \NC \NR
\LL[1,10]
\stoptabulate
</context>
Other types can be discovered in the source
===Vertical Rules===
The <{{cmd>|VL</cmd> }} command serves as a replacement for <{{cmd>|NC</cmd>}}
to mark a cell border wherever a vertical rule may be desired (if
they are to be desired at all from a typographical point of
For ''horizontal rules'' see above.
For ''vertical rules'', <{{cmd>|VL</cmd> }} takes a defined color as an
optional argument.
There are five color-specific control sequences:
{|
|<{{cmd>|CR</cmd> }} || color is applied to the background of the text and the remaining space on the right.
|-
|<{{cmd>|CC</cmd> }} || color is applied to the background of the text only.
|-
|<{{cmd>|CM</cmd> }} || color is applied to the background of the text and the remaining space on both sides.
|-
|<{{cmd>|CL</cmd> }} || color is applied to the background of the text and the remaining space on the left.
|-
|<{{cmd>|CT</cmd> }} || color is applied to the text itself - in other words, the "foreground color."
|}
These are to complement the normal table layout expression (the
Those control sequences, if applied within the table body, can
replace the ordinary <{{cmd>|NC</cmd>}}, allowing individual cells to
be colorized.
<texcode>
=Using math mode=
If you want to display numerics, you can simply use <{{cmd>|NN</cmd> }} for a new column instead of <{{cmd>|NC</cmd>}}. This command works similar to the [http://www.pragma-ade.comnl/general/magazines/mag-0003.pdf digit-module]. Therefore you can also abbreviate:
<texcode>\starttabulate[|l|l|]
If you always need math in one column, consider math mode columns:
<texcode>\starttabulate[|m|m|]
\HL
\NC 10e-3 \NC 10e+3 \NR
=Itemization or framed objects inside a tabulation= <!--(added by Willi Egger 04-08-2011)-->
The following issue is related to MkIV:
</texcode>
The same is true if you use {{cmd|framed}} or something that uses it internally, like [[Widgets]], within Tabulate.
 
=Combining enumerations and tabulations=
 
{{cmd|NI}} (new item) exists since 2017-09-25. {{cmd|itemtag}} is old, but undocumented. Source: http://source.contextgarden.net/tex/context/base/mkiv/strc-itm.mkvi?search=itemtag
 
<context mode=mkiv source=yes>
\startitemize[n]
\starttabulate[|||||]
\NC p \NC \itemtag \NC q \NC r \NC \NR
\NC p \NC \itemtag \NC q \NC r \NC \NR
\NC p \NC \itemtag \NC q \NC r \NC \NR
\NC p \NC \itemtag \NC q \NC r \NC \NR
\stoptabulate
\stopitemize
</context>
 
<texcode>
\startitemize[n]
\starttabulate[|||||]
\NI x \NC y \NC z \NC \NR
\NI x \NC y \NC z \NC \NR
\NI x \NC y \NC z \NC \NR
\NI x \NC y \NC z \NC \NR
\stoptabulate
\stopitemize
 
\startitemize[n]
\starttabulate[|||||]
\NI b \NC c \NC d \NC \NR
\NC a \NI c \NC d \NC \NR
\NC a \NC b \NI d \NC \NR
\NC a \NC b \NC c \NI \NR
\stoptabulate
\stopitemize
</texcode>
 
=EQ option within table=
 
EQ option defines text which will be placed by \EQ column separator.
Source: https://www.mail-archive.com/ntg-context@ntg.nl/msg95207.html
 
<context mode=mkiv source=yes>
\starttabulate[|l|r|r|][EQ={=}]
\NC DC \EQ 3.20 bbl \EQ 420 ft \NC\NR
\NC HWDP \EQ 3.90 bbl \EQ 450 ft \NC\NR
\NC DP \EQ 34.63 bbl \EQ 2.037 ft \NC\NR
\NC DC \EQ 41.73 bbl \EQ 2.907 ft \NC\NR
\stoptabulate
</context>
=See also=
* More features are constantly added and documented in the {{src|tabl-tbl.mkiv|source}}.
* {{cmd|starttabulate}}, {{cmd|setuptabulate}}, {{cmd|definetabulate}}
* [[TABLE|Natural Tables]]
* {{cmd|starttable}}, <s>{{cmd|setuptable}}</s>
[[Category:Tables]]

Navigation menu