pandoc/test/tables.context
Albert Krewinkel f49bee5c31
ConTeXt writer: support complex table structures. (#8116)
The following table feature are now supported in ConTeXt:

- colspans,
- rowspans,
- multiple bodies,
- row headers, and
- multi-row table head and foot.

The wrapping `placetable` environment is also given a `reference` option
with the table identifier, enabling referencing of the table from within
the document.
2022-06-21 10:22:34 -07:00

258 lines
7.1 KiB
Text

Simple table with caption:
\startplacetable[title={Demonstration of simple table syntax.}]
\startxtable
\startxtablehead[head]
\startxrowgroup[lastrow]
\startxrow
\startxcell[align=left] Right \stopxcell
\startxcell[align=right] Left \stopxcell
\startxcell[align=middle] Center \stopxcell
\startxcell Default \stopxcell
\stopxrow
\stopxrowgroup
\stopxtablehead
\startxtablebody[body]
\startxrow
\startxcell[align=left] 12 \stopxcell
\startxcell[align=right] 12 \stopxcell
\startxcell[align=middle] 12 \stopxcell
\startxcell 12 \stopxcell
\stopxrow
\startxrow
\startxcell[align=left] 123 \stopxcell
\startxcell[align=right] 123 \stopxcell
\startxcell[align=middle] 123 \stopxcell
\startxcell 123 \stopxcell
\stopxrow
\startxrowgroup[lastrow]
\startxrow
\startxcell[align=left] 1 \stopxcell
\startxcell[align=right] 1 \stopxcell
\startxcell[align=middle] 1 \stopxcell
\startxcell 1 \stopxcell
\stopxrow
\stopxrowgroup
\stopxtablebody
\startxtablefoot[foot]
\stopxtablefoot
\stopxtable
\stopplacetable
Simple table without caption:
\startplacetable[location=none]
\startxtable
\startxtablehead[head]
\startxrowgroup[lastrow]
\startxrow
\startxcell[align=left] Right \stopxcell
\startxcell[align=right] Left \stopxcell
\startxcell[align=middle] Center \stopxcell
\startxcell Default \stopxcell
\stopxrow
\stopxrowgroup
\stopxtablehead
\startxtablebody[body]
\startxrow
\startxcell[align=left] 12 \stopxcell
\startxcell[align=right] 12 \stopxcell
\startxcell[align=middle] 12 \stopxcell
\startxcell 12 \stopxcell
\stopxrow
\startxrow
\startxcell[align=left] 123 \stopxcell
\startxcell[align=right] 123 \stopxcell
\startxcell[align=middle] 123 \stopxcell
\startxcell 123 \stopxcell
\stopxrow
\startxrowgroup[lastrow]
\startxrow
\startxcell[align=left] 1 \stopxcell
\startxcell[align=right] 1 \stopxcell
\startxcell[align=middle] 1 \stopxcell
\startxcell 1 \stopxcell
\stopxrow
\stopxrowgroup
\stopxtablebody
\startxtablefoot[foot]
\stopxtablefoot
\stopxtable
\stopplacetable
Simple table indented two spaces:
\startplacetable[title={Demonstration of simple table syntax.}]
\startxtable
\startxtablehead[head]
\startxrowgroup[lastrow]
\startxrow
\startxcell[align=left] Right \stopxcell
\startxcell[align=right] Left \stopxcell
\startxcell[align=middle] Center \stopxcell
\startxcell Default \stopxcell
\stopxrow
\stopxrowgroup
\stopxtablehead
\startxtablebody[body]
\startxrow
\startxcell[align=left] 12 \stopxcell
\startxcell[align=right] 12 \stopxcell
\startxcell[align=middle] 12 \stopxcell
\startxcell 12 \stopxcell
\stopxrow
\startxrow
\startxcell[align=left] 123 \stopxcell
\startxcell[align=right] 123 \stopxcell
\startxcell[align=middle] 123 \stopxcell
\startxcell 123 \stopxcell
\stopxrow
\startxrowgroup[lastrow]
\startxrow
\startxcell[align=left] 1 \stopxcell
\startxcell[align=right] 1 \stopxcell
\startxcell[align=middle] 1 \stopxcell
\startxcell 1 \stopxcell
\stopxrow
\stopxrowgroup
\stopxtablebody
\startxtablefoot[foot]
\stopxtablefoot
\stopxtable
\stopplacetable
Multiline table with caption:
\startplacetable[title={Here's the caption. It may span multiple lines.}]
\startxtable
\startxtablehead[head]
\startxrowgroup[lastrow]
\startxrow
\startxcell[align=middle,width={0.15\textwidth}] Centered Header \stopxcell
\startxcell[align=right,width={0.14\textwidth}] Left Aligned \stopxcell
\startxcell[align=left,width={0.16\textwidth}] Right Aligned \stopxcell
\startxcell[align=right,width={0.35\textwidth}] Default aligned \stopxcell
\stopxrow
\stopxrowgroup
\stopxtablehead
\startxtablebody[body]
\startxrow
\startxcell[align=middle,width={0.15\textwidth}] First \stopxcell
\startxcell[align=right,width={0.14\textwidth}] row \stopxcell
\startxcell[align=left,width={0.16\textwidth}] 12.0 \stopxcell
\startxcell[align=right,width={0.35\textwidth}] Example of a row that spans
multiple lines. \stopxcell
\stopxrow
\startxrowgroup[lastrow]
\startxrow
\startxcell[align=middle,width={0.15\textwidth}] Second \stopxcell
\startxcell[align=right,width={0.14\textwidth}] row \stopxcell
\startxcell[align=left,width={0.16\textwidth}] 5.0 \stopxcell
\startxcell[align=right,width={0.35\textwidth}] Here's another one. Note the
blank line between rows. \stopxcell
\stopxrow
\stopxrowgroup
\stopxtablebody
\startxtablefoot[foot]
\stopxtablefoot
\stopxtable
\stopplacetable
Multiline table without caption:
\startplacetable[location=none]
\startxtable
\startxtablehead[head]
\startxrowgroup[lastrow]
\startxrow
\startxcell[align=middle,width={0.15\textwidth}] Centered Header \stopxcell
\startxcell[align=right,width={0.14\textwidth}] Left Aligned \stopxcell
\startxcell[align=left,width={0.16\textwidth}] Right Aligned \stopxcell
\startxcell[align=right,width={0.35\textwidth}] Default aligned \stopxcell
\stopxrow
\stopxrowgroup
\stopxtablehead
\startxtablebody[body]
\startxrow
\startxcell[align=middle,width={0.15\textwidth}] First \stopxcell
\startxcell[align=right,width={0.14\textwidth}] row \stopxcell
\startxcell[align=left,width={0.16\textwidth}] 12.0 \stopxcell
\startxcell[align=right,width={0.35\textwidth}] Example of a row that spans
multiple lines. \stopxcell
\stopxrow
\startxrowgroup[lastrow]
\startxrow
\startxcell[align=middle,width={0.15\textwidth}] Second \stopxcell
\startxcell[align=right,width={0.14\textwidth}] row \stopxcell
\startxcell[align=left,width={0.16\textwidth}] 5.0 \stopxcell
\startxcell[align=right,width={0.35\textwidth}] Here's another one. Note the
blank line between rows. \stopxcell
\stopxrow
\stopxrowgroup
\stopxtablebody
\startxtablefoot[foot]
\stopxtablefoot
\stopxtable
\stopplacetable
Table without column headers:
\startplacetable[location=none]
\startxtable
\startxtablehead[head]
\stopxtablehead
\startxtablebody[body]
\startxrow
\startxcell[align=left] 12 \stopxcell
\startxcell[align=right] 12 \stopxcell
\startxcell[align=middle] 12 \stopxcell
\startxcell[align=left] 12 \stopxcell
\stopxrow
\startxrow
\startxcell[align=left] 123 \stopxcell
\startxcell[align=right] 123 \stopxcell
\startxcell[align=middle] 123 \stopxcell
\startxcell[align=left] 123 \stopxcell
\stopxrow
\startxrowgroup[lastrow]
\startxrow
\startxcell[align=left] 1 \stopxcell
\startxcell[align=right] 1 \stopxcell
\startxcell[align=middle] 1 \stopxcell
\startxcell[align=left] 1 \stopxcell
\stopxrow
\stopxrowgroup
\stopxtablebody
\startxtablefoot[foot]
\stopxtablefoot
\stopxtable
\stopplacetable
Multiline table without column headers:
\startplacetable[location=none]
\startxtable
\startxtablehead[head]
\stopxtablehead
\startxtablebody[body]
\startxrow
\startxcell[align=middle,width={0.15\textwidth}] First \stopxcell
\startxcell[align=right,width={0.14\textwidth}] row \stopxcell
\startxcell[align=left,width={0.16\textwidth}] 12.0 \stopxcell
\startxcell[width={0.35\textwidth}] Example of a row that spans multiple
lines. \stopxcell
\stopxrow
\startxrowgroup[lastrow]
\startxrow
\startxcell[align=middle,width={0.15\textwidth}] Second \stopxcell
\startxcell[align=right,width={0.14\textwidth}] row \stopxcell
\startxcell[align=left,width={0.16\textwidth}] 5.0 \stopxcell
\startxcell[width={0.35\textwidth}] Here's another one. Note the blank line
between rows. \stopxcell
\stopxrow
\stopxrowgroup
\stopxtablebody
\startxtablefoot[foot]
\stopxtablefoot
\stopxtable
\stopplacetable