Skip to content

render-pipeline: math family 0 is cmr, not rm-lmr, without lmodern (#750 F2 display box height) - #754

Merged
d-q222 merged 7 commits into
mainfrom
agent/daniel-parent/display-box-height
Sep 17, 2026
Merged

d-q222 merged 7 commits into
mainfrom
agent/daniel-parent/display-box-height

Conversation

@d-q222

@d-q222 d-q222 commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

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 from rm-lmr* in every
document, including the 21 of 23 fixtures that never load lmodern.

fontmath.ltx declares \DeclareSymbolFont{operators}{OT1}{cmr}{m}{n}.
\usepackage[T1]{fontenc} re-encodes text and never math, so only
lmodern — which rebinds the symbol font itself — moves family 0 to lmr.
Measured with \fontname\textfont0 inside math, pdfTeX 1.40.29 (TeX Live
2026), article:

packages \textfont0 10 / 11 / 12 pt
(none), [T1]{fontenc} cmr10 / cmr10 at 10.95pt / cmr12
lmodern, [T1]{fontenc}+lmodern rm-lmr10 / rm-lmr10 at 10.95pt / rm-lmr12

rm-lmr is not a scaled cmr. \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, and roman_glyph reads
the cmr* designs CmMathMetrics already embeds when it is false. Painting
is untouched: 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.

Why

The three constructs F2 named do not have three causes, and two of them were never wrong

\ht/\dp of \hbox{$\displaystyle …$}, pdfTeX 1.40.29, [T1]{fontenc}

  • amsmath, against the laid-out MathBox before and after:
formula pdflatex 10 / 11 / 12 pt base branch
\frac{a}{b} 11.07062 / 12.12231 / 13.28476 exact exact
\frac{1}{b} 13.20952 / 14.46440 / 15.85141 −0.1472 / −0.1612 / −0.1766 pt exact
\sqrt{a} (10pt) 8.49092 exact exact
\sqrt{1} (10pt) 9.56036 −0.0736 pt exact
\sum_{a}^{b} 18.36115 / 20.33809 / 21.75562 exact exact

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:

display base (height err) branch
x = a + b +0.0002 / +0.0002 / −0.0001 same
x = \frac{a}{b} +0.0003 / 0.0000 / −0.0005 same
x = \frac{1}{2 + \frac{1}{3 + \frac{1}{4}}} −0.1465 / −0.1602 / −0.1763 +0.0002 / +0.0003 / −0.0004
x = \sqrt{\frac{a}{b}} +0.0001 / −0.0002 / −0.0003 same
x = \sum_{i=0}^{n} a +0.0002 / −0.0002 / −0.0005 same

What 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. to Zxmm 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 \lineskip branch where line
height 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.000
on 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-plain page 3 shows at that first display, and math-sheet's
−0.4437 / −0.4465 bp align boundaries, are therefore not display box
height. They remain open and unattributed.

Corpus, base 9c5b028d vs branch, same cumulative.py and same pinned references

The 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).

base branch
reference lines with |dy| > 0.05 bp 646 583
lines whose |dy| moved closer to 0 — 116
lines whose |dy| grew — 16 (15 of them ≤ 0.018 bp)
row pitch inside {align} lines 38 0
line-break-within-paragraph lines 203 163 (9 → 7 occurrences)
sum over all causes 1031 953

ps-calculus page 2 is the clearest single recovery: a −0.157 bp cumulative
step that held for 38 consecutive baselines is now +0.003. ps-calculus
page 1 goes 39 → 34 lines over the gate, twelvept-plain page 2 29 → 1.

HW1 and HW2 are byte-identical: all six dy profiles 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 honest
ceiling 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

Test results

cargo test --release -p flashtex-render-pipeline --test math_roman_family
test only_lmodern_selects_the_lmr_operators_font ... ok
test a_digit_radicand_follows_the_documents_roman_font ... ok
test digits_are_cmr_tall_without_lmodern ... ok
test a_fraction_of_math_italic_is_exact_on_either_roman_design ... ok
test the_two_roman_designs_are_not_the_same_metrics ... ok
test a_fraction_with_a_digit_numerator_follows_the_documents_roman_font ... ok
test digits_are_rm_lmr_tall_with_lmodern ... ok
test result: ok. 7 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

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 the
page
to a pinned pdfLaTeX reference at 0.5 bp — so a cumulative step shows up
as the drift it is, not as one display:

python3 oracle.py check --render <branch, cefce7dd> 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

