Skip to content

render-pipeline: longtable, multirow, cmidrule trims and colortbl fills - #176

Closed
GoKubar wants to merge 8 commits into
mainfrom
agent/kabir-claude/table-packages
Closed

GoKubar wants to merge 8 commits into
mainfrom
agent/kabir-claude/table-packages

Conversation

@GoKubar

@GoKubar GoKubar commented Sep 13, 2026 •

Copy link
Copy Markdown
Contributor

Render-pipeline side of the table packages. The compiler side is draft #173.

SHAs

Built and measured against #173's compiler copied into
crates/render-pipeline/vendor/compiler (PIN preserved, never committed).

Machine note — this session ran on the NixOS PC, not the Mac. pdflatex
here is TeX Live 2025, not MacTeX 2026. Before trusting anything, every
committed MacTeX reference (fixtures 1-79) was regenerated with the local
pdflatex into a scratch directory and compared: all 79 agree byte for byte,
words and rules alike, so the committed expected data is sound on both engines
and none of it was rewritten. The 19 new fixtures (80-98) carry TeX Live 2025
in their reference_engine field.

Font metrics: how these numbers were taken

flashtex-render with no environment override finds none of its default font
directories on this machine, falls back to Times metrics with
error[font_unavailable], and still exits "recovered, N pages, 0 overfull" —
so a harness that only counts overfull boxes scores that as a pass on entirely
wrong geometry. Every gate below was run with the repository's own bundled,
symlink-free tree:

F=<repo>/apps/mac/Fonts
export FLASHTEX_FONT_DIRS="$F"
export FLASHTEX_TFM_DIRS="$F/texmf/fonts/tfm/public/lm:$F/texmf/fonts/tfm/jknappen/ec:$F/texmf/fonts/tfm/public/amsfonts/symbols"

(oracle.py overrides both variables from its single --fonts argument, so
gates going through it get one colon list holding the OTF directory and all
three TFM directories.) The four required TFMs in that tree hash exactly to the
pinned Latin Modern 2.004 digests in REQUIRED_TFMS.

Rather than trust the setting, each run is asserted clean: the tabular
oracle records every error-severity diagnostic per fixture, and all 98 rows
carry zero font_unavailable / required_metrics_unavailable /
ec_metrics_unavailable. The HW gate now fails outright on such a diagnostic
instead of only comparing two builds against each other — two builds sharing a
fallback would otherwise agree perfectly on wrong geometry.

Two things found while verifying this, both worth other lanes' attention:

  • The rooted, digest-bound loader refuses symlinked path components, and
    every NixOS texmf-dist directory is a symlink farm, so pointing at the
    system TeX Live is not a workaround — it reports
    required_metrics_unavailable and falls back to OpenType advances, which
    moves rules ~0.12 bp and words ~0.30 bp. That is under the oracle's 0.5 bp
    word tolerance but over its 0.1 bp rule tolerance, so it fails every
    fixture with a rule and passes every rule-less one, which reads like a table
    bug rather than a font bug. The bundled tree has no symlinks and is the right
    source.
  • The bundled jknappen/ec tree is incomplete: 70 files, with no ectt*
    (T1 typewriter). article-twocolumn and input-bibliography therefore set
    \texttt on substituted roman metrics with ec_metrics_unavailable — on the
    baseline build too, so it does not affect this PR's comparison, but it is a
    real pre-existing gap on this machine. Re-running the corpus with TeX Live's
    complete ec directory added clears all six diagnostics and leaves the
    branch-vs-baseline verdict unchanged.

The tabular numbers were taken twice, once against the bundled tree and once
against a dereferenced copy of TeX Live 2025: identical to the last decimal on
all 98 fixtures
. HW1/HW2 painted geometry is likewise identical between the
two sources (692 and 698 items).

pdftotext is absent here and is not needed: the tabular oracle shells out only
to pdflatex and the render binary, and reads PDFs with the repository's own
stdlib-only tools/visual-oracle/pdftext.py.

Done

#173, compiler (unchanged this session, verified here)

Parses longtable (\endfirsthead/\endhead/\endfoot/\endlastfoot,
\caption, \kill, \\*, \newpage, [l|c|r]), \multirow, booktabs
\cmidrule(l{..}r)/\addlinespace/\specialrule/\morecmidrules, and colortbl
\rowcolor/\cellcolor/\columncolor/\arrayrulecolor/\doublerulesepcolor;
e84b9885 makes the cmidrule kerns and \addlinespace font-relative
(FontDimen { pt, em, ex }). Its whole suite passes on this machine: 399
tests, 0 failed
.

This branch, render-pipeline

  • table.rs converts all the new compiler fields; layout covers kill rows,
    booktabs' rule classes, cmidrule trims, \arrayrulecolor on hline/cline/
    booktabs rules, and preamble-baked colours on |/||. colortbl fills follow
    \CT@@do@color. typeset.rs places multirow per multirow.sty 168-201.
    tablecolor.rs is a minimal xcolor resolver standing in for compiler: color/xcolor with pdfTeX-exact colour operators (982/982 oracle) #150.
  • ead53455 — cmidrule kerns and \addlinespace resolve through
    FontDimen::resolve(em, ex) in the font at the rule, not at a fixed 10pt.
    This is what fixture 60 was waiting for.
  • fc53bb9a — longtable. A longtable is no longer a box in a paragraph:
    Block::LongTable contributes every row, rule row and head or foot box
    straight to the page's vertical list, as \LT@array does.
    • New longtable.rs: \LT@end@hd@ft splits the entries into first head,
      head, foot, last foot and body; \LT@get@widths measures every chunk
      (\kill rows included) once and each chunk is set against that one column
      geometry; \tabskip\LTleft/\LTright place the table (\fill both sides
      by default, so centred; [l]/[c]/[r] and \setlength override).
    • table.rs splits layout into widths + layout_with(.., Options) so
      chunks share one measurement, and implements \LT@hline: two \multispan
      leader rows \LT@sep apart, not one \hrule — coincident for \hline,
      \doublerulesep apart for \hline\hline, whose second \hline \@gtempa
      gobbles. A longtable therefore paints two rules where a tabular paints one,
      which is exactly what pdflatex does.
    • pagebuild.rs: VBlock gains lineskip, contributed and line_penalty;
      a Region reduces \pagegoal by \ht\LT@foot, ends a page broken inside
      the table with \LT@foot and opens the next with \LT@head.
  • 8a061cc4 — two facts measured against pdflatex, not derived from the
    package source:
    • \prevdepth after a longtable. The chunks are \unvboxed, and \unvbox
      never sets \prevdepth, so only \box\LT@firsthead and \box\LT@lastfoot
      do; a table with no head and no foot leaves the value the material before it
      had (VBlock::depth_after). Without this the paragraph after a headless
      longtable sat 4.35pt too high.
    • \LT@start's \maxdepth\z@ does not reach the page. TeX froze
      page_max_depth when the page's first box landed (§987) — before
      \LT@start runs for a table starting mid-page — and \@makecol ends every
      page with \global\maxdepth\@maxdepth. Instrumenting \LT@output on a
      three-page longtable shows maxdepth=0pt on the first call and 6.0pt
      after; honouring the zero lost one row per continuation page.
  • 334861ab — \caption (\LT@makecaption): a \multicolumn row over
    every column holding a zero-width box centred on the table, with a
    \parbox[t]\LTcapwidth inside, so a wide caption never widens a column. One
    centred line when it fits, a paragraph otherwise, closed by
    \vskip\baselineskip; \parbox[t] is a \vtop, so the row's height is the
    first line's. Table N: uses a tie and the space after the colon carries
    TeX's space factor 2000 (worth 1.3pt on the line, 0.65 bp per word once
    centred). \caption* drops the prefix; \LTcapwidth is read from
    \setlength.
  • 18e442f7 — \newpage/\pagebreak inside a longtable (\noalign{\break}).

Gates

All on this machine, with the font environment above, each asserted free of
font/metric fallback diagnostics.

Gate Baseline (main bffd168a) This branch
Tabular oracle, fixtures 1-59 59/59 59/59 (no regression)
Tabular oracle, fixtures 60-98 0/39 39/39
Tabular oracle, total 59/98 98/98
amsmath corpus 59/59 59/59
HW1/HW2 rendering-v2 display lists 3 pages each byte-identical, 0 errors, 0 overfull, 0 font diagnostics
Real-world corpus (--no-oracle --no-pixels) 9 fixtures same status and page count; one diagnostic fewer (packages booktabs are recognised but not implemented, which #173's compiler resolves)
cargo test --release, crates/render-pipeline — 171 passed, 0 failed
cargo test --release, #173 compiler at e84b9885 — 399 passed, 0 failed

oracle.py now accepts a fixture with more than one page, which a longtable
needs; nothing else about the comparison changed.

New fixtures (19)

60-79 as before (cmidrule kerns, \morecmidrules, \specialrule,
\addlinespace, seven \multirow cases, colortbl fills and rule colours).
80-98 are the longtable set: plain, the four terminators, two- and three-page
breaks with a repeating head and foot, [l]/[r], \setlength\LTleft,
\LTpre/\LTpost, \kill, \\*, booktabs rules, a wrapping p{} column with
vertical rules, a short caption, a caption wrapping in the 4in parbox,
\caption*, a first-head and an \endhead caption over a page break, two
longtables each stepping the table counter, a narrowed \LTcapwidth, and
\newpage between rows.

Known limitations (reported, not silent)

  • A longtable on a page with footnotes, or in a document with floats, goes
    through page-building paths that do not carry the region yet: the table is
    still set correctly (verified against pdflatex on a one-page table with a
    footnote), but a break inside it would not repeat \endhead/\endfoot. Both
    raise a table_limitation diagnostic.
  • \definecolor in the preamble is reported by the compiler (compiler: color/xcolor with pdfTeX-exact colour operators (982/982 oracle) #150's lane); the
    pipeline still resolves it from the source.

Next

  1. Carry the region through break_pages_inserts (footnotes) and
    floatpage::paginate, then drop the two diagnostics above.
  2. \LTchunksize: chunks are currently unbounded, so a table over 200 rows
    measures in one pass where longtable would re-measure per chunk and can
    report changed widths.
  3. Re-pin vendor/compiler to compiler: longtable, multirow, booktabs extras and colortbl colours in tables #173 once it merges, and drop the local swap.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu

GoKubar and others added 8 commits September 13, 2026 11:05
Paused for usage. Converts the compiler's new table fields (PR #173) into
the pipeline's TableItem: row colour/nobreak/kill, cell colour/multirow,
column colour, cmidrule kerns, addlinespace, specialrule, morecmidrules,
rule colours, longtable sections/captions/page breaks, and the `||`
doublerulesep gap as its own material. layout(), typeset's table_box and
the tests are not updated yet, so the crate does not compile against the
re-pinned compiler; it needs vendor/compiler re-pinned to 484cb11 (#173).

Implementation-Agent: Claude Opus 5 (subagent kabir-claude table packages, mac-m5pro-kabir)
Commit-Executor: Claude Code direct Git
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu
…ement and colortbl fills (tabular oracle 59/59 + 18/20 new)

Implements table.rs layout for the compiler fields of #173: kill rows,
booktabs' \@BTrule/\@BTendrule/\@xcmidrule rule classes (specialrule and
addlinespace as class 2, \cmidrulesep after \morecmidrules), explicit
cmidrule kerns, \arrayrulecolor on every rule kind, \doublerulesepcolor
gaps, and colortbl fills per \CT@@Do@color (cell over row over column,
overhangs from \col@sep then column then row). typeset: multirow boxes per
multirow.sty 168-201, fills painted under the entries, colours resolved by
a minimal xcolor stand-in (tablecolor.rs) until #150 lands. The tabular
oracle compares rule and fill colours; fixtures 60-79 with MacTeX 2026
references. Needs vendor/compiler re-pinned to #173. longtable follows.

Implementation-Agent: Claude Opus 5 (subagent kabir-claude table packages, mac-m5pro-kabir)
Commit-Executor: Claude Code direct Git
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu
…to the preamble (tabular oracle 78/79)

colortbl's \@arrayrule and \@classvi add {\CT@arc@\vline} and
{\CT@drsc@\vrule\@width\doublerulesep} with \@addtopreamble's \edef, so a
mid-table \arrayrulecolor only recolours \hline/\cline (fixture 75).

Implementation-Agent: Claude Opus 5 (subagent kabir-claude table packages, mac-m5pro-kabir)
Commit-Executor: Claude Code direct Git
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu
…ensions

Adapts the pipeline to the compiler's e84b988: `Entry::CMidRule`'s
`kern_left`/`kern_right` and `Entry::AddLineSpace`'s `space` are
`FontDimen { pt, em, ex }` rather than points, so booktabs'
`\cmidrule(l{.5em}r{2ex})` and `\addlinespace[1ex]` are evaluated in the
font in force at the rule (`FontDimen::resolve(m.em, m.ex)`) exactly as
`\@setrulekerning` does, instead of at a fixed 10pt body size.

Tabular oracle: 79/79 (was 78/79; fixture 60-cmidrule-kerns was the one
failure and is the em trim this fixes).

Implementation-Agent: claude-opus-5 (table-packages lane, nixos linux-primary)
Commit-Executor: claude-opus-5

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu
…gion

A longtable is no longer a box inside a paragraph. `Block::LongTable`
contributes every row, rule row and head or foot box straight to the
page's vertical list, as `\LT@array` does (longtable.sty 167-191), so the
page builder can break between rows.

- `longtable.rs`: `\LT@end@hd@ft` splits the entries into first head,
  head, foot, last foot and body; `\LT@get@widths` measures every chunk
  (`\kill` rows included) once and each chunk is then set against that
  one column geometry; `\tabskip\LTleft`/`\LTright` place the table
  (`\fill` on both sides by default, so centred; `[l]`/`[c]`/`[r]` and
  `\setlength` override it).
- `table.rs` splits `layout` into `widths` + `layout_with(.., Options)`
  so chunks share a measurement, and grows longtable's `\hline`:
  `\LT@hline` is two `\multispan` leader rows `\LT@sep` apart, not one
  `\hrule` — coincident for `\hline`, `\doublerulesep` apart for
  `\hline\hline` (whose second `\hline` `\@gtempa` gobbles).
- `pagebuild.rs`: `VBlock` gains `lineskip` (longtable sets it to 0 with
  `\baselineskip`, so rows abut and every gap between them is a legal
  breakpoint), `contributed` (lines built but held back) and
  `line_penalty`. A `Region` reduces `\pagegoal` by `\ht\LT@foot` and
  zeroes `\maxdepth` inside the table, ends a page broken there with
  `\LT@foot` and opens the next with `\LT@head` (`\LT@output`).
- `\LTpre`/`\LTpost` are `\bigskipamount` unless `\setlength` changed
  them; `\caption` inside a longtable is reported, not yet set.

Gates on this machine (TeX Live 2025 for new oracle runs; the committed
refs are MacTeX and are reproduced here byte for byte):
- Tabular oracle 79/79, unchanged from the previous commit.
- HW1/HW2 rendering-v2 display lists byte-identical to the main build
  (bffd168), 0 errors, 0 overfull.
- `cargo test --release` on crates/render-pipeline: all green (70 lib
  tests including 5 new longtable ones).

Implementation-Agent: claude-opus-5 (table-packages lane, nixos linux-primary)
Commit-Executor: claude-opus-5

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu
Two facts measured against pdflatex, not derived from the package source:

- `\prevdepth` after a longtable. `\LT@array` builds each chunk in a
  `\vbox` and `\endlongtable`/`\LT@ntabularcr` `\unvbox` it into the
  page's vertical list (longtable.sty 252, 322, 334); `\unvbox` never
  sets `\prevdepth`, so only the boxes the package appends itself —
  `\box\LT@firsthead` (239) and `\box\LT@lastfoot` (506) — do. A table
  with no head and no foot leaves `\prevdepth` as the material before it
  had it. `VBlock::depth_after` says which. Without this the paragraph
  after a headless longtable sat 4.35pt (the `\@arstrutbox` depth) too
  high.
- `\LT@start`'s `\maxdepth\z@` (230) does not reach the page. TeX froze
  `page_max_depth` when the page's first box landed (§987) — before
  `\LT@start` runs for a table that starts mid-page — and `\@makecol`
  ends every page with `\global\maxdepth\@maxdepth`, so continuation
  pages freeze the class value again. Instrumenting `\LT@output` on a
  three-page longtable shows `maxdepth=0pt` only on the first call and
  `6.0pt` after; honouring the zero lost one row per continuation page.
  The page goal is still reduced by `\ht\LT@foot`, which is what decides
  the break.

Corpus: 12 longtable fixtures (80-91) — plain, the four terminators,
two- and three-page breaks with a repeating head and foot, `[l]`/`[r]`,
`\setlength\LTleft`, `\LTpre`/`\LTpost`, `\kill`, `\\*`, booktabs rules
and a wrapping `p{}` column with vertical rules. Their references were
generated on this machine with **TeX Live 2025** (recorded in each
`reference_engine` field), not MacTeX; every committed MacTeX reference
(fixtures 1-79) was checked to be reproduced byte for byte by the local
pdflatex first, and none was rewritten. `oracle.py` now accepts a
fixture with more than one page, which a longtable needs.

Gates on this machine:
- Tabular oracle 91/91 (was 79/79 over 79 fixtures; the 12 new ones all
  pass and none of the old ones changed).
- amsmath corpus 59/59, identical to the main build (bffd168).
- HW1/HW2 rendering-v2 display lists byte-identical to the main build,
  0 errors, 0 overfull.
- `tools/real-world-corpus/run.py --no-oracle --no-pixels`: same status
  and page count on all 9 fixtures; one diagnostic fewer
  (`packages booktabs are recognised but not implemented`, which the
  #173 compiler now implements).
- `cargo test --release` on crates/render-pipeline: 30 test binaries,
  all green.

Implementation-Agent: claude-opus-5 (table-packages lane, nixos linux-primary)
Commit-Executor: claude-opus-5

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu
`\LT@makecaption` (longtable.sty 475-485) is `\LT@mcol\LT@cols c{\hbox
to\z@{\hss \parbox[t]\LTcapwidth{...}\hss}}`: a row of the alignment like
any other, so it takes the `\@arstrut`, holding a zero-width box centred
on the table, so however wide the caption is it never widens a column.
Inside the parbox the whole caption goes on one centred line when it fits
(`\hbox to\hsize{\hfil\box\@tempboxa\hfil}`) and is set as a paragraph
otherwise, closed by `\endgraf\vskip\baselineskip`. `\parbox[t]` is a
`\vtop`, so `CaptionBox::height` is the first line's height and `depth`
is everything below it, the closing `\baselineskip` included.

`\caption` prefixes `\fnum@table` = `\tablename~\thetable` and a colon;
the tie is a non-breaking space and the space after the colon carries
TeX's space factor (`\sfcode`\:` = 2000), so it takes the face's
`\fontdimen7`. Without that the centred line was 1.3pt narrow and every
word of it sat 0.65bp off. `\caption*` drops the prefix. `\LTcapwidth`
is read from `\setlength`.

The caption of `\endhead` repeats at the top of every continuation page
with the rest of the head; `chunk_geometry` now renumbers a caption's
entry index back to the whole table's, without which the head's caption
was built but never painted.

Corpus: 6 more fixtures (92-97) — a short caption, one wrapping in the
4in parbox, `\caption*`, a first-head and an `\endhead` caption over a
page break, two longtables each stepping the `table` counter, and a
narrowed `\LTcapwidth`. References generated here with TeX Live 2025
(recorded in `reference_engine`); no committed MacTeX reference touched.

Gates on this machine:
- Tabular oracle 97/97 (18/18 longtable, fixtures 1-79 unchanged).
- amsmath corpus 59/59, identical to the main build (bffd168).
- HW1/HW2 rendering-v2 display lists byte-identical to the main build,
  0 errors, 0 overfull.
- Real-world corpus (`--no-oracle --no-pixels`): same status and page
  count on all 9 fixtures; one diagnostic fewer, the booktabs package
  note the #173 compiler resolves.
- `cargo test --release` on crates/render-pipeline: 30 binaries green.

Implementation-Agent: claude-opus-5 (table-packages lane, nixos linux-primary)
Commit-Executor: claude-opus-5

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu
longtable.sty 135-137 redefines `\newpage` as `\noalign{\break}`, an
eject penalty between rows; the compiler reports it as
`Entry::PageBreak`, which the pipeline now turns into a zero-extent glue
unit carrying `\penalty-\@M` before the next row. The region's foot and
head go in at that break like any other, so the page ends with
`\LT@foot` and the next opens with `\LT@head`.

Fixture 98 (TeX Live 2025 reference, generated here): a two-page
longtable forced by `\newpage` after the third row. Tabular oracle
98/98; HW1/HW2 byte-identical to the main build; `cargo test --release`
on crates/render-pipeline 171 passed, 0 failed.

Also verified on this machine, for the record: PR #173's compiler
(`e84b9885`) builds and its whole suite passes here — 399 tests, 0
failed — with the repository's protocol/, tests/tex-corpus, docs/ and
apps/mac/Fonts alongside it.

Implementation-Agent: claude-opus-5 (table-packages lane, nixos linux-primary)
Commit-Executor: claude-opus-5

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu
@GoKubar GoKubar changed the title WIP: longtable/multirow/cmidrule/colortbl (paused) render-pipeline: longtable, multirow, cmidrule trims and colortbl fills Sep 13, 2026
GoKubar added a commit that referenced this pull request Sep 14, 2026
… main

Rebase repair for the table-packages branch (PR #176), whose base predates
190 commits of `main`. Three places where `main` moved underneath it:

- `pagebuild::VBlock` gained `lineskip`/`contributed`/`line_penalty`/
  `depth_after` on this branch, but `main` grew two new initialisers of its
  own in the meantime (`\colorbox`'s inner block and the empty positioned
  block). Both are ordinary boxes appended in vertical mode, so they take the
  neutral values `plain_vblock` uses: no forced `\lineskip`, every line
  contributed, no explicit `\penalty` nodes and `DepthAfter::LastLine`.
- `display::Paint` gained `device` (the `display-list-v2-device-color`
  proposal: the operands pdfTeX actually writes). The colortbl rule paint has
  no device colour to give it, because `crate::tablecolor` has already
  flattened the colour to sRGB, so it is `None` with a comment naming the
  real fix -- resolving colortbl colours through the compiler's
  `crate::color` instead of the pipeline's stand-in.
- `typeset::multicol::block_start` is new on `main` and did not know about
  `Block::LongTable`; a longtable is contributed straight to the vertical
  list, so its origin is the environment's own span.

Tabular oracle corpus (`crates/compiler/tests/tabular_corpus/oracle.py`,
pinned pdflatex refs, never regenerated) on this tree: 98/98, 0 font
diagnostics.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu
GoKubar added a commit that referenced this pull request Sep 14, 2026
…t found

`\LTchunksize` (longtable.sty 65, default 200) is deliberately not
modelled, with the reason and the measurements in `longtable.rs`. Chunking
only ever narrows a chunk to the widest cell *seen so far*; longtable
writes the final widths to the `.aux` (253-259) and warns `Column widths
have changed`, so the next run sets every chunk at the maximum — which is
what measuring the whole table once already produces. Verified on two
shapes: 260 rows with the widest cell past the default 200-row boundary,
and 30 rows with `\LTchunksize=5` and the widest cell in the sixth chunk.
Both warn on pass 1, are silent on pass 2, and their two-pass references
match this module's single measurement exactly. Modelling chunking would
only reproduce the unconverged first pass.

Building those two fixtures turned up three real mismatches, all measured
against pdflatex:

- **`\maxdepth\z@` does reach the page a table opens.** `\LT@start` sets
  it (longtable.sty 230) on the outer vertical list after `\LT@echunk` has
  closed the first chunk but before `\unvbox\z@` contributes any row, so
  §987 `freeze_page_specs` copies the zero into `page_max_depth` exactly
  when the table's first row is also the page's first box. A table under
  existing material finds it already frozen at `\@maxdepth`, and every
  later page of the table gets `\@maxdepth` back from `\@makecol`, so only
  the page a table *opens* is affected — which is why the earlier
  fixtures, all of which have a paragraph above the table, never saw it.
  104-longtable-chunk-boundary begins with the table and loses one row on
  its first page.

- **`\copy\LT@head`, not `\box`.** Without `\endfirsthead` the opening
  head *is* `\LT@head` (239), and without `\endlastfoot` the closing foot
  *is* `\LT@foot` (506), so the same cells are set twice. The piece
  builder removed each cell's block from the map, so the second use — the
  box the output routine repeats — kept its rules and lost its text. The
  repeated head and foot of every table written with only `\endhead` and
  `\endfoot`, a very common shape, were blank.

- **The closing foot does not set `\prevdepth`.** `\box\ifvoid\LT@lastfoot
  \LT@foot\else\LT@lastfoot\fi` is inside `\LT@output` (506), and the
  output routine builds its own vertical list (§1025 `push_nest`) whose
  `prev_depth` §1026 discards when it hands the material back to the
  contribution list. Only `\LT@start`'s opening head runs on the outer
  list, so that is what the table leaves behind; with no head at all the
  value is unchanged, as this lane's predecessor measured. A probe with
  the same table after a paragraph with and without a descender puts the
  following paragraph at the same distance both times, so the value is
  fixed rather than inherited, and 4.34 pt below where `\dp\LT@foot` would
  put it. The earlier fixtures all end in `\hline\hline`, whose depth is
  zero, so `Fixed(closing)` and `Fixed(opening)` agreed on every one.

Gates: tabular oracle 106/106 (all 98 pre-existing unchanged), zero
font/metric fallback diagnostics and zero `table_limitation` on every
fixture; amsmath 59/59; `cargo test --release` (no `FLASHTEX_*` in the
environment) 171 passed, 0 failed; HW1/HW2 byte-identical to the #176
baseline, 3 pages and 692/698 items each, 0 errors, 0 overfull, 0 font
diagnostics; real-world corpus identical to the baseline on all nine
fixtures.

New fixtures (references from local TeX Live 2025):
- 104-longtable-chunk-boundary: 210 rows, widest cell past the default
  chunk boundary, table opening page 1.
- 105-longtable-ltchunksize: `\LTchunksize=5`, widest cell in chunk six.
- 106-longtable-head-foot-only: `\endhead`/`\endfoot` and nothing else.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu
GoKubar added a commit that referenced this pull request Sep 14, 2026
…line

render-pipeline: longtable, multirow, cmidrule trims and colortbl fills (rebase of #176 onto current main; + the gate that was not measuring them)
@GoKubar

GoKubar commented Sep 15, 2026

Copy link
Copy Markdown
Contributor Author

Closing as superseded — the work is already on main.

Replacement: c02fcb9 (PR #251)

Closed by the integration lane while clearing a 219-PR backlog (112 of them drafts). If this is wrong, reopen it and tell me — I would rather be corrected than leave stale work buried.

— orchestrator-astra (Commander)

@GoKubar GoKubar closed this Sep 15, 2026
@GoKubar
GoKubar deleted the agent/kabir-claude/table-packages branch September 16, 2026 04:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant