Skip to main content

Tables

A table is a grid. Cells are flat, spans are stated on the cell, and rules are their own elements — there is no <tr>, no <thead>, no <tbody> and no column-definition block.

<col keep gap={2}>
<caption labelled-by="tab-time">Table 1. Update time per sweep, in milliseconds.</caption>
<table id="tab-time" columns={4} align={ ["left", "right", "right", "right"] }>
<rule height={0.6} />
<cell header>sites</cell><cell header>time</cell>
<cell header>bandwidth</cell><cell header>speed-up</cell>
<rule height={0.4} />
<cell>10³</cell><cell>0.42</cell><cell>18.1</cell><cell>1.00</cell>
<cell>10⁴</cell><cell>0.68</cell><cell>44.9</cell><cell>1.61</cell>
<rule height={0.6} />
</table>
</col>

Cells​

AttributeMeaning
headerMark the cell as a header cell
spanHow many columns the cell covers (default 1)
rowsHow many rows the cell covers (default 1)
alignOverrides the column's alignment for this cell

Cells fill left to right. A row ends when its spans sum to columns. compile simulates the placement and reports:

  • table-overlap — two cells claim the same grid position;
  • table-hole — a row does not fill all columns;
  • table-columns — the table has no columns.
<table columns={3}>
<cell header span={3}>Measured on one socket</cell>
<cell>A</cell><cell rows={2}>spans two rows</cell><cell>1</cell>
<cell>B</cell><cell>2</cell>
</table>

Alignment​

align on the table is one alignment per grid column, and its length must equal columns (table-align-length). A cell's own align wins.

<table columns={3} align={ ["left", "center", "right"] }>
<cell>left</cell><cell>centre</cell><cell>right</cell>
<cell align="right">still right</cell><cell>centre</cell><cell>right</cell>
</table>

Rules​

A <rule> is legal only inside a table (rule-outside-table).

Horizontal — no column. It spans the grid's width, its thickness is height (or width), and it is legal only where the current row is complete (table-rule-mid-row).

Vertical — column={n}. It draws the boundary after column n, spans the table's height by default, and its thickness is width (or height). Two rules naming one boundary are an error (table-rule-duplicate). A boundary outside 0..=columns is an error (table-rule-boundary).

A vertical rule may cover a row range with from and to (1-based, inclusive). to must name a row after from (table-rule-range).

<table columns={3}>
<rule height={0.6} />
<cell header>a</cell><cell header>b</cell><cell header>c</cell>
<rule column={1} width={0.3} from={2} to={4} />
<cell>1</cell><cell>2</cell><cell>3</cell>
<rule height={0.6} />
</table>

Every rule takes color:

<rule height={0.5} color="#b23a24" />

Rules survive into static source as <rule> elements. They are never encoded as cell borders.

Splitting across pages​

A table splits between rows, never inside a row or a cell. The header is repeated on every continuation page: leading header cells are re-drawn at the top of the continuation.

Two consequences worth knowing:

  • A split never crosses a row-spanning cell, so a very tall spanning cell can move the whole table to the next page.
  • Content that cannot split — a tall image or rule — is clipped with a warning (table-clip) rather than broken.

Wrapping the caption and table in <col keep> keeps them together: the keep prevents a break between the caption and the grid.

Checking a table​

check performs the same placement simulation without writing:

cargo mx check paper.mtx

A table that closes exactly and has no overlap produces no diagnostics. The placement rules are deliberately strict: an under-filled row is reported rather than padded, because a hole in a data table is usually a missing cell, not an intent.