Skip to content

FT-061 finish: \intertext, \xrightarrow, math \quad width (amsmath oracle 42/42) - #109

Closed
GoKubar wants to merge 2 commits into
agent/kabir-claude/amsmath-inlinefrom
agent/kabir-claude/amsmath-inline-2
Closed

GoKubar wants to merge 2 commits into
agent/kabir-claude/amsmath-inlinefrom
agent/kabir-claude/amsmath-inline-2

Conversation

@GoKubar

@GoKubar GoKubar commented Sep 13, 2026

Copy link
Copy Markdown
Contributor

FT-061 finish (kabir-claude). Stacked on #103 (agent/kabir-claude/amsmath-inline @ 9cc8419).

Oracle (crates/compiler/tests/amsmath_corpus, pdflatex refs)

fixture #103 this PR
total 40/42 42/42
25-intertext FAIL 42.058 bp PASS 0.006 bp
28-xrightarrow FAIL 11.676 bp PASS 0.005 bp
37-spacing-thin PASS 0.378 bp PASS 0.005 bp
38-quad-qquad PASS 0.380 bp PASS 0.006 bp

Measured as in #103: render-pipeline with vendor/compiler and vendor/math-layout swapped for this branch's crates, --features amsmath-inline (a local mirror; no vendor changes committed).

Changes

  • Math \quad: \quad is \hskip1em (latex.ltx). In math, em is \fontdimen6 of the text font, at the text size in every style, not 18 mu. Compiler Space gets font_em (\quad, \qquad, \tag's 2\quad). The pipeline scales it by text quad / family-2 quad.
  • \xrightarrow[below]{above}, \xleftarrow, mathtools \xleftrightarrow (amsmath.sty 971-979 \arrowfill@, 1012-1028 \ext@arrow):
    • compiler: new ExtArrow nucleus (a relation)
    • math-layout: Nucleus::ExtArrow. The arrow is its natural width (left piece, -7mu, \cleaders fill, -7mu, right piece; muskips zeroed; \relbar smashed), or stretched to the widest \scriptstyle\mkern#3mu{label}\mkern#4mu. Stretching adds centred leaders (tex.web §626). The labels are set as \mathop\limits limits, using make_op's limit code, now split out as op_scripts.
  • \intertext / mathtools \shortintertext:
    • compiler: MathRow.intertext holds the paragraphs set before a row. A row that already has material is ended first (\ifvmode\else\\\fi).
    • render-pipeline rows_block (feature amsmath-inline) sets each one as a \noindent paragraph between the rows.
    • Skips without mathtools: \belowdisplayskip / \abovedisplayskip (amsmath.sty 1186-1199).
    • Skips with mathtools: -\jot on each side, 3pt seps, and the short skips for \shortintertext (mathtools.sty 1424-1448, 1502-1528).
    • Lines inside one intertext keep \normalbaselines.
  • Oracle: glyphs whose origins are within 0.05 bp of each other are now ordered by text. An unstretched arrow's \relbar and arrow head are 0.002 bp apart, below pdfTeX's TJ quantisation, so the two sides sorted them differently. Refs were regenerated with the same pdfTeX; only 28-xrightarrow.json changed (two words swapped).
  • Supported-LaTeX inventory and its generated artefacts now list the three arrows.

Verification

Known limits

  • The intertext skips are natural only: vskip_after carries no stretch or shrink. That is exact under article's \raggedbottom.
  • A hyphenated intertext line's hyphen run is drawn but has no box record.
  • \xLeftarrow/\xRightarrow/\xhookrightarrow and the other mathtools arrows are not included; they need \ labels or joined pieces.

Re-pin note from #103 still applies: showing this in the app needs vendor/compiler and vendor/math-layout re-pinned and amsmath-inline enabled.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu

GoKubar and others added 2 commits September 13, 2026 05:12
latex.ltx \quad is \hskip1em; in math mode em is \fontdimen6 of the
text font current outside the formula, at the text size in every style.
The compiler marks such glue (Space.font_em: \quad, \qquad, \tag's
2\quad); render-pipeline (feature amsmath-inline) scales it by the text
quad over the family-2 quad. amsmath oracle 37: 0.378 -> 0.005 bp,
38: 0.380 -> 0.006 bp.

Implementation-Agent: Claude Opus 5 (subagent kabir-claude FT-061 finish, 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
\xrightarrow[below]{above}, \xleftarrow and mathtools' \xleftrightarrow
(amsmath.sty 971-979 \arrowfill@, 1012-1028 \ext@arrow): compiler nucleus
ExtArrow (a relation); math-layout Nucleus::ExtArrow builds the arrow at
its natural width (left piece, -7mu, \cleaders fill, -7mu, right piece,
muskips zeroed, \relbar smashed) or stretched to the widest
\scriptstyle\mkern#3mu{label}\mkern#4mu with centred leaders (tex.web
section 626), then sets the labels as \mathop\limits (make_op's limit code,
split out as op_scripts).

\intertext and mathtools \shortintertext: MathRow.intertext holds the
paragraphs set before a row (a row with material is ended first, as
\ifvmode\else\\\fi does). render-pipeline (feature amsmath-inline) sets
each as a \noindent paragraph between the rows with amsmath's
\belowdisplayskip/\abovedisplayskip (amsmath.sty 1186-1199), or mathtools'
variants when mathtools is loaded (-\jot on each side, 3pt seps and the
short skips for \shortintertext; mathtools.sty 1424-1448, 1502-1528).
Lines inside one intertext keep \normalbaselines.

Oracle: glyphs whose origins coincide within 0.05 bp are ordered by text
(the \relbar and arrow head of an unstretched arrow sit 0.002 bp apart,
below pdfTeX's TJ quantisation); refs regenerated, only 28 changed.

amsmath oracle: 40/42 -> 42/42 (25-intertext 42.058 -> 0.006 bp,
28-xrightarrow 11.676 -> 0.005 bp). HW1/HW2 within 0.5 bp: 268/251,
unchanged. Supported-LaTeX artefacts regenerated.

Implementation-Agent: Claude Opus 5 (subagent kabir-claude FT-061 finish, 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
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