Repository navigation
render-pipeline: \brokenpenalty after a line the paragraph broke at a discretionary - #400
Merged
Merged
Conversation
… discretionary
TeX appends `\interlinepenalty + \clubpenalty + \widowpenalty + \brokenpenalty`
after each line of a paragraph (§890 `if disc_break then pen:=pen+broken_penalty`);
the page builder had every term but `\brokenpenalty` (latex.ltx sets it to 100),
so a page could break for free right after a hyphenated line.
Oracle evidence (`\showoutput` on `fixtures/real-world/lmodern-report`, TeX Live
2025 pdflatex, oracle only): page 1's vertical list carries `\penalty 100` after
the line ending `Man-`, and pdflatex breaks one line *later*, at badness 2 with
the page shrunk (`\vbox(650.43001+0.0)x469.75502, glue set - 0.26439`), rather
than at the hyphenated break whose badness alone is 1. Without the penalty this
crate took the cheaper-looking earlier break, every line of page 2 landed one
`\baselineskip` (13.55 bp) low, and page 1 stood at its natural height instead
of shrinking (the +1.83…+2.33 bp drift down that page).
With the penalty the page builder now reports natural 652.76429 and glue-set
ratio -0.26440 for that page, against pdflatex's 652.7643 / -0.26439.
Real-world corpus (22 documents, word positions vs the pinned pdflatex
references, `tools/visual-oracle/rank.py`):
dy <= 0.5 bp 65.2% -> 70.4%
both <= 0.5 bp 58.7% -> 63.8%
dx <= 0.5 bp 84.5% -> 84.5% (unchanged)
lmodern-report alone: dy 26.4% -> 81.8%, both 26.4% -> 81.1%. No other fixture
moves in either direction; page counts are unchanged everywhere.
Gates: `cargo test --release --no-fail-fast` on crates/render-pipeline all green;
amsmath 59/59, tabular 106/106, HW1 and HW2 3 pages / 0 errors, zero
font-FAILURE diagnostics across the corpus.
Implementation-Agent: Claude Opus 5 (lane nixos-vertical-drift, linux-primary)
Commit-Executor: Claude Opus 5 (direct git, observed Cursor usage limit)
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu
This was referenced Sep 14, 2026
This was referenced Sep 14, 2026
This was referenced Sep 16, 2026
Closed
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.
render-pipeline: \brokenpenalty after a line the paragraph broke at a discretionary
TeX appends
\interlinepenalty + \clubpenalty + \widowpenalty + \brokenpenaltyafter each line of a paragraph (§890
if disc_break then pen:=pen+broken_penalty);the page builder had every term but
\brokenpenalty(latex.ltx sets it to 100),so a page could break for free right after a hyphenated line.
Oracle evidence (
\showoutputonfixtures/real-world/lmodern-report, TeX Live2025 pdflatex, oracle only): page 1's vertical list carries
\penalty 100afterthe line ending
Man-, and pdflatex breaks one line later, at badness 2 withthe page shrunk (
\vbox(650.43001+0.0)x469.75502, glue set - 0.26439), ratherthan at the hyphenated break whose badness alone is 1. Without the penalty this
crate took the cheaper-looking earlier break, every line of page 2 landed one
\baselineskip(13.55 bp) low, and page 1 stood at its natural height insteadof shrinking (the +1.83…+2.33 bp drift down that page).
With the penalty the page builder now reports natural 652.76429 and glue-set
ratio -0.26440 for that page, against pdflatex's 652.7643 / -0.26439.
Real-world corpus (22 documents, word positions vs the pinned pdflatex
references,
tools/visual-oracle/rank.py):lmodern-report alone: dy 26.4% -> 81.8%, both 26.4% -> 81.1%. No other fixture
moves in either direction; page counts are unchanged everywhere.
Gates:
cargo test --release --no-fail-faston crates/render-pipeline all green;amsmath 59/59, tabular 106/106, HW1 and HW2 3 pages / 0 errors, zero
font-FAILURE diagnostics across the corpus.
Implementation-Agent: Claude Opus 5 (lane nixos-vertical-drift, linux-primary)
Commit-Executor: Claude Opus 5 (direct git, observed Cursor usage limit)
Co-Authored-By: Claude Opus 5 [email protected]
Claude-Session: https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu