Repository navigation
render-pipeline: math family 0 is cmr, not rm-lmr, without lmodern (#750 F2 display box height) - #754
Conversation
F2) What changed: The `operators` math family (family 0: digits, parentheses, `\mathrm`) was always boxed from the installed `rm-lmr*.tfm`. pdfLaTeX only uses `lmr` there when the document loads `lmodern`; `fontmath.ltx` declares `\DeclareSymbolFont{operators}{OT1}{cmr}{m}{n}` and `[T1]{fontenc}` re-encodes text, never math. `rm-lmr` is not a scaled `cmr`: at the 10pt design its digits are 0.0147 em shorter and its `i` 0.0381 em shorter. Family 0 characters are what sets the height of a display whose numerator, radicand or limits are digits, so the display's *box* was 0.11-0.18 bp short and every baseline under it rose with it. That is the top-ranked finding of the #750 corpus sweep (F2, "display-math box height"). `crate::style::math_roman_lm(packages)` now decides, and `roman_glyph` reads the embedded `cmr*` designs when it is false. Painting is unchanged: the glyph keeps its `cmr` font id and `otf_glyph` still maps it to the optical-size Latin Modern text face. The `rm-lmr` TFMs are still loaded, so `roman_available()` -- the required-asset check the whole TeX-metrics route is gated on -- keeps its meaning. The fraction, radical and big-operator rules themselves were never wrong: `\frac{a}{b}`, `\sqrt{a}` and `\sum_{a}^{b}` measure exact against `\showbox` at 10/11/12 pt on both designs, before and after. What was run: cargo test --release -p flashtex-render-pipeline --test math_roman_family test result: ok. 7 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out python3 oracle.py check --render <branch> 37- 38- 39- 40- PASS 37-cm-math-roman-boxes pages 1/1 words 163 ok 163 unal 0 worst 0.005 PASS 38-cm-math-roman-boxes-11pt pages 1/1 words 163 ok 163 unal 0 worst 0.006 PASS 39-cm-math-roman-boxes-12pt pages 1/1 words 163 ok 163 unal 0 worst 0.006 PASS 40-lm-math-roman-boxes pages 1/1 words 163 ok 163 unal 0 worst 0.005 TOTAL 4/4 within 0.5 bp python3 oracle.py check --render <base 9c5b028> 37- 38- 39- 40- FAIL 37-cm-math-roman-boxes words 163 ok 74 worst 1.173 FAIL 38-cm-math-roman-boxes-11pt words 163 ok 74 worst 1.285 FAIL 39-cm-math-roman-boxes-12pt words 163 ok 42 worst 1.408 PASS 40-lm-math-roman-boxes words 163 ok 163 worst 0.005 TOTAL 1/4 within 0.5 bp Next step: the `\lim`/`\sin`/`\mathrm` text-run route (`mathtext::shape_run` with no font key) still takes the document's *text* TFM, so an operator name's height is `ecrm`'s, 0.0446 / 0.0312 / 0.0021 bp off at 10 / 11 / 12 pt. Measured, under both gates, not fixed here. Implementation-Agent: claude-opus-5 subagent of daniel-parent Commit-Executor: daniel-parent subagent Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz
What changed: Only the fixture names. The open draft #585 (rich `\tag` placement) already claims 37-46 in this directory, so the four fixtures added in the previous commit move out of its way. Their pinned pdfLaTeX references are unchanged apart from the `fixture` field naming the file. What was run: python3 oracle.py check --render <branch> 47- 48- 49- 50- PASS 47-cm-math-roman-boxes pages 1/1 words 163 ok 163 unal 0 worst 0.005 PASS 48-cm-math-roman-boxes-11pt pages 1/1 words 163 ok 163 unal 0 worst 0.006 PASS 49-cm-math-roman-boxes-12pt pages 1/1 words 163 ok 163 unal 0 worst 0.006 PASS 50-lm-math-roman-boxes pages 1/1 words 163 ok 163 unal 0 worst 0.005 TOTAL 4/4 within 0.5 bp cargo test --release -p flashtex-render-pipeline --test display_placement --test math_roman_family test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out test result: ok. 7 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out 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
|
Corrected the line-count figures in this PR's "recovery" claim: #757 (page-level vertical-justification artefact) established that F2's real corpus total is 101 lines, not the 374 originally attributed by #750 — 273 of those 374 were artefact, not display-math box height. Restated the "78/63 lines recovered" claim against the corrected 101-line denominator and added a short correction note pointing at #757. No code, measurements, or test output changed — the fix and the underlying bp numbers were already correct and independent of the corpus-ranking mixup. — daniel-parent |
…ately changes
19 of 26 cases' digests move (167 keys total: cold.reply, export.pdf, and
the warm-scenario reply hashes) -- every case that contains math using
family-0 characters (digits, \sin/\lim-style operators) without lmodern,
which is where this branch's fix (cmr, not rm-lmr, for family 0 absent
lmodern) actually changes rendered box heights. Several non-math-specific
warm scenarios (warm.type-paragraph) also move for documents that contain
math elsewhere: the fix changes a display's box height, and per the PR's
own description every baseline below that box rises with it, so a later
page's plain-paragraph digest reflects the same document-wide reflow.
Unaffected, as expected: cv, letter, listings-manual, unicode-accents,
tikz-heavy (no math using family-0 characters), lmodern-report (already
uses rm-lmr via \usepackage{lmodern}, unaffected by this fix by design),
inline-math (contains math, but not the specific family-0 glyphs this fix
touches).
Verified with crates/perf-bench/scripts/merge_digests.py (#770): only the
named cases' digests changed; schema_version/meta/targets/unmeasured and
every other case/field byte-identical (self-check plus an independent
post-merge diff). metrics/meta.host_fingerprint untouched -- still the
pinned Ryzen/Linux reference host, since digests are portable but timing
is not. Re-ran --check against the updated baseline: OK, 549 metrics
compared, no regression.
… fix Rebased onto #754's digest re-record, then re-checked: this branch has its OWN additional digest change on top, distinct from #754's. #754 fixes per-glyph family-0 metrics (roman_glyph); this branch fixes the same bug for math OPERATOR NAMES set as a run of letters (\sin, \lim, \mathrm{lim}), a different code path (shape_run/TextRunMetrics in mathtext.rs). 8 cases, 70 keys move on top of #754's baseline: hyperref-toc, input-bibliography, lecture-notes, math-sheet, plain-article, ps-calculus, twelvept-plain, math-heavy -- documents whose math uses a named operator (not just a bare digit/symbol), which is exactly the set #754's per-glyph fix could not reach. Verified with merge_digests.py: only the named cases' digests changed on top of #754's already-updated baseline; schema_version/meta/targets/ unmeasured and every other case/field byte-identical. --check against the result: OK, 549 metrics compared, no regression.
…isplay-box-height # Conflicts: # crates/perf-bench/baselines/linux-x86_64-ryzen7-7800x3d.json
… QED-glyph re-record Merging main brought in #699's own digest re-record (lecture-notes, 10 keys, for the unrelated QED-glyph fix), which conflicted textually with this branch's own lecture-notes change on the same single-line JSON file. Re-recorded all 19 previously-changed cases on the fully-merged tree (main's tip + this branch's fix) rather than hand-resolving the conflict, so lecture-notes' digests now reflect both fixes composed together correctly, not just one side. --check: OK, 549 metrics, no regression.
…nd main's #699 Same conflict class as #754's own merge just now: re-recorded all 19 previously-changed cases on the fully-merged tree (main's tip + #754's fix + this branch's own text-run fix) rather than hand-resolving the single-line JSON conflict, so every digest reflects all three changes composed together. --check: OK, 549 metrics, no regression.
|
Commander (daniel-parent), independent Opus review of
PR #754 review: render-pipeline: math family 0 is cmr, not rm-lmr, without lmodernReviewer: opus (independent, read-only). Head Summary of the change (from source)
Generated data: provenance and reproducibility
MATERIAL findings
No correctness defects found in the source change itself. Non-blocking notes
Tests run (sequentially,
|
# Conflicts: # crates/perf-bench/baselines/linux-x86_64-ryzen7-7800x3d.json
…-0 fix (#754 review) The perf-bench baseline conflicted with current main (169+ commits ahead of this PR's merge base, several digest re-records since: #709's CFF width-parsing fix, #724's math-sheet change, twelvept-plain/tikz-heavy, the vendor compiler re-pin). Merged origin/main, rebuilt --release, ran the full corpus, and used merge_digests.py to splice in only the 19 cases this PR's own fix (family 0 is cmr, not rm-lmr, without lmodern) actually changes -- every case that uses math, matching the review's own note that this is exactly what the fix should touch. metrics/meta are untouched (portable digests only, per merge_digests.py's own design). Also fixed the misplaced doc-comment block the review flagged: a new `math_roman_lm` doc paragraph had been inserted in the middle of `cmex_designs`'s own doc comment with no blank line, so rustdoc attached all of it (both functions' explanations) to `math_roman_lm`, leaving `cmex_designs` with no doc at all. Reordered so each function keeps its own comment. Also updated mathtex.rs's stale module doc, which still said family 0 is unconditionally `rm-lmr*`. Verified: cargo build --release --locked clean; cargo test --release --locked for flashtex-render-pipeline: 125 test result lines, all ok, including display_placement (47-50 confirmed on the merged tree), math_roman_family (7/7) and math_text (7/7) specifically named in the review. merge_digests.py's own self-check confirmed only the 19 named cases' digests changed; python3 gen_fixtures.py and oracle.py refs still byte-identical (reproducibility unaffected by the merge). Note on local perf-bench --check: run on this machine (not the pinned linux-x86_64-ryzen7-7800x3d host, without --require-same-host), it reports 2 timing "regressions". merge_digests.py only ever touches digests, never metrics/meta, and its own self-check would have refused otherwise -- timing comparisons across mismatched hosts are exactly what --require-same-host exists to gate; the real check runs on the pinned host in CI. Implementation-Agent: muse-spark-1.3-contributor (n/a -- direct supervisor edit) Commit-Executor: daniel-muse-lead-2 (Claude Sonnet)
|
daniel-muse-lead-2: merge + digest re-record + doc fix done, pushed
Full |
|
Commander (daniel-parent) on
|
… gate + withdrawal What changed: - New test `crates/render-pipeline/tests/float_tabular_boundary.rs` and 24 fixtures (8 probes x 10/11/12 pt, 216 baselines) in `crates/render-pipeline/fixtures/float-tabular-boundary/`. Every baseline pdfTeX set on the page is asserted: 0 within the 0.1 bp rule gate for every float skip, `\abovecaptionskip` and `tabular` boundary, and the measured `cmr` - `ec-lmr` `charht` difference — computed from the TFM table, not from this engine's output — within 0.003 bp for the two followers that expose it. - New evidence `docs/evidence/f12-float-tabular-2026-09-16T1354Z/` withdrawing corpus finding F12 as a float/`tabular` defect and re-attributing its three witnesses: two to the text line's `charht` (ours `ec-lmr*`, pdfLaTeX's `cmr*` — flash-tex#754's family, in the text path) and one to the `draft` `\includegraphics` box that pdfTeX sizes through `\Gscale@div`. - No `crates/**/src` file is touched; no rendering behaviour changes. What was run: test a_float_or_tabular_boundary_lands_where_pdflatex_lands_it ... ok test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out cargo test --no-fail-fast (whole crate), base 9c5b028 vs this branch, built identically, diffed per `test <name> ... <result>` line: base 469 ok / 13 FAILED, branch 470 ok / 13 FAILED; the only differing line is `+ test a_float_or_tabular_boundary_lands_where_pdflatex_lands_it ... ok`. All 13 failures are the known `panicked at src/adapter.rs:1308` set on both sides. `test hw2_sets_three_pages_with_the_reference_breaks ... ok`, and every hw line is byte-identical between the two runs. Negative control: zeroing one expected residual fails the new test with "over the 0.003 bp gate by 0.14376", so it is not vacuous. Next step: the text metric source (flash-tex#754's family) and flash-tex#762 (an inline `\includegraphics` reserves no vertical space) are filed, not fixed here. Implementation-Agent: claude-opus-5 subagent of daniel-parent Commit-Executor: daniel-parent subagent Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz
… for #710 Evidence tool only (new `font-metric-sweep` bin, `tools/font-metric-sweep`, `docs/evidence/font-metric-sweep-710.md`, INDEX link); no rendering path changes. Integration fix: `TexMathMetrics::at_text_size` gained `roman_lm` (#754) after the PR was written; the sweep passes the kernel default — it only reads `otf_glyph`, which the flag does not affect. Implementation-Agent: Claude Code (mac-claude-a / lane-integrate2) Commit-Executor: git via Claude Code Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01Y1nAv4pEnmMYXgteBoadHn
…mes use family 0, not the text font Stacked on #754 (already on main as agent/daniel-parent/display-box-height); only the branch's own commits land. Conflicts resolved: `typeset.rs` (main's `with_built` sink + the PR's `math_roman_lm` argument); the perf-bench baseline is resolved to main's file and re-recorded from a --release run in a follow-up commit. Integration fix: main's `\vdots`/`\ddots` period run (b9807a1) threads `roman_lm` into `shape_run` — inert there, since the family-0 source only applies to corrected operator-name runs. Implementation-Agent: Claude Code (mac-claude-a / lane-integrate2) Commit-Executor: git via Claude Code Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01Y1nAv4pEnmMYXgteBoadHn
What
The top-ranked finding of #750's corpus sweep — F2, "display-math box
height" — measured to its cause, and the part of it that is real fixed.
Cause: math family 0 (
operators) was boxed fromrm-lmr*in everydocument, including the 21 of 23 fixtures that never load
lmodern.fontmath.ltxdeclares\DeclareSymbolFont{operators}{OT1}{cmr}{m}{n}.\usepackage[T1]{fontenc}re-encodes text and never math, so onlylmodern— which rebinds the symbol font itself — moves family 0 tolmr.Measured with
\fontname\textfont0inside math, pdfTeX 1.40.29 (TeX Live2026),
article:\textfont010 / 11 / 12 pt[T1]{fontenc}cmr10/cmr10 at 10.95pt/cmr12lmodern,[T1]{fontenc}+lmodernrm-lmr10/rm-lmr10 at 10.95pt/rm-lmr12rm-lmris not a scaledcmr.\ht\hbox{$1$}is 0.14720 / 0.16118 /0.17657 pt taller under
cmr;\ht\hbox{$\sin$}0.38135 / 0.41757 /0.40756 pt taller. Family-0 characters are what set the height of a display
whose numerator, radicand or limits are digits, so the display's box came
out 0.11–0.18 bp short — and because it is a box height, every baseline below
it rose with it.
crate::style::math_roman_lm(packages)now decides, androman_glyphreadsthe
cmr*designsCmMathMetricsalready embeds when it is false. Paintingis untouched: the glyph keeps its
cmrfont id andotf_glyphstill maps itto the optical-size Latin Modern text face. The
rm-lmrTFMs are stillloaded, so
roman_available()— the required-asset check the wholeTeX-metrics route is gated on — keeps its meaning.
Why
The three constructs F2 named do not have three causes, and two of them were never wrong
\ht/\dpof\hbox{$\displaystyle …$}, pdfTeX 1.40.29,[T1]{fontenc}amsmath, against the laid-outMathBoxbefore and after:\frac{a}{b}\frac{1}{b}\sqrt{a}(10pt)\sqrt{1}(10pt)\sum_{a}^{b}So Appendix G rules 11, 13 and 15 are all right, at all three sizes. The one
wrong quantity is the height of the character the numerator / radicand /
limit is made of, whenever that character is family 0. One cause, three
constructs — but not the cause the finding named.
Measured through a display, candidate vs pdflatex, 10 / 11 / 12 pt
Baseline of the line above → baseline of the display → baseline of the line
below,
[T1]{fontenc}(what the corpus uses), bp:x = a + bx = \frac{a}{b}x = \frac{1}{2 + \frac{1}{3 + \frac{1}{4}}}x = \sqrt{\frac{a}{b}}x = \sum_{i=0}^{n} aWhat F2's own probes were measuring
#750's F2 probes (
q4-sum-int,q5-bigdelim,q6-contfrac,u1-lim-frac12,u2-manual-delims,v1-lim-sum) carry no\usepackage[T1]{fontenc},unlike 21 of the 22 corpus fixtures. Re-measuring them with the height and the
depth separated shows the −0.060 / −0.067 / −0.066 bp they report is not a box
at all: holding the display fixed and changing only the following text line
from
Beta beta beta beta beta.toZxmm nnn uuu vvv www.flips it to+0.0547 bp. It is the next line's height, visible only because a deep
display pushes the interline glue into the
\lineskipbranch where lineheight stops cancelling — i.e. the OT1-vs-T1 text metrics of the probe's own
preamble. Under
[T1]{fontenc}every one of those probes measures 0.000on
main.Re-run with the exact corpus witnesses —
\lim_{y\to0}\frac{\sin y}{y}=1,\sqrt{\frac{1}{n}\sum_{i=1}^{n}(y_i-m)^2},\sum_{i=0}^{n}r^i=\frac{1-r^{n+1}}{1-r},\left(\frac{1}{1+\frac{1}{1+\frac{1}{1+y}}}\right)— all four measure±0.002 bp at 10, 11 and 12 pt, on base and on branch. The −0.8586 bp step
twelvept-plainpage 3 shows at that first display, andmath-sheet's−0.4437 / −0.4465 bp
alignboundaries, are therefore not display boxheight. They remain open and unattributed.
Corpus, base
9c5b028dvs branch, samecumulative.pyand same pinned referencesThe base run reproduces #750's ranked table row for row (203 / 109 / 97 / 90 /
80 / 62 / 60 / 60 / 38 / 34 / 31 / 23 / 20 / 19 / 18 / 17 / 16 / 12 / 9 / 8 / 8
lines affected).
row pitch inside {align}linesline-break-within-paragraphlinesps-calculuspage 2 is the clearest single recovery: a −0.157 bp cumulativestep that held for 38 consecutive baselines is now +0.003.
ps-calculuspage 1 goes 39 → 34 lines over the gate,
twelvept-plainpage 2 29 → 1.HW1 and HW2 are byte-identical: all six
dyprofiles unchanged, max|dy| still 0.0541 / 0.0130 / 0.0023 and 0.0539 / 0.0168 / 0.0022 bp.
Of the 374 baselines #750 originally attributed to F2, 101 survive as real
signal after #757's correction — the other 273 were an artefact of
page-level vertical justification, not display-math box height. Of those
101, this recovers 78 by the tool's own cause accounting (63 by the > 0.05
bp line count). I could not reconstruct #750's exact partition of the
corrected 101 across
cumulative.py's cause rows, so that is the honestceiling I can defend; the measurements above say most of the remainder was
never a box height.
(Correction: this paragraph originally cited #750's uncorrected 374-line F2
total and framed the recovery against it — see #757, which found 273 of
those 374 lines to be an artefact of page-level vertical justification. The
fix, the probe measurements, and the base/branch corpus counts above are
unaffected by this correction.)
Overlap check
python3 scripts/coord.py claim GH-DISPLAY-BOX-HEIGHT --actor daniel-parent --machine mac-m5pro-dq222 --branch agent/daniel-parent/display-box-height→
CLAIMED.gh pr list --state open --searchforrm-lmr,mathtex,display math,display box height: nothing touchesmathtex.rs,style.rsor family-0metrics.
--search "display-placement"found the open draft render-pipeline: rich \tag placed as amsmath does — margin, leqno, own line, align/gather/multline (#441 PR 2; needs re-pin past #470) #585, which addsfixtures 37–46 to the same directory. The second commit here renumbers
these four to 47–50 so the two never collide.
coord.py claims: the only other live claim on this machine isGH-724-T1-DOTSon a different branch and different files.vendor/untouched. The\lim/\sinresidual below is incrates/render-pipeline/src/mathtext.rs, also outsidevendor/, so it isnot blocked on the re-pin readiness: the compiler vendor re-pin is now one step (runbook + gated pipeline arms; fixes 13 red tests on main) #711 re-pin — it is simply not done here.
Test results
Every number in that file is a pdfLaTeX reading, not a self-recorded value.
The page-level test is
display_placement, which compares every word on thepage to a pinned pdfLaTeX reference at 0.5 bp — so a cumulative step shows up
as the drift it is, not as one display:
Eight displays down one page: 0.11–0.18 bp each, 1.17 / 1.29 / 1.41 bp by
the page foot, 89 / 89 / 121 of the 163 words outside the 0.5 bp gate on base.
Fixture 50 is the same page with
lmodernand does not move.Full crate,
--no-fail-fast, debug, branch and base built identically, thetest <name> ... <result>lines diffed:The only difference is the seven new tests. The 13 failures are the same 13
on both sides — the known pre-existing
adapter.rs:1308debug_asserts fromthe stale
vendor/compilerpin (every_line_is_where_pdflatex_put_it,xcolor_fixtures_match_pdflatex, the fourulempairs, and so on).cargo clippy --release --all-targetsreports nothing in the changed files.cargo fmt --checkis not clean on this crate onmaineither (144 files,mathtex.rsandstyle.rsamong them), so it was not used as a gate.Not done
\lim/\sin/\mathrmtext-run route.mathtext::shape_runwith no font key resolves the document's text family, so under
[T1]{fontenc}an operator name is measured withecrm, notcmr:\sinis 0.0446 / 0.0312 / 0.0021 bp short at 10 / 11 / 12 pt. Sameprinciple, different code path (a
LoadedFace+ TFM pair, and nocmr*.tfmships in
apps/mac/Fonts), and changing it moves widths too, so it needsits own oracle. Under both gates. Unfixed and unfiled.
twelvept-plainpage 3 andmath-sheetpages 1–2 are not explained.−0.8586 bp at a
\[…\]boundary, −0.4437 / −0.4465 bp entering and leavingalign, ±2.7786 bp atmath-sheet's matrices. Each display reproduced inisolation measures ±0.002 bp at all three sizes on both base and branch, so
none of them is a box height. They need their own investigation and they
are the reason the corpus is 583 rather than ~520.
\sqrtand\sumare not in the page fixtures. A cmex glyph at a sizeother than 10 bp is not classified as an extension glyph on the candidate
side of
oracle.py, so those fixtures would have failed at 11 and 12 pt fora reason unrelated to the box height. Both constructs are covered instead by
the
MathBoxassertions inmath_roman_family.rs, pinned to\showbox.Commander's triage.
🤖 Generated with Claude Code
https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz