Repository navigation
render-pipeline: macro-body text takes the body's fonts; declaration groups add no italic correction (stacked on #547) - #556
Merged
Conversation
What changed:
- adapter::style_intervals now adds macro_argument_intervals: the font
commands a user macro's definition wraps around `#k` (`{\small\bfseries
#1}`, `\textbf{#1}`, `\textit{#1}`) are laid over argument k's bytes at
every invocation, in TeX's order (call site, then definition, then the
argument's own). An ungrouped declaration (`\small\bfseries #1`) stays in
force to the end of the call site's group, as if written there.
- space_style: after a replacement-text token (span = the invocation), the
space before a later argument is in the call site's font, not the font of
the earlier argument whose bytes sit in between.
- items_cached keys each text inline on the style in force at it, since a
definition outside the block can now change that style.
- fixtures/divergence-probes/min2-preamble-switches: 419.027 bp -> 0.005 bp
(the note was LMRoman9-Regular, pdfLaTeX sets SFBX0900; the narrower face
reflowed "followed by" onto line 1).
What was run:
- cargo test --release --test macro_argument_fonts: test result: ok. 3 passed; 0 failed (all 3 fail on origin/main)
- cargo test --release --lib: test result: ok. 138 passed; 0 failed; 2 ignored
- cargo test --release --no-fail-fast (whole render-pipeline crate): 80 test binaries, passed 378 failed 0 ignored 3
- tools/visual-oracle/rank.py over fixtures/divergence-probes (MacTeX 2026 refs): within 0.5 bp 1799 -> 1819 words, no other probe changed
- tools/visual-oracle/rank.py over fixtures/real-world (pinned refs): only cv changed, max delta 37.439 -> 29.888 bp; within 0.5 bp 12277 -> 12277
Next step: replacement-text words (`\newcommand{\x}{\textbf{Note:}}`) still
take the call site's font; that needs the body cursor in the style lookup.
Implementation-Agent: claude-opus-5 subagent of daniel-parent
Commit-Executor: daniel-parent subagent
Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz
… declaration groups add no italic correction
What changed:
- Replacement-text words (`\newcommand{\x}{\textbf{Note:}}`) were set in the
call site's font, because the compiler spans them at the invocation. The
body cursor (token_gap's BodyCursor) now records where the word was found
in the definition body, and Styles::in_body applies the body's own groups
and commands around it on top of the call site's font. A blank inside the
body is set in the body's font at that blank.
- `\textit{...}`/`\emph{...}` closing inside a body get the same `\maybe@ic`
italic correction as in the source: suppressed before `.`/`,` (the body's
next byte, or the byte after the invocation) and after a slanted font.
- Font declarations (`\itshape`, `\bfseries`, `\slshape`, `\em`) no longer
mark their group's end for italic correction. LaTeX adds `\/` only through
`\text@command`; `{\itshape leaf} then` has no kern in pdfLaTeX. The flag is
gone from font_declaration, and macro_argument_intervals honours an
interval's own flag.
- tests/macro_body_fonts.rs: 4 tests pinned to pdfLaTeX (TeX Live 2026) run
origins; 3 fail on the base (#547), the `\nocorrlist` pin passes on both.
What was run:
- cargo test --release --test macro_body_fonts: test result: ok. 4 passed; 0 failed (base: 1 passed; 3 failed)
- cargo test --release --test macro_argument_fonts: test result: ok. 3 passed; 0 failed
- cargo test --release --no-fail-fast (render-pipeline): 81 result lines (80 test binaries), passed 383 failed 0 ignored 3
- rank.py fixtures/divergence-probes (43): 0 pages changed, within 0.5 bp 1819 -> 1819
- rank.py fixtures/real-world (59 pages): 0 pages changed, within 0.5 bp 11183 -> 11183
- rank.py scratch probes (fresh pdflatex refs): body-text 6.765 -> 0.005 bp,
itshape 4.224 -> 0.005 bp, body-ic2 9.438 -> 0.005 bp, textit 0.005 -> 0.005 bp
Next step: `\newcommand{\w}{\textit{leaf}, then}` loses its `,` (no ","
text inline reaches the adapter, likely compiler-side; not fixed here), so
the rest of that line is 2.04 bp off.
Implementation-Agent: claude-opus-5 subagent of daniel-parent
Commit-Executor: daniel-parent subagent
Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz
This was referenced Sep 15, 2026
d-q222
added a commit
that referenced
this pull request
Sep 15, 2026
…p-2 regression verdicts What changed: - Merged origin/agent/daniel-parent/pdf-math-tounicode (d999108) with --no-ff; no conflicts. b283587: rank.norm folds U+2212 into "-", amsmath regroup orders with the same fold. d999108: rank.v2_words slices cluster byte ranges as bytes. - Notes: new "Corpus sweep 2 regressions" section. Per regression: the cause PR found by rebuilding flashtex-render at each render-pipeline merge, the verdict against pdflatex's positions, and the oracle results. Also repaired the #556/#596 conflict-table row, which had swallowed the #536/#597 row. What was run (this tip; render-pipeline unchanged by the merge, flashtex-render built at 5d1eb06): - amsmath: TOTAL 59/59 within 0.5 bp - amssymb: TOTAL 38/39 within 0.5 bp - tabular: TOTAL 128/128 (words 0.5 bp, rules 0.1 bp) - display-placement: TOTAL 35/36 within 0.5 bp - tools/visual-oracle unit tests: Ran 15 tests, OK - rank.py real-world: aligned words 15326 (15253 with the old rank.py) Next step: comment the verdicts on #597, #596, #536 and #547. Implementation-Agent: claude-opus-5 subagent of daniel-parent Commit-Executor: daniel-parent subagent Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz
…uashed form #556 refines #547, which has since squash-merged onto main along with five other render-pipeline landings (#524, #536, #538, #543, #548). Exactly one line conflicted: ours .map(|(_, e, c, ic)| (*c, *ic && *e == p + 2, *e >= body.len())) main .map(|(_, e, c, _)| (*c, *e == p + 2, *e >= body.len())) The extra `*ic &&` is precisely this PR's change -- it gates the interval on the fourth field #547 ignores -- so the branch side is kept. Taking the branch wholesale would have been wrong here. Unlike a plain stacked rebase, main carries five other commits in this file; git merged those cleanly around this hunk, and only this one line needed a decision. Implementation-Agent: orchestrator-astra Commit-Executor: orchestrator-astra (direct; Cursor usage limit)
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.
Stacked on #547 (base branch
agent/daniel-parent/probes-fidelity). Review/merge #547 first; this PR's diff against main includes #547's commit.What
Two render-pipeline gaps from the probes table (#2 comment 5676249771), both in
crates/render-pipeline/src/adapter.rs:\x), so\newcommand{\x}{\textbf{Note:}}setNote:in the call site's medium face.token_gap'sBodyCursornow records where the word sits in the definition body.Styles::in_bodyapplies the body's own groups and commands around it on top of the call site's font. A blank inside the body is set in the body's font at that blank.\itshape,\bfseries,\slshape,\em) no longer mark their group's end for\/. LaTeX adds it only through\text@command's\maybe@ic.\textit/\emphkeep it, suppressed before./,(\nocorrlist) and after a slanted font. The same rule now runs for\textit{...}closing inside a macro body (the next token is the body's next byte, or the byte after the invocation).macro_argument_intervals(render-pipeline: a macro body's font declarations apply to its arguments (min2-preamble-switches 419 bp -> 0.005 bp) #547) honours an interval's own correction flag.Tests:
crates/render-pipeline/tests/macro_body_fonts.rs, 4 tests pinned to pdfLaTeX run origins (pdfTeX 1.40.29, TeX Live 2026,SOURCE_DATE_EPOCH=0 FORCE_SOURCE_DATE=1, 2 passes, read withtools/visual-oracle/pdftext.py). 3 of them fail on #547's head. The\textit/\emph\nocorrlistpin passes on both.Why
tools/visual-oracle/rank.pyon scratch probes with fresh pdflatex references, max |Δ| in bp:\textbf{Note:},{\itshape Remark} and {\bfseries Bold words},\textit{Hint:} #1 donein bodies){\itshape leaf} then,{\em ff} after,{\bfseries f} then)\textit{leaf}at body end before upright / before.,\emph{elf} #1 \textbf{bold words},\textsl{half}b)\textit{a}./\textit{a}b/\emphOverlap check
gh pr list --state open --search"italic correction", "macro body", "itshape", "nocorrlist", "newcommand": only render-pipeline: a macro body's font declarations apply to its arguments (min2-preamble-switches 419 bp -> 0.005 bp) #547 (the base of this PR) touches this code. render-pipeline: theorem layout like latex.ltx and amsthm (oracle 36/43; needs #149 re-pin) #156/render-pipeline: the amsthm head separator is the package's glue, not a space #197 (amsthm) and compiler: \labelitemi..\labelitemiv as the article default markers #422 do not.coord.py claims: GH-MACRO-BODY-FONTS claimed by daniel-parent. No other claim on adapter font styles.Test results
cargo test --release --test macro_body_fonts:test result: ok. 4 passed; 0 failed; 0 ignored(on render-pipeline: a macro body's font declarations apply to its arguments (min2-preamble-switches 419 bp -> 0.005 bp) #547 head:test result: FAILED. 1 passed; 3 failed)cargo test --release --test macro_argument_fonts:test result: ok. 3 passed; 0 failed; 0 ignoredcargo test --release --no-fail-fast(whole render-pipeline crate): 80 test binaries, passed 383 failed 0 ignored 3fixtures/divergence-probes: 0 pages changed (max Δ and within-0.5 bp identical), within 0.5 bp 1819 -> 1819fixtures/real-world(59 pages): 0 pages changed, within 0.5 bp 11183 -> 11183. An earlier draft lost 3 words per page on hw1/hw2 ([4 points]in\problem's\subsection*body got a bold space, -0.581 bp). It is fixed: a body blank keeps the heading'smediumweight.Not done
\newcommand{\w}{\textit{leaf}, then}loses its,: no "," text inline reaches the adapter, likely compiler-side, so the rest of the line is 2.04 bp off. That needs a compiler PR.🤖 Generated with Claude Code
https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz