Skip to content

WIP: tex-align alignment engine (KC-111, paused) - #95

Closed
GoKubar wants to merge 6 commits into
mainfrom
agent/kabir-claude/tex-align
Closed

GoKubar wants to merge 6 commits into
mainfrom
agent/kabir-claude/tex-align

Conversation

@GoKubar

@GoKubar GoKubar commented Sep 13, 2026

Copy link
Copy Markdown
Contributor

Status: paused for plan usage. There is no implementation yet, only the crate skeleton and crates/tex-align/CONTRACT.md (design and resume steps). Oracle: 0 fixtures so far; nothing has been checked.

The branch includes a merge of agent/kabir-claude/tex-boxes-r2 (PR #93), because tex-align depends on it by path.

Overlap check (origin/main e1dddc4)

  • crates/compiler/src/tabular.rs and parser/tabular.rs came from Daniel's merged agent/daniel-parent/tabular. They lay out tabular/tabular* at the command level, in f64 points:
    • the kernel \@mkpream column templates l c r p{} | @{}
    • \tabcolsep, \arrayrulewidth, \doublerulesep
    • §801 span excess goes into the last spanned column
    • \@arstrut with \arraystretch
    • \\[dim], \hline, \cline
    • booktabs rules
    • [t]/[b]/[c]
    • tabular* with \extracolsep{\fill}
  • Main has no \halign/\valign engine. That means none of the following:
    • u/v templates
    • \omit, \span, \noalign
    • \tabskip changes
    • periodic preambles
    • sp-exact glue setting
  • Main also lacks the array.sty column types >{} <{} m b !{} and \extrarowheight.
  • render-pipeline/src/mathgrid.rs only places amsmath grid cells.
  • FT-030 (daniel-tables) owns crates/paragraph-layout, not tables.
  • KC-111 therefore goes in a new crate and leaves theirs untouched. How the two get reconciled is covered in CONTRACT.md.

Done

  • Overlap check.
  • Read tex.web part 37 (§§768–812), latex.ltx 16550–16758, array.sty v2.6n and booktabs.sty.
  • Design, written up in CONTRACT.md. BoxEngine's nest and save stack are private, so the design drives it from outside.

Resume steps

  1. git checkout agent/kabir-claude/tex-align. Merge a newer tex-boxes-r2 if one exists.
  2. Write src/align.rs: the §801–810 width merge and row/cell setting, with unit tests.
  3. Write src/interp.rs: an input stack with align_state, template insertion, get_x_token and the scanners.
  4. Add raw \halign/\valign fixtures and tests/oracle/generate.py (pdflatex, \showbox plus \pdfsavepos).
  5. Add the kernel tabular layer, then array.sty, then booktabs; aim for at least 70 fixtures.
  6. Finish CONTRACT.md with what is verified versus believed, and the adoption plan.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu

GoKubar and others added 6 commits September 13, 2026 02:23
New crate crates/tex-boxes: scaled arithmetic and units (tex.web 99-109,
453-458), node model, badness/hpack/vpackage with exact over/underfull
report text (108, 644-678), show_box/short_display (173-198), shipout
positions with cur_g/cur_glue rounding and leaders (619-637), a primitive
box engine (nest, save stack, box contexts, vtop, lastbox, unpackage,
vcenter, single-line paragraph hook), and the latex.ltx box layer
(makebox/framebox/fbox/raisebox/parbox/minipage/rule/hspace/vspace/
phantom/smash/laps/savebox/settodim/lrbox). Oracle generator, 151
fixtures and generated expected.txt; DSL-driven oracle test not yet run.

Implementation-Agent: Claude Opus 5 (subagent kabir-claude KC-107, 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
- generate.py: expand nested <<N*...>> repeats innermost-first, keep a
  space after \wd0 so DIM fields don't fuse, drop the \voidb@x error,
  emit no DIAG lines for an empty transcript. pdflatex log now has no
  TeX errors; axisheight regenerated (163840sp).
- DSL: nested repeats, simple {..} groups inside box bodies.
- engine: LaTeX 2021-06+ standard \everypar (indent box saved, empty
  \par, \noindent restart with \parskip 0 / -\parskip under minipage)
  which produces pdfTeX's doubled \parskip glue; term_offset for
  write_out's print_nl.
- scaled: .3\baselineskip = 235932sp (round_decimals 19661).

Implementation-Agent: Claude Opus 5 (subagent kabir-claude KC-107 r2, mac-m5pro-kabir)
Commit-Executor: Claude Code direct Git
Co-Authored-By: Claude Opus 5 <[email protected]>
… r2)

write_out's print_nl breaks the line when the terminal is mid-line. In the
oracle run that holds exactly when the previous fixture shipped a page
(position pass); \showbox's error() ends with print_ln. Oracle now passes
all 151 fixtures (dims, badness, showbox, diagnostics) and 92/92 positions.

Glue ratio: storing glue_set as f32 breaks g_long_stretch, g_long_odd and
g_long_vertical positions; f64 matches, so pdfTeX 1.40.29 uses double.

Implementation-Agent: Claude Opus 5 (subagent kabir-claude KC-107 r2, mac-m5pro-kabir)
Commit-Executor: Claude Code direct Git
Co-Authored-By: Claude Opus 5 <[email protected]>
… r2)

Documents oracle coverage (151 fixtures exact; 92 positions), the glue
ratio (double) and LaTeX para-hook findings, adoption for render-pipeline /
compiler, and plug-in points for KC-101 tex-expansion (main-control
mapping, register ownership), KC-102 microtype (LineBreaker, margin kerns;
expansion hook is a stub) and KC-106 page-builder (PageBuilder, module
de-duplication).

Implementation-Agent: Claude Opus 5 (subagent kabir-claude KC-107 r2, mac-m5pro-kabir)
Commit-Executor: Claude Code direct Git
Co-Authored-By: Claude Opus 5 <[email protected]>
Paused for plan usage before any implementation. Adds the crate skeleton
(depends on tex-boxes by path) and CONTRACT.md with the overlap finding,
design, and exact resume steps. Nothing is oracle-verified yet.

Implementation-Agent: Claude Opus 5 (subagent kabir-claude KC-111, 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 commented Sep 15, 2026

Copy link
Copy Markdown
Contributor Author

Closing as a stale paused draft, same basis as #94: KC-111 was paused for usage pacing, the crate was never compiled or oracle-checked, nothing on main references crates/tex-align, and there are no comments or dependents since 2026-09-13. The branch agent/kabir-claude/tex-align preserves the work and the crate is self-contained, so this can be reopened rather than rebuilt.

@GoKubar GoKubar closed this Sep 15, 2026
@GoKubar
GoKubar deleted the agent/kabir-claude/tex-align 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