Repository navigation
render-pipeline: a heading after an empty contents list takes its \addvspace; no page break between two heads - #580
Conversation
…dvspace; no break between two heads What changed: - `\@starttoc` ends with `\@nobreakfalse`. The contents lists now end with a `Block::NoBreakFalse`, which clears `after_heading` in the typesetter. A heading right after an empty `\listoffigures`/`\listoftables`/ `\tableofcontents` takes `\@startsection`'s `\addvspace` branch again: the larger of its before-skip and the list head's after-skip. Before, the second head sat 1.2ex too high (5.144bp at 10pt, 5.633bp at 11pt, 6.172bp at 12pt). A paragraph there also gets its normal `\clubpenalty`. - Under `\@nobreak`, a heading drops its `\addpenalty\@secpenalty` as well as its before-skip. Two heads at the foot of a page no longer break apart. - tests/heading_after_heading.rs pins pdflatex numbers from zref-savepos markers placed after the anchor words. What was run: - 256 baseline-to-baseline pairs against pdflatex (article 10/11/12pt, report 10/11pt; section/subsection/subsubsection pairs starred and unstarred; chapter then section; lists then every level): before 235/256 exact, after 256/256 within 0.003bp. Page-foot probe with 44-54 lines of filler: before 7/11 page placements matched, after 11/11. - cargo test --test heading_after_heading: test result: ok. 4 passed; 0 failed (without the src change: 2 passed; 2 failed) Next step: run the heading, TOC and baseline oracle suites and open the PR. Implementation-Agent: claude-opus-5 subagent of daniel-parent Commit-Executor: daniel-parent subagent Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz
… 1.40.29 What changed: - Corrects the pair count (262, not 256) and the pdfTeX version in the test module doc. What was run: - cargo test --no-fail-fast (render-pipeline): 367 passed, 12 failed; the 12 fail identically on origin/main (adapter.rs:1268 debug_assert). Next step: open the PR. Implementation-Agent: claude-opus-5 subagent of daniel-parent Commit-Executor: daniel-parent subagent Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz
|
daniel-parent independent review (subagent) What was runAll from
pdflatex oracle: Findings
Side observation (out of scope, not a regression from this PR)While building fixture 1 I found that OverallSmall, well-targeted diff (184 insertions, 0 deletions, no logic removed). It matches the |
What
\@starttocends with\@nobreakfalse.crate::toc::list_blocksnow ends every\tableofcontents/\listoffigures/\listoftableswith a newBlock::NoBreakFalse, which clears the typesetter'safter_heading. A heading right after an empty list takes\@startsection's\addpenalty/\addvspacebranch again. That gives the larger of its before-skip and the list head's after-skip (\@xaddvskip). A paragraph there gets its normal\clubpenalty.\if@nobreak,\@startsectionskips\addpenalty\@secpenaltyas well as\addvspace. The pipeline already dropped the skip but still placed a -300 penalty, so two heads at the foot of a page could split. It now drops the penalty too, unless an explicit page-break command stands before the head.tests/heading_after_heading.rspins the pdflatex numbers (4 tests).Why
The AUX-lists lane (#543, "Not done") reported that
\section*{A}\section*{B}puts B 5.15bp too high. Measured against pdflatex, plain heading-after-heading is already exact on main: 196/196 pairs. The mismatch appears only when the first head is a contents list's\section*, as in the lane's empty\listoffiguresfollowed by\listoftables.\@starttoc's\@nobreakfalsemeans the second head is not under\@nobreak. Its\addvspace{3.5ex}tops the list head's 2.3ex after-skip up by 1.2ex:\listoffigures\listoftables\listoffigures\listoftables\tableofcontents\section*\listoffigures\subsection\section*{A}\section*{B}(control)\chapter\section(control)In report the list head is a
\chapter*. Its\vskip 40\p@already beats every before-skip, so nothing moves there (verified).Oracle method. pdfTeX 3.141592653-2.6-1.40.29 (TeX Live 2026), T1,
geometrymargin=1in. The\zsaveposmarkers go after each anchor word (the vspace-triage method), and positions are compared baseline to baseline in bp.Coverage. 262 pairs: article 10/11/12pt and report 10/11pt; section/subsection/subsubsection pairs, starred and unstarred, mixed starred/unstarred;
\chapter/\chapter*followed by\section/\section*/\subsection; each list followed by every level. Before: 241/262 within 0.01bp. After: 262/262. The commit message says 256/235 because it miscounted; 262/241 is correct.Page foot. 44-54 one-line paragraphs, then
\section*{Alpha}\section*{Bravo}and body text. pdflatex never separates the heads. Before, 7/11 placements matched (47-50 lines split Alpha on p1 from Bravo on p2). After, 11/11.Overlap check
gh pr list --search heading/--search startsection, open:05-article-consecutive) and render-pipeline: secnumdepth, description, \baselinestretch and run-in headings #292 (secnumdepth/run-in, conflicting). Neither touches\@starttoc/\@nobreakfalseor the typeset heading arm's penalty. compiler: \paragraph and \subparagraph are \@startsection levels 4 and 5 #291 is compiler-only.toc.rslist_blockselsewhere (LoF chapter gaps). The one-lineout.pushat the end oflist_blocksmay need a trivial rebase.GH-HEADING-AFTER-HEADINGheld by daniel-parent (touched).Test results
cargo test --no-fail-fastin crates/render-pipeline (CARGO_BUILD_JOBS=4), after the change:The 12 failures are pre-existing: the same result on origin/main 36fe7ec with this PR's src reverted. They all come from
debug_assert_eq!(leadings.len(), parsed.blocks.len())at src/adapter.rs:1268.Without the src change,
heading_after_heading:test result: FAILED. 2 passed; 2 failed(off by -5.1438;47 lines of filler: pages of Alpha/Bravo/Charlie).Not done
\@nobreakfalsesites are not modelled: a[h]float placed in text right after a heading (\@addtocurcol),\@setnobreakin float boxes, and\itemresets.🤖 Generated with Claude Code
https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz