table

tableNodeAliases:tbl

A table. The body is pipe-delimited rows with inline Chalk in the cells, or nothing at all when data: binds a dataset instead. Header and footer rows and columns are switchable, and rows, columns or single cells can be highlighted.

#Attributes

dataImplicit
A @data dataset supplying the rows, in place of a body — table:#survey. The same rows can then feed a table, a mark and a code environment without being typed once per consumer.Can be written as shorthand: table:value
Which columns of data: to show, and in what order — plain column names, not references, so no #. Omit for every column in the dataset's own order.
header-row
Also written: headerHas header row. With data:, the dataset's column names are that row.
Defaulttrue
header-column
Also written: header-colHas header column.
Defaultfalse
footer-row
Has footer row.
Defaultfalse
footer-column
Also written: footer-colHas footer column.
Defaultfalse
highlight-rows
Also written: highlight-rowRow indices to highlight.
highlight-columns
Also written: highlight-cols, highlight-col, highlight-columnColumn indices to highlight.
highlight-cells
Also written: highlight-cellCells to highlight, comma-separated. A single reference is a column letter and a row number (B2); a range joins two with a hyphen (A1-C3) and covers the block between them.
highlight-colour
neutralredorangeyellowgreentealbluepurplepinkgreywhiteblack
Also written: highlight-colorHighlight colour.
Defaultblue
delimiter
Also written: delimColumn delimiter character.
Default|
Also written: captionA caption above the table. Inline Chalk, so Yield at $T = 300K$ sets the maths.
mode
inlineenvironment
How the table presents: inline for a static display in place, environment to expand it into the canvas.
Defaultinline

#Allowed content

Body { }Pipe-delimited table rows with inline Chalk formatting in cells — or none at all, when data: supplies the rows from a dataset

#Allowed in

#Examples

table{
    Name | Score
    Alice | 92
    Bob | 88
}(
    header-row: true
)
table{
    x | y
    0 | 0
    1 | 1
}(
    title: Sample Data
    highlight-rows: 2
)

#Notes

  • highlight-rows and highlight-columns are 1-based and count every row and column drawn, the header among them — so with header-row on, the first row of data is row 2.
  • Every row needs the same number of delimiters as the header: rows are split on the delimiter and nothing is padded, so a row missing one renders short and its cells sit under the wrong headings. A cell with no value keeps its delimiters — write a placeholder in it rather than leaving the line to end early.