Skip to content

render-pipeline: display math placement (leqno, fleqn, \eqno, \tag*, after headings, lists; oracle 19→29/36) - #146

Merged
jay3332 merged 1 commit into
mainfrom
agent/kabir-claude/display-math-placement
Sep 13, 2026
Merged

jay3332 merged 1 commit into
mainfrom
agent/kabir-claude/display-math-placement

Conversation

@GoKubar

@GoKubar GoKubar commented Sep 13, 2026

Copy link
Copy Markdown
Contributor

Display math placement in running text: TeX §1145/§§1199–1205 and amsmath \mathdisplay, measured against pdfLaTeX (MacTeX 2026).

Oracle

crates/render-pipeline/fixtures/display-placement/: 36 fixtures (gen_fixtures.py), pinned pdflatex word positions (refs/), oracle.py check (0.5 bp, multi-page; shares the amsmath corpus word forming). Cargo test tests/display_placement.rs checks the 29 passing fixtures from the pinned refs (never runs TeX).

main 19/36 → branch 29/36. Newly passing: 06 equation leqno, 07 fleqn, 08 fleqn+leqno, 12 $$\eqno$$, 13 $$\leqno$$, 19 itemize display, 21 display after heading, 29 quote display, 31 \tag/\tag*, 35 12pt fleqn+leqno align. Passing on both: short/long preceding line, paragraph start, $$, equation*, gather numbers, page top/bottom/widow, 11pt/12pt, multline, consecutive displays, CM fonts.

Still failing (words within 0.5 bp noted): 09/10/33 too-wide formula — TeX shrinks its glue to z−q (math-layout Glue has no stretch/shrink; math-layout PR needed); 15 \tag{$*$} math in tags (all positions exact, text differs); 17 \numberwithin and 18 subequations (compiler's equation counter is a plain u32; compiler PR needed); 20 nested enumerate label/end-of-list spacing (list lane).

Oracle note: the amsmath corpus reads any candidate ()[]… glyph at 10 bp as a cmex glyph (its fixtures are 12pt); at 10pt body that hid the parentheses of (1). This corpus has no cmex glyphs and disables that classification.

Fixes (render-pipeline only, no vendor edits)

  • leqno (amsmath option, class or package): number at s, formula at s+z−w−d, normal skips (§1203–1204).
  • fleqn: formula at \@mathmargin (\leftmargini), tag right after \hfil or left with \mintagsep (\emdf@R/\emdf@L); $$ stays centred. align/alignat/flalign/gather shift under fleqn/leqno, tags left under leqno.
  • Primitive \eqno/\leqno in $$…$$: number read from source, side from the command.
  • \tag* without parentheses (label text kept as set; counter numbers get \tagform@ parens in the adapter).
  • A display right after a heading sets no empty line (§1145, \@afterheading empties the paragraph), only \parskip; \predisplaysize = −∞.
  • Text after a display carrying \label, and displays inside quote/list items, continue the paragraph (no indent, short skips).
  • Short-skip test is s + d <= \predisplaysize; a too-wide formula no longer forces normal skips.

Gates

  • amsmath corpus 42/42 (unchanged); render-pipeline cargo test --release green.
  • HW1/HW2: display list byte-identical to main (0/686, 0/713 words changed); 0 overfull.
  • Real-world: cv, input-bibliography, lecture-notes, letter, unicode-accents unchanged. article-twocolumn: text after \labelled equation no longer indented, now matches pdflatex (x at column edge, evalu- hyphenation as in the reference). math-sheet: \[ after \section* loses its spurious empty line; gaps between headings move toward pdflatex (Piecewise→Limits ref 87.2 / main 101.5 / branch 87.6); absolute positions stay off because \maketitle is not laid out on main (render-pipeline: \maketitle layout, titlepage, twocolumn title, book matter #114).

🤖 Generated with Claude Code

https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu

…no, \tag*, after headings, lists; oracle 29/36)

Display rules of TeX 1145/1199-1205 and amsmath's \mathdisplay, measured
by a new 36-fixture pdflatex oracle (fixtures/display-placement; main 19/36):

- amsmath leqno: numbers left, normal skips (1203); fleqn: formula at
  \@mathmargin, tags per \emdf@R/\emdf@L; align/gather under both.
- primitive $$ ... \eqno/\leqno $$ numbers (read from source).
- \tag* without parentheses; counter numbers formatted in the adapter.
- a display right after a heading sets no empty line (1145).
- text after a display carrying \label, and displays inside quote and
  list items, continue the paragraph (no indent, short skips).
- the short-skip test is d + s <= \predisplaysize, not a too-wide flag.

Not yet: glue shrink of too-wide formulas (math-layout glue has no shrink),
\numberwithin/subequations (compiler counter), \tag{$..$}, nested list
labels. amsmath corpus 42/42; HW1/HW2 byte-identical to main.

Implementation-Agent: Claude Opus 5 (subagent kabir-claude display math placement, 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.

2 participants