Lay out nested tables inside their cell

Nested tabulars were flattened to a text summary before the outer halign
parsed them, so the inner rows never existed as a table. Keep them instead:
strip_page_geometry replaces each nested block with a \texrranested{index}
token and stores the source on the geometry, and tabular_unit resolves the
token into a recursively built inner table attached to the cell. Cell text is
cleared, column widths and row height take the inner table's metrics, and page
splitting remaps nested row indices when it chunks rows.

Halign gains a nested list, refresh_measurements, nested-aware row_height and a
painting branch that translates the inner display list to the cell position at
the row's alignment. The old flattening pass stays as a dead-code fallback.

The nested-table test now checks one stored source, the placeholder token, one
attached 2x2 table in cell (0, 1), an empty outer cell and inner "a"/"d"
painted in the preview SVG.
This commit is contained in:
gloamxun committed 2026-10-27 00:38:02 +08:00
1 parent 371f05baaa
commit 81da180ab7
3 files changed
+205 -23

No files matched your search

+4 -3
View File
@@ -553,9 +553,10 @@ are:
as empty text.
- **Tables**: `\multirow` centres over its rows, `array` column modifiers
`>{}`/`<{}` and the outer `\tabcolsep` margins are parsed. A nested
`tabular` no longer terminates the outer capture: its rows and cells are
flattened into one text run inside the cell (`a b ; c d`), so the outer
structure survives, while true nested-table layout and `\valign` remain
`tabular` is attached to its outer cell as a real inner table: column widths
and row heights account for it, the inner table is painted at the cell
position, and page splitting remaps its row index. Images inside a nested
table are not merged into the outer display list, and `\valign` remains
unmodelled.
- **Fonts**: the twelve Computer Modern faces and four math faces are embedded
as Type1 with per-glyph Liberation fallback. Greek math commands now map to