Repository navigation
render-pipeline: \tableofcontents, \listoffigures, \listoftables like LaTeX - #133
Merged
Merged
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
This was referenced Sep 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Base: main 85ec30c. Commit: f99a920. This PR changes only render-pipeline, with no compiler or vendor edits and no re-pin needed.
Before this, the pipeline set
\tableofcontentsas its heading only. It now sets\tableofcontents,\listoffiguresand\listoftablesthe way LaTeX does, matching pdflatex.Overlap check
daniel-contents) ownscrates/toc-layout. That machine is paused, the branch is unmerged, and nothing consumes the crate.toc-layouthere. Its leader model measures character widths and does not reproduce TeX's aligned\leaders, so the entry lines are set in the pipeline's own line breaker instead.What
Records.
src/toc.rskeeps LaTeX's\contentslinerecords in memory:\@sect, report/book\@chapter)\addcontentsline{toc|lof|lot}{level}{[\numberline{..}]text}<chapter>.<n>in report/booktocdepth: article 3, report/book 2\numberlineup to the classsecnumdepth\renewcommand\contentsname,\listfigurenameand\listtablenameGeometry.
src/typeset/toc.rslays out each entry as one pdfTeX paragraph:\@dottedtocline:\leftskip= indent + numwidth,\rightskip\@tocrmarg,\parfillskip -\rightskip, and a hanging wrap for long titles\l@sectionand report/book\l@chapter: bold,\@pnumwidth,\addpenalty,\addvspace/\vskip 1.0em plus 1pt\leadersdot boxes (\mkern4.5mu . \mkern4.5mu) aligned to the line's left edge, as in tex.web §626; page numbers flush rightHeadings. A list's heading is
\section*in article and\chapter*in report/book. Underheadings,\@mkbothsets the marks.Page numbers. Each entry carries a synthetic label.
renderreruns the layout, as it already does for\pageref, until every entry's formatted\thepagesettles. Roman front matter therefore showsi,ii. In practice this takes two passes.\appendix. Article sections become\Alph. In report/book, chapters become\Alphand their heads useAppendix.Diagnostics. The compiler still reports
\listoffigures,\listoftables,\addcontentsline,\appendix, the list-name\renewcommands and\setcounter{tocdepth}as errors. The pipeline sets these commands now, so it drops those diagnostics.Oracle
tools/toc-oracle/generate.pyreuses the page-frame PDF reader. It writes 23 fixtures and pdflatex's word and leader-dot positions from three runs on MacTeX 2026, plus a\pdfsaveposlist-end marker.tests/toc_oracle.rsgates every word before that marker within 0.5bp. Cargo never runs TeX.\addcontentsline\contentsnameTwo fixtures gate positions only for page-number text, because the page an entry lands on is decided by body pagination the pipeline places differently:
4 Resultsmoves from page 3 to page 4.\clearpagein two-column mode ends the column rather than the page.Gates
All measured on mac-m5pro-kabir with release builds.
cargo test --release: every test binary is green, including the newtoc_oracle.--font-dir apps/mac/Fonts): HW1, HW2, article-twocolumn, cv, letter, math-sheet, unicode-accents.Ainstead of3, as in LaTeX, and its\appendixcompiler error is gone. Nothing else changed.Known limits
\captionor\addcontentslineargument are not expanded.\caption[short]{long}: the LOF uses the long argument.\partentries are not set.twocolumnreport/book does not switch to\onecolumnfor the list.🤖 Generated with Claude Code
https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu