Repository navigation
render-pipeline: sectioning headings from class-geometry's \@startsection specs (oracle 38/41 exact) - #151
render-pipeline: sectioning headings from class-geometry's \@startsection specs (oracle 38/41 exact)#151GoKubar wants to merge 5 commits into
Conversation
…like LaTeX
The pipeline set `\tableofcontents` as its heading only. It now keeps
LaTeX's `\contentsline` records in memory and sets every list where its
command stands:
- entries: every numbered heading (`\@sect`, report/book `\@chapter`),
`\addcontentsline{toc|lof|lot}{<level>}{[\numberline{..}]..}` and float
captions (`\thefigure`/`\thetable`, `<chapter>.<n>` with chapters);
`tocdepth` (article 3, report/book 2), `\numberline` up to the class
`secnumdepth`, `\renewcommand\contentsname` (and the LOF/LOT names);
- geometry (typeset/toc.rs): latex.ltx `\@dottedtocline` (leftskip
indent+numwidth, `\rightskip\@tocrmarg`, `\parfillskip -\rightskip`,
hanging wrap), article `\l@section` / report+book `\l@chapter` (bold,
`\@pnumwidth`, `\addpenalty`, `1.0em plus 1pt`), `\leaders` dot boxes
(`\mkern4.5mu . \mkern4.5mu`) aligned to the line's left edge as in
tex.web §626, page numbers flush right; list headings as `\section*`
(article) or `\chapter*` (report/book), `\@mkboth` under `headings`;
- page numbers: each entry carries a synthetic label; `render` reruns the
layout (as for `\pageref`) until the formatted `\thepage` of every entry
settles, so roman front matter shows `i`, `ii`;
- `\appendix`: `\thesection` `\Alph` (article), `\thechapter` `\Alph` and
`\appendixname` chapter heads (report/book).
The compiler's errors for the commands the pipeline now sets
(`\listoffigures`, `\listoftables`, `\addcontentsline`, `\appendix`, the
list-name redefinitions, `\setcounter{tocdepth}`) are superseded. No
compiler or vendor changes.
Oracle: tools/toc-oracle/generate.py writes 23 fixtures
(fixtures/toc) and pdflatex's word and leader-dot positions (three runs,
MacTeX 2026); tests/toc_oracle.rs gates every word before a list-end
marker within 0.5bp. All 23 pass (worst 0.010bp, 3,392 leader dots).
Two entry page numbers follow body pagination the pipeline places
differently (12pt subsection skips; `\clearpage` in two-column mode ends
the column) and are position-gated only.
Implementation-Agent: Claude Opus 5 (subagent kabir-claude toc layout, 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
…tries, two-column lists Follow-ups to the contents-list work (PR #133): - `\part` (article.cls lines 268-301, report.cls 278-328, book.cls 299-349): `BodyKind::Part`/`Block::Part` from class-geometry's `PartSpec` — article in the flow (`\addvspace{4ex}`, `\Large` "Part I", `\huge` title, `\vskip 3ex`, `\@afterheading`), report/book on a page of its own (`\null\vfil` ... `\vfil\newpage`, centred, `\thispagestyle{plain}`, book's empty page after under openright). Its `\addcontentsline{toc} {part}{\thepart\hspace{1em}#1}` entry is set as `\l@part` (article lines 509-527, report 595-611, book 601-617): `\large\bfseries`, number inline, `\addpenalty`, `\addvspace{2.25em plus 1pt}`, `\nobreak`, and report/book's `\global\@nobreaktrue`; `tocdepth > -2`. - `\caption[<short>]{<long>}`: the float scan keeps the optional argument and the list shows it (latex.ltx `\@caption#1[#2]#3`, `\@dblarg`). - Entry titles taken from source bytes (`\addcontentsline`, `\chapter`, `\part`, captions) are parsed once per render like body text (`toc::entry_items`, the caption route's isolate-and-parse), so `\emph`, `\textbf`, math and user macros come out as in a paragraph. - report/book lists in a two-column document are set at `\textwidth` on pages of their own (`\if@twocolumn \@restonecoltrue\onecolumn` ... `\twocolumn`, report.cls lines 583-594/634-658). - Two-column page builder: `\clearpage`/`\cleardoublepage` (and `\chapter`, `\part`, the class `\clearpage`s) end the page, `\newpage` only the column (latex.ltx `\clearpage` lines 20414-20425); `\cleardoublepage`'s empty page is a whole page (`\if@twocolumn\hbox{}\newpage\fi`). Done after column breaking by inserting empty columns (`align_columns`), mapped for floats like the existing openright pages; one-column documents are untouched. Oracle: 10 new pdflatex fixtures (24-33, MacTeX 2026, three runs); all 33 pass within 0.5bp: 5,321/5,321 words, 4,321/4,321 leader dots (929 new), worst 0.357bp (a math `x` in fixture 29). `11-article-twocolumn`'s page numbers are gated again. The generator tolerates font-less blank pages. Not addressed (outside the contents code): an inline `$x^2$` superscript sets ~1.6bp wider and `$\alpha$` is dropped in headings, in the body as in the list (fixture 29 avoids both); two-column `\chapter` heads (`\@topnewpage`) sit ~20.7bp lower than pdflatex; the 12pt article subsection skips (fixture 14) still move one entry's page. Gates: render-pipeline `cargo test --release` green; HW1/HW2 and 5 more real-world fixtures byte-identical to main; input-bibliography and lecture-notes differ from main only by #133's superseded diagnostics. Implementation-Agent: Claude Opus 5 (subagent kabir-claude toc followups, 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
…tion specs (oracle 36/41)
Run-in \paragraph/\subparagraph, \@hangfrom hang indents, the class
secnumdepth default and body \setcounter{secnumdepth}, numbered deep
levels with the bold \quad, and \@nbitem's negative \addvspace after a
heading. Oracle: tools/headings-oracle (41 pdflatex fixtures).
Implementation-Agent: Claude Opus 5 (subagent kabir-claude heading fidelity, 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
Titles holding $...$ are re-read as body text (the compiler sets their math as plain text and drops \alpha); math set at a heading's size uses \DeclareMathSizes and the lmodern designs for that size (TexMathMetrics::for_text_size). Run-in titles keep their math. Implementation-Agent: Claude Opus 5 (subagent kabir-claude heading fidelity, 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
…e 38 heading fixtures report/book \@chapter in two-column mode sets \@makechapterhead in a \textwidth box at the top of the page and lowers \@ColhT by its height plus \dbltextfloatsep (latex.ltx \@topnewpage); pagebuild::break_pages_tops shortens the columns of any page that starts with such a box. Not with floats, contents lists (\onecolumn) or an openright \cleardoublepage after other material (kept as before). Heading oracle: 38/41 fixtures gated exact. Implementation-Agent: Claude Opus 5 (subagent kabir-claude heading fidelity, 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
Two feature overlaps with #154 resolved in favour of the more general side: #151's for_text_size/math_fonts_at supersede #154's at_text_size (removed, with its duplicate field and math_box arity restored to #151's wrapper plus math_box_sized). break_pages_inserts and break_pages_tops remain separate page builders; footnotes win and the combination now warns. layout_blocks gained has_floats and Flow gained chapter_tops, as #135's split requires. Implementation-Agent: Claude Opus 5 (subagent kabir-claude integration, nixos-pc-kabir) Commit-Executor: Claude Code direct Git Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu
Took #152's list refactor (class_seps/apply_sep_keys/is_key_list, env_shape, three-tuple list_stack_at) over main's inline loop, but kept main's outer_parskip default and #135's hsize() for paragraphs inside float and minipage boxes; style.rs keeps #151's five headings and the class labelsep alongside #152's em_pt. Implementation-Agent: Claude Opus 5 (subagent kabir-claude integration, nixos-pc-kabir) Commit-Executor: Claude Code direct Git Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu
#171 predates #151/#152 in every conflicting region; its three residual fixes were grafted onto the newer structure: parse_dimen_in/ec_em_ex threaded through #152's apply_sep_keys and list_labelsep, and the item-label protrusion kern plus label_recs bookkeeping added to #152's multi-word label box. Implementation-Agent: Claude Opus 5 (subagent kabir-claude integration, nixos-pc-kabir) Commit-Executor: Claude Code direct Git Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu
No conflicts: #168 is an oracle and its fixtures, with no pipeline source changes. The compiler side it needs (siunitx) came in with #159 in stage 1, so the vendored compiler already satisfies it. One change was needed. #168 carries a `PENDING` list of fixtures that must *still* differ from pdfLaTeX, each naming the work it waits on, so the entry is removed when that work lands. `39-heading.tex` waited on heading math -- "the pipeline sets a `$...$` formula in \section at the heading size but an Inline::Math whose span starts at a command at the body size". That landed on this branch with #151, so the fixture now matches and the test failed with "39-heading.tex now matches: remove it from PENDING", exactly as designed. Removed; the oracle passes. siunitx is now 36/39 exact against the committed MacTeX references, up from the 35/39 the PR reports. The three still pending are unrelated to siunitx and name their own dependencies: 34-paragraph (math glue stretch in line justification, PR #148), 37-ang-minutes (`\prime` drawn from Latin Modern Math at 2.169pt where pdfLaTeX's cmsy7 prime is 2.306pt), 38-power-on-letter (no upright fam0 Latin math character, so a power on a one-letter unit sits 0.78 bp high). `cargo test --release` in render-pipeline: the same 11 known failures, no more. Zero font diagnostics on every gate. Implementation-Agent: Claude Opus 5 (subagent kabir-claude integration, nixos-pc-kabir) Commit-Executor: Claude Code direct Git Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu
|
Superseded — the content landed piecemeal via other branches, not this one. Verified on Residuals tracked, not lost: Closed by the Commander after a stale-draft screening pass that required evidence in both directions — a landing SHA to close, an empty grep to keep open. If this verdict is wrong, say so on issue #2 and I will reopen: an asymmetric bar has produced wrong calls here in both directions before. |
Sectioning heading layout in
crates/render-pipeline, transcribed from latex.ltx\@startsection/\@sect/\@ssect/\@xsect(lines 17231-17330) and report/book\@chapter, usingcrates/class-geometry's resolved\@startsectionspecs.Stacked on #141 (toc-followups, which includes #133), merged at the coordinator's request because both touch
\part/chapter code. Merges cleanly with current main (git merge-tree). Commits after d7995c8 are this lane's.What changed
Stylesheet::from_resolved). Latin Modern and Computer Modern shareex; Times keeps its own TFMex.\paragraph/\subparagraph: the heading starts the next paragraph (bold title,\quadin the bold font,\hskip 1em,\clubpenalty 10000). With no plain paragraph to start, it forms a paragraph of its own. Before it:\addpenalty\@secpenalty,\addvspace.\@hangfrom: a wrapped numbered title hangs under the title text.\setcounter{secnumdepth}in the body, taking effect from that point. The compiler used to set the{n}argument as a text line. Deep levels are numbered (\thesubsubsection.\arabic{paragraph}).\@nbitemright after a heading: the negative\addvspaceis summed with the heading's after-skip (\@xaddvskip, line 9307), so\parsepno longer remains. Lecture-notes\subsection*{Exercises}followed byenumeratenow matches pdflatex (20.59 bp; before, 25.07 bp).\section..\subparagraphtitle holding$is re-read as body text (the compiler set$x^2$as text and dropped\alpha). Math set at a heading's size uses\DeclareMathSizesand the lmodern designs for that size (TexMathMetrics::for_text_size).\chapter:\@topnewpage[\@makechapterhead]is a\textwidthbox at the top of the page, and the columns of that page are shortened (pagebuild::break_pages_tops). This path is not used with floats, contents lists (\onecolumn) or an openright\cleardoublepageafter other material; those keep the previous layout.Oracle
tools/headings-oracle/generate.py(MacTeX 2026 pdflatex, oracle only) writes 41 fixtures and expected word positions.tests/headings_oracle.rsaligns words and gates 38 fixtures at 100% (every word within 0.5 bp, same pages). They cover every level at 10/11/12pt in article, report and book; run-in headings; headings at page top and bottom; consecutive headings; heading then list or display; long wrapped titles; secnumdepth 1, 5 and set in the body; starred forms; appendix;\part; two-column; math in titles; two-column chapters.06: list glue in the lists lane; pdflatex shrinks page 1 to fit.32: the running head spacesA.as a sentence end.33:\sumlimits inside a heading (math-layout placement).Gates
cargo test --releasein render-pipeline: all green, including page_frame, toc_oracle, floats, tabular and class_geometry_frame.Not done
\partpages (render-pipeline: contents lists — \part, \caption[short], macros in entries, two-column lists (includes #133) #141).\sumlimits in headings.🤖 Generated with Claude Code
https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu