Skip to content

compiler: longtable, multirow, booktabs extras and colortbl colours in tables (rebase of #173 onto current main) - #250

Merged
GoKubar merged 2 commits into
mainfrom
rebase/173-table-packages-compiler
Sep 14, 2026
Merged

GoKubar merged 2 commits into
mainfrom
rebase/173-table-packages-compiler

Conversation

@GoKubar

@GoKubar GoKubar commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

Rebase of #173 (agent/kabir-claude/table-packages-compiler, dead at the head) onto current main. Original base bffd168a; main has moved 243 commits underneath it. Supersedes #173 — its branch is untouched.

longtable, multirow, booktabs extras and colortbl colours parsed into crate::tabular; see the commit messages for the construct list and the TeX Live 2026 sources.

What the rebase actually had to rebuild

git cherry-pick conflicted in parser.rs (5 hunks), supported-latex.json and docs/user/compiler.md. Three were genuine refactor collisions, not textual ones:

  • Counters. The branch carried its own equation_counter/figure_counter/table_counter fields; main replaced all three with crate::xref::Counters. The table counter every longtable steps is now self.counters.step("table"), so \thetable picks up report/book's \thechapter. prefix and any \numberwithin/\setcounter — which the branch's plain u32 could not. Longtable::number and Entry::Caption::number stay u32 (the value, not the label), because the pipeline prefixes "Table n: " from it. Known gap: for a class whose \thetable is not plain arabic that prefix is still wrong. The corpus is article-class, so no fixture exercises it.
  • color_argument collision. main grew parser/colors.rs with a color_argument that resolves \color/\textcolor against crate::color::Colors. The table one, which keeps the colour as written, is now table_color_argument. Two different operations, not a duplicate.
  • Additive merges. The \LT* \setlength arms join fboxsep/fboxrule rather than replacing them; xcolor[table] → colortbl joins load_color_package; the recognised-package-option list keeps siunitx/multicol and the four table packages.

The two generated artefacts were regenerated from this tree with crates/compiler/scripts/render_supported_latex.sh (they have a drift gate, tests/supported_latex.rs). No oracle data was regenerated.

Gates, measured on this tree (not #173's stale numbers)

gate control (main @ 5e6c65be) this branch
crates/compiler cargo test --release --no-fail-fast 485 passed, 0 failed 489 passed, 0 failed

The +4 are this branch's own parser tests. Fonts: FLASHTEX_FONT_DIRS/FLASHTEX_TFM_DIRS at apps/mac/Fonts.

Dependents

The pipeline half is #176 → rebased as rebase/176-table-packages-pipeline, and #184 on top of that. Both need crates/render-pipeline/vendor/compiler re-pinned to this branch; the re-pin is deliberately not in any of these PRs (vendor is the integration lane's). Both were measured against a local re-pin to this tree — see their PR bodies.


Rebased and re-measured against main 5e6c65be. main moved 53 commits during this work, including changes to parser.rs, typeset.rs and mathtex.rs; every number in this PR is from the final tree, not the earlier base.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu

GoKubar and others added 2 commits September 13, 2026 22:12
…n tables

Parses the table packages beyond tabular/array into the structured table
(crate::tabular), citing the TeX Live 2026 sources:

- longtable.sty v4.24: the environment (only with the package loaded) as a
  paragraph holding one Tabular with `longtable: Some(..)`; `[l|c|r]`;
  `\endfirsthead`/`\endhead`/`\endfoot`/`\endlastfoot` as Entry::Section
  markers; `\caption[short]{..}`/`\caption*` as Entry::Caption numbered by
  the table counter every longtable steps (text up to the row's `\\`,
  e.g. a `\label`, joins the caption); `\kill` rows (Row::kill); `\\*`
  (Row::nobreak); `\newpage`/`\pagebreak` as Entry::PageBreak;
  `\setlength` of `\LTleft`/`\LTright`/`\LTpre`/`\LTpost`/`\LTcapwidth`
  accepted (read from the source by the pipeline).
- multirow.sty v2.9: `\multirow[vpos]{nrows}[bigstruts]{width|*|=}[vmove]{text}`
  anywhere at the top level of an entry, including inside `\multicolumn`
  (Cell::multirow; the text stays the entry's content).
- booktabs.sty v1.61803398: `\cmidrule(l{<dimen>}r)` explicit trims
  (kern_left_pt/kern_right_pt), `\addlinespace[..]`, `\specialrule{w}{a}{b}`,
  `\morecmidrules`.
- colortbl.sty v1.0k (or xcolor's `table` option): `\rowcolor[m]{c}[l][r]`
  (Row::color; the right overhang copies the left), `\cellcolor[m]{c}`
  (Cell::color), `>{\columncolor[m]{c}[l][r]}` (ColumnTemplate::color),
  `\arrayrulecolor`/`\doublerulesepcolor` before a table (Tabular fields)
  and between rows (Entry::RuleColor/DoubleRuleSepColor). Colours are kept
  as written (ColorSpec model/spec): resolving them is the colour model's
  job (PR #150).

Optional brackets glued to following text (`\rowcolor{x}[1pt][3pt]a`) are
split like `\\[2pt]Next`. The compiler's own layout honours kill rows,
cmidrule kerns, addlinespace, specialrule and captions; colour and page
breaking are the render pipeline's. Supported inventory regenerated
(booktabs, longtable, multirow, colortbl packages; \arrayrulecolor,
\doublerulesepcolor). apps/mac's bundled supported-latex.json needs the
usual sync. cargo test --release: all green (lib 256).

Rebased from the original base (bffd168) onto eea975c, 190 commits later.
Three things the branch did have to be rebuilt on what replaced them:

- The branch carried its own `equation_counter`/`figure_counter`/
  `table_counter` fields. `main` has since replaced all three with
  `crate::xref::Counters`, so the `table` counter every longtable steps is
  now `self.counters.step("table")` -- which also means `\thetable` picks up
  report/book's `\thechapter.` prefix and any `\numberwithin`/`\setcounter`
  in force, where the branch's plain `u32` could not. `Longtable::number`
  and `Entry::Caption::number` stay `u32` (the value, not the formatted
  label) because the pipeline prefixes "Table n: " from it; for a class
  whose `\thetable` is not plain arabic that prefix is still wrong, which
  is a gap this PR does not close.
- `main` grew `parser/colors.rs` with its own `color_argument` resolving
  `\color`/`\textcolor` against `crate::color::Colors`. The table one, which
  keeps the colour as written, is `table_color_argument` now; the two are
  genuinely different operations, not a duplicate.
- `\setlength` of the `\LT*` lengths joins the existing match arms rather
  than replacing `fboxsep`/`fboxrule`, and the `xcolor[table]` -> colortbl
  load joins `load_color_package` rather than replacing it. The recognised
  package-option list keeps both siunitx/multicol and the four table
  packages.

Measured on the rebased tree (not the numbers above, which predate it):
`cargo test --release` in crates/compiler, 40 test binaries, 0 failed;
lib 282 passed (main's baseline is 278, so the 4 new parser tests are the
whole delta). Supported inventory regenerated from this tree.

Rebase-Agent: Claude Opus 5 (engine lane, linux-primary)

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
booktabs evaluates \cmidrule(l{.5em}) and \addlinespace[1ex] in the font
where the rule is set, whose quad is not the body size (Latin Modern 12pt:
11.75pt). CMidRule::kern_left/kern_right and AddLineSpace::space are now
FontDimen { pt, em, ex }; resolve(em, ex) gives points. Found by tabular
oracle fixture 60 (0.249bp). cargo test --release: all green.

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
@GoKubar
GoKubar force-pushed the rebase/173-table-packages-compiler branch from 97906d9 to 6b533e8 Compare September 14, 2026 02:15
@GoKubar
GoKubar merged commit 5baa9e6 into main Sep 14, 2026
17 of 20 checks passed
GoKubar added a commit that referenced this pull request Sep 14, 2026
`crates/render-pipeline` builds against `vendor/compiler`, not `../compiler`,
so the longtable/multirow/booktabs/colortbl types #250 added to
`crates/compiler/src/tabular.rs` are invisible to the pipeline until the
mirror is re-exported. This is the re-pin #250, #251 and #253 each say is
"deliberately not in any of these PRs (vendor is the integration lane's)";
both pipeline halves were measured against exactly this re-pin, locally.

It rides with #251 rather than landing as its own PR (as #274's re-pin did)
because it is not standalone-safe in either direction, verified on this tree
against main 5baa9e6:

  - re-pin without #251: `cargo build --release` in crates/render-pipeline
    fails, `error[E0027]: pattern does not mention fields kern_left,
    kern_right` -- #250 grew `Entry::CMidRule` and `table.rs::from_compiler`
    matches `ct::Entry` exhaustively with no wildcard arm;
  - #251 without the re-pin: the same build fails on the types it is written
    against (`ct::Longtable`, `ct::Multirow`, `ct::ColorFill`,
    `ct::Entry::SpecialRule`/`Section`/`PageBreak`/...), which is what
    #251's own `rust render-pipeline` and `rust flashtex-cli` CI jobs show.

Either half alone leaves main red, so they land in one merge.

`git archive 5baa9e6 crates/compiler`, byte-identical to the real crate
apart from `PIN` (verified by re-archiving the previous pin 2495ebf and
diffing against the committed mirror: only `PIN` differed).

Implementation-Agent: integration lane (linux-primary, NixOS)
Commit-Executor: Claude Opus 5 via Claude Code (direct-agent Git under the
  observed-Cursor-limit user override)
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu
GoKubar pushed a commit that referenced this pull request Sep 14, 2026
…ded without it) (#327)

Fixes the red `sync-supported-latex.sh --check` gate on main: #250 regenerated the compiler inventory without running the sync script. Verified byte-identical to current main's crates/compiler/supported/supported-latex.json.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu
@GoKubar
GoKubar deleted the rebase/173-table-packages-compiler branch September 16, 2026 04:17
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