Repository navigation
render-pipeline: HW1/HW2 residual glyph offsets vs pdflatex - #171
Merged
Merged
Conversation
… (baseline on main c40d2a6) Words compared per matched line: ours from the v2 display list, pdflatex from content-stream glyphs (tools/visual-oracle/pdftext.py). Horizontal residuals (dx) and whole-line vertical offsets (median dy) are reported separately. Implementation-Agent: Claude Opus 5 (subagent kabir-claude HW residuals 2, 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
LaTeX's \@item sets the label inside the zero-width \@labels hbox, so pdfTeX's post-line-break hpack (pdftex.web, <Incorporate character dimensions into the dimensions of the hbox>: add_char_stretch only for the line's own char nodes) never expands the label glyphs, and they add no font stretch/shrink to the line. Verified with \showbox on pdflatex (TeX Live 2026): label glyphs stay T1/cmr/m/n/10.95 while the line's characters are (+20). HW2 words with dx >0.1pt: p2 48 -> 38, p3 41 -> 30 (the two item first lines). HW1 unchanged; line breaks and overfull count unchanged. Implementation-Agent: Claude Opus 5 (subagent kabir-claude HW residuals 2, 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
microtype.sty patches \@item's \everypar to \leftprotrusion (\MT@patch@patch\@item{\everypar{}}{\everypar{\leftprotrusion}}); \MT@get@prot sets the item text's first group alone and adds \kern\leftmarginkern of it after the label. pdfTeX's own left margin kern cannot reach that character: find_protchar_left (pdftex.web) stops at the \@labels box's glue. Verified with \showbox on pdflatex (TeX Live 2026): '\penalty 0 \kern -0.40285 A' after the label on an item starting 'At'. HW1 words with dx >0.1pt: p3 12 -> 2. Line breaks and overfull unchanged. Implementation-Agent: Claude Opus 5 (subagent kabir-claude HW residuals 2, 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
…etlist
Under \usepackage[T1]{fontenc} (no lmodern) the preamble's \setlength
and enumitem's \setlist keys are evaluated in t1cmr.fd's EC font, whose
\fontdimen6 is not the design size: tftopl gives ecrm1095 QUAD 0.994328
(10.88789pt), ecrm1000 0.999756, ecrm1200 0.978928. pdflatex reports
\parskip 7.07704pt, \itemsep 4.8995pt, \topsep 3.81082pt for HW1's
0.65em/0.45em/0.35em; we used 1em = 10.95pt, drifting every paragraph by
0.04pt. Class-load values (\labelsep .5em = 5.475pt in the showbox) stay
cmr-based.
HW1/HW2 lines with median dy >0.1pt: 102 -> 0 (all pages). Line breaks,
page count and overfull count unchanged.
Implementation-Agent: Claude Opus 5 (subagent kabir-claude HW residuals 2, 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
…duals.py for any document residuals.py takes <name>=<v2.json>=<reference.pdf> triples. On all nine real-world fixtures, status/pages/diagnostics are unchanged and residual counts are unchanged outside HW1/HW2, which only improve. Implementation-Agent: Claude Opus 5 (subagent kabir-claude HW residuals 2, 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
GoKubar
added a commit
that referenced
this pull request
Sep 13, 2026
#171 predates #151/#152 in every conflicting region; its three residual fixes were grafted onto the newer structure: parse_dimen_in/ec_em_ex threaded through #152's apply_sep_keys and list_labelsep, and the item-label protrusion kern plus label_recs bookkeeping added to #152's multi-word label box. Implementation-Agent: Claude Opus 5 (subagent kabir-claude integration, nixos-pc-kabir) Commit-Executor: Claude Code direct Git Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu
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.
Draft. Per-word residuals of HW1/HW2 vs MacTeX pdflatex (oracle only), fixed one cause at a time. Evidence and reproduction script:
crates/render-pipeline/docs/evidence/hw-residuals-2026-09-13/(measure.sh <repo> <outdir> ref).Results (words matched per line; dx = horizontal residual >0.1pt; dy = lines with median vertical offset >0.1pt)
Line breaks (per-line word sequences) are identical to the baseline and pdflatex, 0 overfull, 3 pages each.
Fixes
\itemlabels are not expanded (0472358). The label sits in\@labels' hbox, so pdfTeX's hpack never addschar_stretchfor it.\showboxshows the label glyphs asT1/cmr/m/n/10.95while the line is(+20).\leftprotrusionafter\itemlabels (06390b8). microtype.sty patches\@item's\everypar{\leftprotrusion}, and\MT@get@protadds\kern\leftmarginkernof the first character.\showboxshows\penalty 0 \kern -0.40285 A.\setlengthand\setlist(93d5573). ecrm1095 has\fontdimen610.88789pt, not 10.95pt. pdflatex reports\parskip7.07704pt; we drifted 0.04pt per paragraph.Remaining causes (not in this PR)
\OT1/cmr/m/n/10.95 (-18) (in\showbox):(,),=,+and digits. Our math box is opaque to the microtype packer. About 50 words (HW2 p2 693.4, p3 111.0, p1 699.9, HW1 p1 598.3). Needs a paragraph-layout + render-pipeline math design.\ldots: compilermath.rsmaps it to the text atom.... pdfTeX sets\mathinner{\ldotp\ldotp\ldotp}, a 12.77pt hbox of OML periods. HW2 p3 250.1, 9 words, -5.52pt. Owner: compiler.M_m/M_n+1.64, p2 fraction numerator -1.73, p3 polynomial ±1.82). Owner: display math PRs render-pipeline: display math placement (leqno, fleqn, \eqno, \tag*, after headings, lists; oracle 19→29/36) #146/render-pipeline: squeeze too-wide displays, numbers on their own line, subequations label line (display-placement 33/36; needs #148 + #155 re-pin, includes #146) #157.\hfill \normalfont[1 bonus point]spaces (2 words per doc).🤖 Generated with Claude Code
https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu