Repository navigation
Conversation
The dominant real-world parity error is vertical and mostly a rigid per-page offset (issue #2: |dx| <= 0.5bp 73.1%, |dy| <= 0.5bp 29.5%, 62.3% once each page's median dy is removed). `lmodern-report` was the clean case: page 1 horizontally exact, every word 1.83bp low, growing to 110bp by page 4. `\showoutput` on that document says what pdflatex did. Page 1's body vbox is `\vbox(650.43001+0.0), glue set - 0.26439`: 652.76431pt of material in a 650.43001pt `\@colht`, shrunk by 2.3343pt out of 8.82867pt available. Our vertical list was byte-for-byte the same list -- the natural total matched to 0.001pt -- and we still put the page's last line on page 2 and laid the rest out at natural size. Two independent causes: 1. `\brokenpenalty` was never charged. tex.web 890 adds it to the same penalty node as `\interlinepenalty`/`\clubpenalty`/`\widowpenalty` whenever the line just finished ended at a discretionary; LaTeX sets it to 100. Without it a hyphenated line is an ordinary breakpoint, and on this page it was the cheaper one: our cost at the hyphen was 1 against 2 for the line after it, so we ended the page one line early. pdflatex sees 101 against 2. `VBlock::broken_penalty` now carries it per line, from `Line::hyphenated` (which is exactly 882's `disc_break`), for every block built from a real paragraph. Table cells are left alone: their lines are not breakpoints of the page's vertical list, so charging them would move longtable's row breaks with no oracle behind it. 2. The float column builder never set its columns' glue. `\@makecol` packs every column `\vbox to\@colht`, and both `break_pages_regions` and `make_column` do; `floatpage::paginate`'s no-footnote branch -- the branch every page of a document with a float and no note takes -- advanced by each glue's natural width. A page needing shrink therefore came out low by the whole shrink and overfull. Effect, measured against the committed pdflatex references (22 real-world fixtures, 12261 aligned words, zero font-failure diagnostics): |dy| <= 0.5bp 30.8% -> 34.8% both axes 24.3% -> 28.4% lmodern-report 3.1% -> 46.8%, page 1 now 431/431 words exact on both axes (was 420 aligned, all 1.829bp low) v2 output changed for exactly three fixtures -- `lmodern-report`, `article-twocolumn`, `conf-paper`, the corpus documents that have both a float and a page that does not land exactly. The other 19, HW1 and HW2 included, are byte-identical. Oracle tests (`tests/page_column_shrink_oracle.rs`), each failing before its own fix and separating the two: `page-break-hyphen` moves ten words to the next page once the penalty is charged; `page-column-shrink` keeps the same break either way and only moves vertically -- 4.01pt overfull with every line under the first shrinkable skip 1.47-1.87bp low before, exact after. Gates: render-pipeline `cargo test --release` 228 passed / 0 failed; amsmath 59/59; tabular_oracle 106/106; HW1 and HW2 3 pages, 0 errors, 0 overfull, v2 byte-identical. pdflatex is an oracle only. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu
This was referenced Sep 15, 2026
Contributor
|
Superseded — both of this PR's two fixes are on main, with matching code comments. Verified on 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. |
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.
Vertical parity lane (linux-primary). Draft. Base
origin/main@06007472.Issue #2 split the corpus error by axis and found the vertical miss is mostly a
rigid per-page offset:
|dx| ≤ 0.5bp73.1%,|dy| ≤ 0.5bp29.5%, but62.3% once each page's own median
dyis subtracted. This is the two bugsbehind most of that offset.
Where the first divergence is, with the
\showoutputevidencelmodern-reportpage 1, the clean case from the issue:dx_mean0.004bp,every word 1.83bp low, growing to 110bp by page 4.
pdflatex's own page-1 vertical list (
\showoutput, pdfTeX 1.40.27; my localrun reproduces the committed
reference.pdfword-for-word on all four pages):Summing that box's items: natural 652.76431pt in a 650.43001pt
\@colht, excess 2.3343pt against 8.82867pt of available shrink — ratio0.26439, exactly the
glue setTeX printed. Our vertical list is the samelist: our last page-1 baseline plus one
\baselineskipis 652.764pt, thenatural total to 0.001pt. So the list was never the problem.
Per line, the first three divergences on that page and what each is:
Contents(\section*after\maketitle)1 Executive Summary2 BackgroundThose are precisely the shrink shares: the
\sectionbefore-skip is3.5ex plus 1ex minus .2ex=16.50078 plus 4.71451 minus 0.94289, and0.94289 × 0.26439 = 0.2493pt = 0.2484bp. TheContentsgap additionallyspans
\@maketitle'scenter, whose\@endparenvcontributes\topsep + \partopsep = 12pt plus 4pt minus 6pt;6.94289 × 0.26439 = 1.8356pt = 1.829bp. Everything on the page is the natural layout of thecorrect list.
What I fixed
1.
\brokenpenaltywas never charged. tex.web §890 puts it in the samepenalty node as
\interlinepenalty/\clubpenalty/\widowpenaltywheneverthe line just finished ended at a discretionary; LaTeX sets it to 100
(
\showthe\brokenpenalty). In the log it is the\penalty 100between"…frustration. Man-" and "agement commissioned…". Tracing our page builder at
the same two breakpoints:
Cost 1 beats 2, so we ended the page at the hyphen. pdflatex compares
1 + 100against2— and the glue after a penalty is not itself a legalbreakpoint, so there is no third option.
VBlock::broken_penaltynow carriesit per line from
Line::hyphenated, which is exactly §882'sdisc_break.Table cells are deliberately excluded: their lines are not breakpoints of the
page's vertical list, so charging them would move longtable's row breaks with
no oracle behind it.
2. The float column builder never set its columns' glue.
\@makecolpacks every column
\vbox to\@colht.break_pages_regionsandmake_columnboth do this;
floatpage::paginate's no-footnote branch — which is the branchevery page of a document that has a float and no footnote takes — advanced
by each glue's natural width, with no ratio at all. So even after the break
was right, the page stayed at natural size and ran past the text area.
Before / after
22 real-world fixtures, 12 261 aligned words, zero font-failure
diagnostics, measured with the per-axis harness from PR #344 against the
committed pdflatex references.
|dx| ≤ 0.5bp|dy| ≤ 0.5bpPer document,
|dy| ≤ 0.5bp:lmodern-reportpage by page (mediandy, bp):Page 1 is now exact. Pages 2–4 are downstream of a different, already-filed
gap:
floats.rs::preparedrops atabularinside a float (issue #2 §5), soour Table 1 box is 25.2bp tall where pdflatex's is 120.5bp. Everything on
those pages is carried by that 95bp.
v2 output changed for exactly three fixtures —
lmodern-report,article-twocolumn,conf-paper, i.e. the corpus documents that have both afloat and a page that does not land exactly. The other 19 are byte-identical,
HW1 and HW2 included.
Residual per-page constants
After this change, the median
dystill left on each page — the "this class isN bp low" number for the next lane.
|dy − page median|is how much is notthe rigid offset.
|dy−med| ≤ 0.5The large ones are page-count mismatches, not page geometry: every document
whose page count matches and whose first page is right is at 70–100%.
Tests
crates/render-pipeline/tests/page_column_shrink_oracle.rs, two fixtures,each failing before its own fix and separating the two behaviours:
page-break-hyphen— the break moves: ten words go to the next page oncethe penalty is charged.
page-column-shrink— the break is the same either way (all 358 page-1words align before and after); only the vertical placement moves. Before:
overfull_vbox4.01pt and every line under the first shrinkable skip1.47–1.87bp low. After: exact.
Expected data is pinned pdflatex word geometry read by
tools/visual-oracle/pdftext.py; no TeX runs in the Rust tests.Gates
crates/render-pipelinecargo test --release: 228 passed, 0 failedtabular_oracle106/106crates/render-pipeline/vendor/untouchedMethod note
One intermediate sweep of mine reported 54 "regressions" on no-float
documents. It was invalid: I ran it without exporting
FLASHTEX_FONT_DIRS/FLASHTEX_TFM_DIRS, and the two binaries sit at different paths, so theyresolved metrics differently. Re-run with the environment set, the same sweep
reports 0 differing configurations. Font substitution, not layout —
exactly the failure mode
tools/visual-oracle/fontenv.pywas written for.🤖 Generated with Claude Code
https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu