Skip to content

render-pipeline: contents lists — \part, \caption[short], macros in entries, two-column lists (includes #133) - #141

Merged
jay3332 merged 2 commits into
mainfrom
agent/kabir-claude/toc-followups
Sep 13, 2026
Merged

jay3332 merged 2 commits into
mainfrom
agent/kabir-claude/toc-followups

Conversation

@GoKubar

@GoKubar GoKubar commented Sep 13, 2026

Copy link
Copy Markdown
Contributor

Includes and supersedes #133 (unmerged): this branch is origin/main (85ec30c) + #133's f99a920 (fast-forward) + d7995c8. If #133 merges first, this rebases onto main as the single follow-up commit.

Changes (crates/render-pipeline only; no compiler/vendor edits)

  • \part — article in-flow (article.cls 268-301), report/book own page (report.cls 278-328, book.cls 299-349, empty page after under openright) from class-geometry's PartSpec; TOC entry as \l@part (article 509-527, report 595-611, book 601-617): \large\bfseries, inline \thepart\hspace{1em}, \addpenalty, \addvspace{2.25em plus 1pt}, report/book \global\@nobreaktrue, tocdepth > -2. The compiler's \part error is superseded.
  • \caption[short]{long} — float scan keeps the optional argument; LOF/LOT show it (latex.ltx \@caption#1[#2]#3). Small, additive change in floats.rs (Piece::Caption.short).
  • Macros in entries — \addcontentsline/\chapter/\part/caption titles are parsed once per render as body text (toc::entry_items, same isolate-and-parse route as captions): \emph, \textbf, math, user \newcommands.
  • Two-column report/book lists at \textwidth on their own pages (\@restonecoltrue\onecolumn … \twocolumn).
  • Two-column \clearpage ends the page, \newpage the column (latex.ltx 20414-20425); \chapter/\part/class clears too; \cleardoublepage's blank is a whole page. Implemented after column breaking by inserting empty columns (align_columns), float columns remapped like the openright pages; one-column documents untouched.

Evidence

Known, outside the contents code

  • Inline math in headings (body and list alike): $x^2$ sets ~1.6bp wide; $\alpha$ is dropped. Fixture 29 avoids both.
  • Two-column \chapter heads (\@topnewpage) sit ~20.7bp below pdflatex's.
  • 12pt article (fixture 14): subsection skips 0.7bp short move one entry's page (body pagination; page text still ungated there).
  • report/book \part in two-column documents is set full-width but not oracle-tested.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu

GoKubar and others added 2 commits September 13, 2026 07:26
…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
@jay3332
jay3332 merged commit d5db37b into main Sep 13, 2026
11 of 18 checks passed
@jay3332

jay3332 commented Sep 13, 2026

Copy link
Copy Markdown
Member

Merged to main via integration/2026-09-13k (Commander).

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.

2 participants