Repository navigation
render-pipeline: math operator names (\sin/\lim/\mathrm) use family 0, not the text font (needs #754 first) - #758
Closed
d-q222 wants to merge 5 commits into
Conversation
What changed:
Named operators set as a run of letters (\sin, \lim, \mathrm{lim})
never went through roman_glyph: shape_run shaped the whole word with
fonts.resolve(family, Role::Text), the document's *text* TFM (ec-lmr*,
or ecrm* under [T1]{fontenc} without lmodern). pdfLaTeX sets these
runs from the operators family (OT1 cmr, rm-lmr with lmodern), whose
metrics differ: cmr10's i is 0.667859 em tall against ec-lmr10's
0.629725.
TextRunMetrics now carries the roman_lm boolean (style.math_roman_lm,
the same flag roman_glyph reads) into shape_run. An operator-name run
(no font key, the run's own italic correction) takes its advances,
height, depth and last italic from family 0 -- the installed rm-lmr*
TFM with lmodern (run through its own program, kerns included), the
embedded cmr designs without it (kerns stay the shaped run's: LM kerns
are rm-lmr's to the fixword). Words a ligature would merge, non-ASCII
words and unknown sizes keep today's metrics. Painting is unchanged:
the run keeps the text face's glyph ids.
The italic-correction and limsup/liminf suites rendered package-less
documents against a T1+lmodern oracle preamble and only passed because
ec-lmr ~= rm-lmr for those letters; their documents now carry that
preamble.
What was run:
cargo test --release -p flashtex-render-pipeline
107 targets ok, 0 failed (full suite, exit 0)
cargo test --release --test math_textrun_family (new)
2 passed: sin/lim boxes at 10/11/12pt, with and without lmodern,
under either text font, against re-measured pdflatex values
python3 oracle.py check --render <fixed flashtex-render> 47- 48- 49- 50-
PASS 4/4, worst 0.005/0.006/0.006/0.005 (unchanged from #754)
Temp sin/lim display fixtures (removed afterwards):
lmodern 23/23 worst 0.005; T1-no-lmodern 22/22 worst 0.005 with 2
unaligned subscript words, identical pre-fix (worst 0.008 there).
Operator words: sin -0.0041/-0.0004, cos +0.0005/+0.0004,
lim -0.0002/+0.0002 bp vs pdflatex; flashtex CLI exit 0, identical.
Mutation check: with the transplant disabled the new tests fail with
the exact pre-fix boxes (lim 13.96296/6.88875 vs 13.88893/6.94444,
sin 12.34998/6.29725 vs 12.2778/6.67859 at 10pt); restored: 2 passed.
Stacked on PR #754 (agent/daniel-parent/display-box-height); a PR
from this branch must use --base that branch, not main.
Implementation-Agent: muse-spark-1.3-contributor
This was referenced Sep 16, 2026
…height' into agent/daniel-muse-lead/textrun-family0
… 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.
…height' into agent/daniel-muse-lead/textrun-family0 # Conflicts: # crates/perf-bench/baselines/linux-x86_64-ryzen7-7800x3d.json
…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.
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
jay3332
added a commit
that referenced
this pull request
Sep 19, 2026
… operator-name family 0 73 digest keys over 11 cases, recorded from a --release build of this lane and merged with `merge_digests.py` (only the named cases; `metrics`/`meta` untouched). Attribution, verified against each PR's own re-record: - #739 (real /Link annotations in the exported PDF): `export.pdf` of the four fixtures that contain \href or \url — conf-paper, cv, hyperref-toc, listings-manual (3 keys here; hyperref-toc's overlaps below). - #758 (math operator names \sin/\lim/\mathrm set in family 0, not the text font): the same 8 cases / 70 keys #758's own commit 21ce795 re-recorded — hyperref-toc, input-bibliography, lecture-notes, math-heavy, math-sheet, plain-article, ps-calculus, twelvept-plain. origin/main (f7f89b0) gates clean against the committed baseline with the same build and font configuration, so every moved key is from these two merges; after the merge the lane's report gates clean (0 output changes, 549 metrics compared). 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
…he integration batch + package definitions The pin reads main again after the second integration pass (#827 cherry-picks, #863, #950, #737/#739/#758/#732/#740/#825, visual-oracle tooling) and the `metadata.packages` work (`crate::package_definitions`, tex-expansion's `package_defs.rs`). `git archive` of this tree's `crates/compiler` and `crates/tex-expansion`, PINs at the merge commit, VENDORING.md rows updated, `scripts/check-vendor-pins.sh` both "up to date". render-pipeline 819/0 in both profiles against the new pins; compiler 1368/0, tex-expansion 150/0 release; Mac inventory sync current; swift build clean. Implementation-Agent: Claude Code (mac-claude-a) Commit-Executor: git via Claude Code Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01Y1nAv4pEnmMYXgteBoadHn
Member
|
Merged into main 2d6ac3e (merge commit on the integration branch; GitHub does not detect it because this PR's base is a stacked branch, whose content is already on main). |
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 — depends on #754 merging first (this branch is stacked on
agent/daniel-parent/display-box-height).Scope
Same bug as #754, different code path: named math operators set as a run of
letters (
\sin,\lim,\mathrm{lim}) go throughshape_run/TextRunMetrics(
crates/render-pipeline/src/mathtext.rs), a completely separate path from#754's
roman_glyph(per-glyph math family 0). This run shaped the wholeword with the document's text TFM (
fonts.resolve(family, Role::Text{...}, size)), never checking thelmodern/family-0 distinction #754 established:\DeclareSymbolFont{operators}{OT1}{cmr}{m}{n}only moves tolmrwhen thedocument loads
lmodern;[T1]{fontenc}alone never touches math.Fix:
TextRunMetricsnow carries the sameroman_lm: bool(
style.math_roman_lm)roman_glyphreads, threaded in at its oneconstruction site in
typeset.rs. A newRomanSourceinmathtext.rspicks the same two fonts
roman_glyphdoes (installedrm-lmr*withlmodern, embeddedcmrdesigns without it) for an operator-name run'sadvances/height/depth/last-italic. Painting is unchanged (glyph ids stay
the text face's) — width/height/depth-only fix, matching #754's own
constraint.
Also found and fixed, beyond what was asked: a 0.12 bp
lmodern-loaded\limheight error at 12pt (ec-lmr12'slvsrm-lmr12's) that theoriginal finding didn't mention — same root cause, same fix.
Overlap check
Render-pipeline only (
mathtext.rs, one line intypeset.rs, 3 existingtest files updated + 1 new). No changes to
crates/math-layout/,crates/font-engine/,crates/font-resources/, orcrates/compiler/.roman_glyph/math_roman_lmreused, not duplicated.Test results
New
tests/math_textrun_family.rs:\sin/\limboxes at 10/11/12pt, withand without
lmodern, against pdflatex values re-measured independently(not copied from the assignment) via
\wd/\hton real\hbox{$\sin$}etc., pdfTeX 1.40.29, TeX Live 2026.
Independently re-verified by the supervisor (fresh
CARGO_TARGET_DIR):cargo test --test math_textrun_family: 2 passed, 0 failed.the wrong call site —
typeset.rs's production plumbing, which thisparticular unit-style test bypasses by calling
TextRunMetrics::newdirectly; retargeted to
mathtext.rs'sroman_sourcefunction itself):forced the
lmodernbranch off — both tests fail with the exact pre-fixcmrmetrics (\sin is 12.2778/6.6786 pt, pdflatex 12.34996/6.29724);restored,
git diffempty, 2/2 pass again.crates/render-pipelinesuite in release mode (fresh targetdir): all suites green, 0 failures.
flashtex-clirelease binary, checked$\sin x$+display
\sin/\limagainst real pdflatex, T1 andlmodernvariants —within 0.005 bp (lane's own report, matches the supervisor's spot-check
of the test file's own oracle table).
Not done
Nothing else in scope. Two follow-ups noted by the lane, not part of this
slice: the
n→∞subscript-extraction granularity behind 2 unalignedcomparison words in one CLI check (pre-existing, unrelated to this fix); a
future vendor re-pin could simplify the kern-preservation fallback to a
direct OT1 program query once
lig_kern/ot1_text_slotland in thevendored
math-layoutmirror.🤖 Generated with Claude Code