Skip to content

compiler: math primes as ^\prime, upright \mathrm, distinct \epsilon/\varepsilon - #174

Merged
jay3332 merged 1 commit into
mainfrom
agent/kabir-claude/math-font-metrics-compiler
Sep 13, 2026
Merged

jay3332 merged 1 commit into
mainfrom
agent/kabir-claude/math-font-metrics-compiler

Conversation

@GoKubar

@GoKubar GoKubar commented Sep 13, 2026

Copy link
Copy Markdown
Contributor

Compiler half of the math font metric fixes. It goes with #172 (math-layout). Base main. No new public types.

Changes

  • Primes. A math ' is now latex.ltx's \active@math@prime (15683-15697). Each following ' adds another \prime (U+2032), and a directly following ^{...} joins the same superscript (f'', g'^2). Before, ' was a literal apostrophe glyph at text size.
  • \mathrm. With a plain argument it is upright Nucleus::Text (fontmath.ltx operators). Before, the group was flattened into italic letters. Spaces in the argument are dropped, as math does.
  • \epsilon / \varepsilon. \epsilon is the lunate U+03F5 (cmmi "0F) and \varepsilon the open U+03B5 (cmmi "22). Before, both were U+03B5, so HW2 set \varepsilon 0.64pt too narrow (reported from render-pipeline: HW1/HW2 residual glyph offsets vs pdflatex #171). The base-14 Symbol route has no lunate glyph and draws both with the open one, in both export::map_char and v1 shaping, so no new warning appears.
  • Supported-LaTeX docs regenerated.

Tests

  • cargo test --release (compiler): all green.
  • New unit test primes_mathrm_and_epsilons_follow_latex.

Pipeline

🤖 Generated with Claude Code

https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu

…\varepsilon

- A math `'` is latex.ltx's `\active@math@prime`: every following `'`
  adds another \prime (U+2032) and a directly following `^{...}` joins the
  same superscript (`f''`, `g'^2`). It was an apostrophe glyph at text size.
- `\mathrm{...}` with a plain argument is upright `Text` (fontmath.ltx
  `operators`), not the italic letters of the surrounding math.
- `\epsilon` is the lunate U+03F5 (cmmi "0F) and `\varepsilon` the open
  U+03B5 (cmmi "22), so TFM layouts box each from its own slot. The base-14
  Symbol route draws both with the open glyph (export map and v1 shaping).
- Unit test `primes_mathrm_and_epsilons_follow_latex`; supported-LaTeX docs
  regenerated.

Implementation-Agent: Claude Opus 5 (subagent kabir-claude math font metrics, 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
@jay3332
jay3332 merged commit b3d5749 into main Sep 13, 2026
11 of 18 checks passed
@GoKubar
GoKubar deleted the agent/kabir-claude/math-font-metrics-compiler branch September 13, 2026 18:12
GoKubar pushed a commit that referenced this pull request Sep 15, 2026
…prime (#278) (#528)

What changed:
- The prime's box geometry already matched pdflatex (compiler #174 and
  math-layout #172): script size, sup shift, one superscript for f'',
  f'^2 joining it, f_1'/x'_a sub+sup. What was wrong was the painted
  glyph. The pipeline drew cmsy "30 with Latin Modern Math's cmap glyph
  for U+2032 (`minute`, ink 430..748/1000 em). That glyph is pre-raised
  for unscripted Unicode use, so at the superscript position it sat
  2.7-3.1bp too high at the bottom and 1.3-1.5bp at the top.
- mathfont.rs reads the face's GSUB `ssty` lookups (AlternateSubst, plus
  Single and Extension). mathtex.rs paints cmsy "30 with the first ssty
  alternate, `minute.st` (ink 96..549, cmsy's unraised design; lmsy7 is
  41..559).
- tests/math_primes.rs pins the pdflatex \showbox oracle (10pt and 12pt,
  inline and display, f'(x) f'' f''' f^{\prime} f'^2 f_1' x'_a) for
  placement, and lmsy7/lmsy8 AFM ink for the prime, at 0.5bp.

What was run:
- cargo test --test math_primes (before fix): test result: FAILED. 1 passed; 1 failed
- cargo test --test math_primes (after): test result: ok. 2 passed; 0 failed
- render-pipeline full suite: every failure (letter_class_geometry 5, uline 2,
  underline_sout 4, xcolor_oracle 1) panics at src/adapter.rs:1261, the
  par-leading debug_assert that open PR #517 fixes; no other failures
- math-layout and compiler: see PR

Next step: re-check the Mac app rendering of f'(x) once this lands.

Implementation-Agent: claude-opus-5 subagent of daniel-parent
Commit-Executor: daniel-parent subagent
Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz
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.

2 participants