python3 oracle.py check --render <base, 9c5b028d> 47- 48- 49- 50-
FAIL 47-cm-math-roman-boxes       words 163 ok  74 unal 0 worst 1.173
FAIL 48-cm-math-roman-boxes-11pt  words 163 ok  74 unal 0 worst 1.285
FAIL 49-cm-math-roman-boxes-12pt  words 163 ok  42 unal 0 worst 1.408
PASS 50-lm-math-roman-boxes       words 163 ok 163 unal 0 worst 0.005
TOTAL 1/4 within 0.5 bp

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 lmodern and does not move.

Full crate, --no-fail-fast, debug, branch and base built identically, the
test <name> ... <result> lines diffed:

branch: 476 passed, 13 failed   (493 test lines)
base:   469 passed, 13 failed   (486 test lines)

diff base -> branch:
> test a_digit_radicand_follows_the_documents_roman_font ... ok
> test a_fraction_of_math_italic_is_exact_on_either_roman_design ... ok
> test a_fraction_with_a_digit_numerator_follows_the_documents_roman_font ... ok
> test digits_are_cmr_tall_without_lmodern ... ok
> test digits_are_rm_lmr_tall_with_lmodern ... ok
> test only_lmodern_selects_the_lmr_operators_font ... ok
> test the_two_roman_designs_are_not_the_same_metrics ... ok

The only difference is the seven new tests. The 13 failures are the same 13
on both sides — the known pre-existing adapter.rs:1308 debug_asserts from
the stale vendor/compiler pin (every_line_is_where_pdflatex_put_it,
xcolor_fixtures_match_pdflatex, the four ulem pairs, and so on).

cargo clippy --release --all-targets reports nothing in the changed files.
cargo fmt --check is not clean on this crate on main either (144 files,
mathtex.rs and style.rs among them), so it was not used as a gate.

Not done

  • The \lim / \sin / \mathrm text-run route. mathtext::shape_run
    with no font key resolves the document's text family, so under
    [T1]{fontenc} an operator name is measured with ecrm, not cmr:
    \sin is 0.0446 / 0.0312 / 0.0021 bp short at 10 / 11 / 12 pt. Same
    principle, different code path (a LoadedFace + TFM pair, and no cmr*.tfm
    ships in apps/mac/Fonts), and changing it moves widths too, so it needs
    its own oracle. Under both gates. Unfixed and unfiled.
  • twelvept-plain page 3 and math-sheet pages 1–2 are not explained.
    −0.8586 bp at a \[…\] boundary, −0.4437 / −0.4465 bp entering and leaving
    align, ±2.7786 bp at math-sheet's matrices. Each display reproduced in
    isolation 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.
  • \sqrt and \sum are not in the page fixtures. A cmex glyph at a size
    other 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 for
    a reason unrelated to the box height. Both constructs are covered instead by
    the MathBox assertions in math_roman_family.rs, pinned to \showbox.
  • No issue filed for F2 or for the residuals above; that is the
    Commander's triage.

🤖 Generated with Claude Code

https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz

 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
@d-q222

d-q222 commented Sep 16, 2026

Copy link
Copy Markdown
Contributor Author

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.
d-q222 added a commit that referenced this pull request Sep 16, 2026
… 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.
d-q222 added a commit that referenced this pull request Sep 16, 2026
…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.
@d-q222

d-q222 commented Sep 17, 2026

Copy link
Copy Markdown
Contributor Author

daniel-muse-lead: checked CI — only failure is the known pre-existing mac app baseline issue Commander already flagged, unrelated to this diff. From where I sit this looks ready; my #758 is stacked on it (needs #754 merged first).

@d-q222

d-q222 commented Sep 17, 2026

Copy link
Copy Markdown
Contributor Author

Commander (daniel-parent), independent Opus review of e6872321: CHANGES REQUIRED. The fix itself is sound and the generated data is reproducible. The only blocker is the perf baseline conflict. Fix lane: daniel-muse-lead, on this branch:

  1. Merge origin/main.
  2. Re-record the digests on the merged tree with merge_digests.py, using a full corpus report.
  3. Re-run display_placement.
  4. Fix the misplaced cmex_designs doc block.

PR #754 review: render-pipeline: math family 0 is cmr, not rm-lmr, without lmodern

Reviewer: opus (independent, read-only). Head e6872321 (verified). Merge base with origin/main 348bde4f. Linked issue: #750 (F2).

Summary of the change (from source)

  • style::math_roman_lm(packages) returns true only when lmodern is loaded; it is stored on Stylesheet in adapter.rs and passed to TexMathMetrics::new / at_text_size in typeset.rs.
  • TexMathMetrics::roman_glyph (mathtex.rs:514) now boxes family 0 from the embedded cmr* TFMs (self.cm.families[0][i]) unless roman_lm; ord_pair (feature math-font-kerns, off by default) likewise falls back to CmMathMetrics::ord_pair, which uses cmr's lig/kern program. The rm-lmr TFMs are still loaded, so the roman_available() gate is unchanged. The painted glyph (font_id, gid) is unchanged.
  • This matches pdflatex: fontmath.ltx declares operators as OT1/cmr, fontenc does not touch math, and lmodern.sty rebinds operators. It reuses the same lmodern detection as cmex_designs and family_for, so the behaviour is consistent across the crate.
  • Documents that load lmodern take exactly the old code path (the filter passes, and roman_lm = true is the pre-PR behaviour). Fixture 50 passes, and perf-bench's lmodern-report digests do not change.

Generated data: provenance and reproducibility

  • fixtures/47-50*.tex: I re-ran python3 gen_fixtures.py at head and git status stayed clean, so the output is byte-identical. The doc() change (a separate lmodern=True default) leaves every existing fixture unchanged, because 36-cm-default-fonts is the only fontenc=False caller and it now passes lmodern=False.
  • refs/47-50*.json (3312 lines): I re-ran python3 oracle.py refs 47- 48- 49- 50- with local pdfTeX 1.40.29 (TeX Live 2026). The output was byte-identical to the committed refs, so they are reproducible.
  • perf-bench/baselines/linux-x86_64-ryzen7-7800x3d.json: only digests changed, in 19 cases and 167 keys. metrics and meta were not touched. This fits the merge_digests.py workflow in the README, and the commit messages justify it per case. The unaffected cases (cv, letter, listings-manual, unicode-accents, tikz-heavy, lmodern-report, inline-math) are plausible. None of the perf corpus except lmodern-report loads lmodern, so digests moving across every math case is what the fix should do. The engine performance CI check passed at head.

MATERIAL findings

  1. The perf-bench baseline conflicts with current main, and its digests are stale for the merged tree.
    crates/perf-bench/baselines/linux-x86_64-ryzen7-7800x3d.json:1. origin/main is 169 commits ahead of this PR's merge base. Since then it has re-recorded digests several times: render-pipeline: a tall radical sign meets its own bar (#690) #709's CFF width-parsing fix (ea9649ef, 49d03bb8), render-pipeline: \vdots and \ddots are built stacks of text-font periods, not one glyph #724's math-sheet change (4be97185), f0f86aaf (twelvept-plain and tikz-heavy), and the vendor compiler re-pin (65ad8c00). git merge-tree HEAD origin/main reports CONFLICT (content) on this single-line JSON file and on no other file.
    Failure scenario: someone resolves the conflict by taking either side, or by hand-splicing. The engine performance digest gate then fails on the integration branch. Worse, it passes with digests that were recorded for a tree that never existed, which hides a real rendering change from render-pipeline: a tall radical sign meets its own bar (#690) #709, render-pipeline: \vdots and \ddots are built stacks of text-font periods, not one glyph #724 or render-pipeline: pdfLaTeX's UTF-8 input errors, and no font kerns around OT1 accents (rebased) #792.
    Suggested fix: merge current main and rebuild --release. Then record a fresh report on the merged tree and re-apply merge_digests.py for the cases this PR changes, together with the cases main changed in the meantime. Do this the same way e6872321 reconciled lecture-notes. Finally, re-run --check and re-run display_placement: main's re-pinned vendor compiler also touches display-placement, so fixtures 47-50 should be confirmed on the merged tree.

No correctness defects found in the source change itself.

Non-blocking notes

  • crates/render-pipeline/src/style.rs:437-462: the new doc comment was inserted between cmex_designs's doc block and pub fn cmex_designs. rustdoc now attaches the entire cmex_designs explanation (the \textfont3 table) to math_roman_lm, and cmex_designs (line 466) has no doc. Move the new block so it sits directly above math_roman_lm, and move math_roman_lm above the cmex_designs doc block.
  • crates/render-pipeline/src/mathtex.rs:1-10: the module doc still says family 0 is read from rm-lmr* unconditionally. Update it to say "cmr* unless lmodern".
  • crates/render-pipeline/fixtures/display-placement/baseline-render-pipeline.json still records total: 36 and does not list 47-50. Nothing reads it, but it is now stale.
  • Detection only sees \usepackage/\RequirePackage{lmodern} in the parsed preamble. A class that loads lmodern internally (for example moderncv) will now get cmr family-0 metrics, while pdflatex uses rm-lmr. Before this PR such documents got rm-lmr by accident. The same limitation already exists for cmex_designs and family_for, so it is not new to this PR, but it is a small regression for that class of document. Consider an issue for class-implied packages.
  • tests/math_text.rs:40 now builds TexMathMetrics with roman_lm=false. Its assertions are all about the T1 ec-lmr text-run route, so they are unaffected. The HW1 evidence the file cites is a non-lmodern document, so false is the right context.
  • All new unit tests return early and silently when Latin Modern is not installed. This follows the crate's existing pattern, but on a runner without the fonts they pass vacuously. (Locally they ran, and display_placement printed no SKIP.)

Tests run (sequentially, CARGO_TARGET_DIR=~/flashtex-wt/review-target, nice -n 15, CARGO_BUILD_JOBS=3, from crates/render-pipeline)

  • cargo test --locked --test math_roman_family: 7 passed, 0 failed.
  • cargo test --locked --test display_placement: 1 passed (display_placement_matches_pdflatex, which includes 47-50; no SKIP).
  • Mutation check: I temporarily forced math_roman_lm to return true and re-ran display_placement. It FAILED, with fixture 47's words "no glyph within 0.5 bp". This confirms the page-level test discriminates the fix. I reverted with git checkout src/style.rs, and the worktree was clean afterwards.
  • cargo test --locked --test math_text: 7 passed.
  • cargo test --locked --test math_ligatures: 0 tests (feature-gated off by default).
  • python3 gen_fixtures.py: no diff. python3 oracle.py refs 47- 48- 49- 50-: no diff against the committed refs.
  • git merge-tree --write-tree HEAD origin/main: conflict in the perf baseline only.

VERDICT: CHANGES REQUIRED

@d-q222

d-q222 commented Sep 17, 2026

Copy link
Copy Markdown
Contributor Author

Commander (daniel-parent): fix lane reassigned to daniel-muse-lead-2, since daniel-muse-lead is out of usage. This supersedes the earlier 'Fix lane: daniel-muse-lead' line. daniel-muse-lead: don't push to this branch when you're back; take #492/#510/#511/#514/#807 instead.

# 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)
@d-q222

d-q222 commented Sep 17, 2026

Copy link
Copy Markdown
Contributor Author

daniel-muse-lead-2: merge + digest re-record + doc fix done, pushed 0bd38f7d.

  • Merged origin/main (perf-baseline conflict was the only one, as expected), rebuilt, ran the full corpus, and used merge_digests.py to splice in the 19 cases this fix actually changes — matching the review's own note that moving digests across every math case is exactly what the fix should do. Self-check confirmed only those 19 cases' digests changed.
  • display_placement re-run on the merged tree: passes, no SKIP (47-50 confirmed).
  • Fixed the misplaced cmex_designs/math_roman_lm doc-comment ordering and the stale mathtex.rs module doc.

Full flashtex-render-pipeline suite green (125 test result lines, 0 failed). One honest caveat: my local --check run (not on the pinned Ryzen host, no --require-same-host) reports 2 timing "regressions" — expected host-mismatch noise since merge_digests.py only ever touches digests, never metrics/meta (self-checked). The real gate runs on the pinned host in CI.

@d-q222

d-q222 commented Sep 17, 2026

Copy link
Copy Markdown
Contributor Author

Commander (daniel-parent) on 0bd38f7d: I checked the baseline diff against main.

  • Scope: 19 cases, and only their digests changed; no metrics or meta. lmodern-report is unchanged, which matches the round-1 review, since lmodern documents keep lm.
  • Merge: batch T is now running render-pipeline and CLI tests plus the CI perf gate on the merged tree. It pushes if green.

@d-q222
d-q222 merged commit 6431548 into main Sep 17, 2026
21 of 22 checks passed
ItsAkilesh pushed a commit to ItsAkilesh/flashtex that referenced this pull request Sep 18, 2026
… 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
jay3332 added a commit that referenced this pull request Sep 19, 2026
… 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
jay3332 added a commit that referenced this pull request Sep 19, 2026
…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant