Skip to content

compiler: implement tabularx with even-split X columns (#837) - #901

Merged
d-q222 merged 2 commits into
mainfrom
muse/tabularx-env
Sep 18, 2026
Merged

d-q222 merged 2 commits into
mainfrom
muse/tabularx-env

Conversation

@d-q222

@d-q222 d-q222 commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

Summary

  • New \begin{tabularx}{width}{cols} environment, gated on \usepackage{tabularx}, with a bare X column letter (no {width} group — a user \newcolumntype{X} still wins over the built-in).
  • New Align::Flexible variant: X's width can't be known at parse time (it depends on the other columns' natural widths), so it's computed at layout time as an even split of the leftover width (target - natural_width) across all X columns, then each X entry is re-laid-out at its share, wrapping like p{share}.
  • Verified against real tabularx.sty (TeX Live 2026): it rewrites every X to p{\TX@col@width}, one shared width for all X columns — so even-split is exact, not approximate, confirmed via \showbox dumps for both a single-X and a two-X table (equal shares even with very different cell contents).
  • Scoped limitations, documented in the code: \multicolumn spanning an X column doesn't absorb into the share computation (real tabularx's trial loop does); an over-narrow target keeps natural widths rather than falling back to 1em; \renewcommand{\tabularxcolumn} isn't honored.

Review notes (mine)

The published lane's commit was missing a PACKAGES inventory row for tabularx even though it added a package_matches_layout arm for it — failed environment_and_package_inventory_equals_the_parser_arms in both debug and release. Added the missing entry, regenerated the derived inventory artifacts, and re-verified full green before publishing.

Test plan

  • 4 new tests in crates/compiler/src/tabular.rs: single-X leftover-width case, two-X even split, X wraps like p (top-aligned), width-required + package-gated diagnostics — all pdflatex-verified (\showbox box-width dumps, TeX Live 2026)
  • Full crates/compiler suite, independently re-run on the exact pushed tree after my fix: cargo test --locked and cargo test --release --locked, both 0 failures

Produced by a supervised Muse Contributor lane (tabularx-env), reviewed (full diff read, independently re-tested, one real gap found and fixed before publishing) by me.

🤖 Generated with Claude Code

Parse \begin{tabularx}{width}{cols} (package-gated, like longtable),
accept a bare X letter in array column specs, and lay X columns out at
an even share of the leftover width, each wrapping like p{share}.
Verified against pdflatex/TeX Live 2026 showbox: equal shares (164.8pt
single-X, 87.4pt each for two X) even with very different contents.

Implementation-Agent: muse-spark-1.3-contributor
Commit-Executor: muse-spark-1.3-contributor
The lane's package_matches_layout arm for tabularx had no corresponding
PACKAGES row, failing environment_and_package_inventory_equals_the_parser_arms
in both debug and release. Also regenerates the derived inventory artifacts.

Implementation-Agent: daniel-muse-lead-2
Commit-Executor: daniel-muse-lead-2
@d-q222
d-q222 merged commit e9ab103 into main Sep 18, 2026
22 checks passed
jay3332 added a commit that referenced this pull request Sep 18, 2026
…tries take the paragraph branch

Thirteen more compiler files landed on main since the last pin (etoolbox
toggles, #901/#902/#913/#915/#917/#929). The mirror follows main again;
the one new variant, tabular::Align::Flexible (tabularx's X column, a
paragraph entry whose share is fixed at layout time), is set flush left
like p entries when its content is placed.

Implementation-Agent: Claude Code (mac-claude-a)
Commit-Executor: git via Claude Code
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01Y1nAv4pEnmMYXgteBoadHn
jay3332 added a commit that referenced this pull request Sep 18, 2026
…tries take the paragraph branch

Thirteen more compiler files landed on main since the last pin (etoolbox
toggles, #901/#902/#913/#915/#917/#929). The mirror follows main again;
the one new variant, tabular::Align::Flexible (tabularx's X column, a
paragraph entry whose share is fixed at layout time), is set flush left
like p entries when its content is placed.

Implementation-Agent: Claude Code (mac-claude-a)
Commit-Executor: git via Claude Code
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01Y1nAv4pEnmMYXgteBoadHn
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