Changes

Jump to navigation Jump to search
1,922 bytes added ,  11:54, 21 December 2018
m
Document that [] is required for \starttabulatehead in MkIV. Email by Wolfgang Schuster 2018-11-12.
as the text itself.
'''Warning''': When you want to use tables with macros use \{{cmd|starttable }} and \stoptable. \{{cmd|starttabulate }} and \stoptabulate does not work correctly with macros.
=Basic commands=
The control sequence <tt>\{{cmd|starttabulate|[#1]</tt> }} takes a layout
string as optional argument.
As is common with tables in TeX-based typesetting, this string
- wtf this listing was full of <tab> chars‽ Was this supposed
- to be a bad pun on *tabulate*?
- - No, I formatted it readably in my text editor. --HR
-->
{|
|-
| <texcode>
\starttabulate[|r|l|lB|]
\HL
\NC {\bf format} \NC {\bf meaning} \NC Mk \NC\NR
\HL
\NC c \NC centered \NC \NC\NR\NC l \NC left aligned \NC \NC\NR\NC r \NC right aligned \NC \NC\NR\NC w(1cm) \NC one line, fixed width \NC \NC\NR\NC p(2cm) \NC paragraph, lines broken to fixed width \NC \NC\NR\NC cg(.) \NC align on a character \NC IV: cg{.} \NC\NR\TB[halfline]NC m \NC math mode \NC IV only \NC\NR\NC b \NC bigger vertical space before e.g. b{\star} \NC IV only \NC\NR\NC a \NC after, e.g. a{\percent} \NC IV only \NC\NR
\HL
\stoptabulate
|<context>
\setuppapersize[A5]
\starttabulate[|r|l|lB|]
\HL
\NC {\bf format} \NC {\bf meaning} \NC Mk \NC\NR
\HL
\NC c \NC centered \NC\NR
\NC w(1cm) \NC one line, fixed width \NC\NR
\NC p(2cm) \NC paragraph, lines broken to fixed width \NC\NR
\NC cg(.) \NC align on a character \NC\NR\TB[halfline]\NC \NC bigger vertical space \NC\NR
\HL
\stoptabulate
|}
* <ttcmd>HL</ttcmd> draws a horizontal rule,* <ttcmd>NC</ttcmd> marks a new column (or new cell),* <ttcmd>NN</cmd> marks a new math column/cell (see below),* <cmd>NR</ttcmd> starts a new row,* <ttcmd>NB</ttcmd> 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-->);* <ttcmd>TB</ttcmd> (= "Table Blank") adds some vertical space between rows -- see an example bellow,* <cmd>VL</cmd> (instead of <cmd>NC</cmd>) 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
take up all the width and having the second column taking three
quarters of the space, change the {{cmd|starttabulate }} to:
<texcode>
\starttabulate[|rw(.25\textwidth)|lw(.75\textwidth)|]
</texcode>
(Mistake: This doesn’t account for the width of the column distance!)
=Horizontal centering table on the page=
<!--(Solution from the mailing list)-->
<context source=yes>
\starttabulate[|r|l|]
\HL
\NC I want this table \NC aligned in the center.\NC\NR
\HL
\stoptabulate
This can also be done with the start/stop syntax (showing only source here, since it does not compile on the wiki):
<texcodecontext source=yes>
This is a very long text, longer than the width of the table.
It must be long enough to flow to the next line to see the effect.
\starttabulate[|r|l|]
\HL
\NC I want this table \NC aligned in the center.\NC\NR
\HL
\stoptabulate
\stopplacetable
</texcodecontext>
=Spanning Multiple Pages=
To achieve this the argument <tt>split</tt> must be set to
''true''.
 
''NB'': the difference between setting and unsetting this
argument may not be visible on the first few pages. Rather, it
repeated above at every page break that occurs inside the table.
This name needs to be specified as the argument of the
<tt>title</tt> key of <tt>\{{cmd|setuptabulate</tt>}}.
The <tt>header</tt> key has to be set to <em>text</em> for this
to work.
Tabulate supports header rows that can be repeated over new table
pages instead of the title.
There is a separate environment <tt>\starttablehead</tt> {{cmd|starttabulatehead}} 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.
{|
\starttabulatehead
\HLFL
\NC {\bf format char} \NC {\bf meaning} \NC \AR
\HLLL
\stoptabulatehead
\starttabulatehead
\HLFL
\NC {\bf format char} \NC {\bf meaning} \AR
\HLLL
\stoptabulatehead
</context>
|}
 
Note the use of <tt>\FL</tt> and <tt>\LL</tt> in the tabulate header rather than <tt>\HL</tt> which is a standard rule command (see below) that tries to guess automatically its position.
=Individualizing the Tabulate Look=
Hans initially announced support for vertical lines and colors on
the mailing list.[http://archive.contextgarden.net/message/20101117.123950.739657a7.en.html]
==Rules==
Context supports different categories of rules that can be
configured individually in order to discern various applications.
Their behaviour accounts for the designated use, e.&nbsp;g.
<tt>\ML</tt> (mid rules) are intended to be deployed between
ordinary rows of the table body and will prevent page breaks
|}
Additionally, there is an options option <tt>rulecolor</tt> for<tt>\{{cmd|setuptabulate</tt> }} that allows for those rules to be tinted.
<texcode>
===Vertical Rules===
The <ttcmd>\VL</ttcmd> command serves as a replacement for <ttcmd>\NC</ttcmd>
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'', <ttcmd>\VL</ttcmd> takes a defined color as an
optional argument.
There are five color-specific control sequences:
{|
|<ttcmd>CR</ttcmd> || color is applied to the background of the text and the remaining space on the right.
|-
|<ttcmd>CC</ttcmd> || color is applied to the background of the text only.
|-
|<ttcmd>CM</ttcmd> || color is applied to the background of the text and the remaining space on both sides.
|-
|<ttcmd>CL</ttcmd> || color is applied to the background of the text and the remaining space on the left.
|-
|<ttcmd>CT</ttcmd> || color is applied to the text itself - in other words, the "foreground color."
|}
These are to complement the normal table layout expression (the
first argument to <tt>\{{cmd|starttabulate</tt>}.
Thus, in order to colorize a four column table with the initial
layout <tt>|c|c|c|c|</tt> it will have to be modified as follows:
Those control sequences, if applied within the table body, can
replace the ordinary <ttcmd>\NC</ttcmd>, allowing individual cells to
be colorized.
<texcode>
although both variants do work.
If you always need math in one column, consider math mode columns:
<texcode>\starttabulate[|m|m|]\HL\NC 10e-3 \NC 10e+3 \NR\HL\stoptabulate</texcode>  =Itemization or framed objects inside a tabulation=
<!--(added by Willi Egger 04-08-2011, edited by Hraban 2015-10-06)-->
The following issue is related to MKIVMkIV:
When using an itemization inside a tabulation where one uses also the
<tt>\{{cmd|head</tt> }} command , there occurs a snapping problem. This is related to penalties which force a twoline split whereas the snapping mechanism prevents this. As a result two lines are typeset on top of each other. The solution is to add the following statement to the preamble:
<texcode>\tabulatesplitlinemode \plustwo</texcode>
\NC\NR
\stoptabulate
</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>
* More features are constantly added and documented in the {{src|tabl-tbl.mkiv|source}}.
* {{cmd|starttabulate}}, {{cmd|setuptabulate}}
* [[TABLE|Natural Tables]]
* {{cmd|starttable}}, <s>{{cmd|setuptable}}</s>
[[Category:Tables]]
tt>\head
3

edits

Navigation menu