Skip to content

render-pipeline: rich \tag placed as amsmath does — margin, leqno, own line, align/gather/multline (#441 PR 2; needs re-pin past #470) - #585

Merged
jay3332 merged 10 commits into
mainfrom
agent/daniel-parent/tag-placement-pipeline
Sep 19, 2026
Merged

jay3332 merged 10 commits into
mainfrom
agent/daniel-parent/tag-placement-pipeline

Conversation

@d-q222

@d-q222 d-q222 commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

Draft: needs re-pin past #470. This is PR 2 of 2 for #441, by daniel-parent (claim GH-441-TAG-PLACEMENT-PIPELINE). It is stacked on #470 (agent/daniel-parent/tag-textrun, merged with current main), so the diff includes #470's compiler and math-layout changes until that PR lands.

What

render-pipeline, feature compiler-text-run (off by default; it becomes a one-line default once vendor/compiler and vendor/math-layout are re-pinned past #470 and this branch's compiler commit):

  • TextRun conversion. The compiler's Nucleus::TextRun becomes math-layout's TextRun:
    • Text pieces are shaped text handles. \textbf/\emph/\textit pieces use their text font, and slanted pieces get \check@icr's italic correction.
    • Inline formulas are their own lists at \textstyle, or the script style they sit in.
    • hash_math, shift_math, math_grids, math_glue_em and math_approximations walk the nested lists.
  • Rich tags (\tag{hi $x^2$}, \tag{\textbf{B} $y_1$}, \tag*{[$n+1$]}):
    • strip_tag keeps the label as a one-atom math list, trimmed like \tagform@'s \ignorespaces…\unskip.
    • The label is set as \maketag@@@'s \hbox. It goes through the same flush-right, leqno, too-wide (§1199–1202 \eqno) and row placement as a plain number.
    • The compiler's interim 2-quad gap is dropped with the tag atoms, so the pipeline's placement replaces it.

Not feature-gated (these paths are already on main):

  • multline sets its one tag on the last line, or on the first line under leqno. That line gets \multlinetaggap + tag width.
  • Tags too wide for their row in align/gather: when \calc@shift@align/\calc@shift@gather moves a tag off its row, it now goes on a line of its own:
    • below the row (\place@tag's \vtop of \lineht@ and \strut@ tag);
    • above the row under leqno.
    • The line extents make the interline glue on both sides equal TeX's glue for the one taller row, whichever of \baselineskip/\lineskip applies.
    • Before, the tag stayed on the row's baseline with a math_limitation warning.
  • A verbatim line break now goes through line_break_inline, so the crate builds with linebreak-skip.

compiler (a separate commit, 1b6f03f2): a \tag in an align/gather/multline row replaces that row's number.

  • The counter no longer steps, and a \label on the row takes the tag (amsmath \df@tag).
  • A multline has one tag wherever \tag is written.
  • Before, a &= b \tag{$a_1$} \\ c &= d numbered the second row (2) where pdflatex gives (1).

Fixtures: display-placement 37–48 with pdflatex refs. tests/display_placement.rs checks them under the feature.

Why

#441 acceptance criteria from review lane-441-2: flush-right tag placement with a right-margin oracle, leqno, too-wide tags, tags in align/gather/multline, rich tags, \tag*, the amsmath corpus at 59/59, and HW1/HW2 unchanged.

Oracle (pdflatex TeX Live 2026, 0.5 bp)

All tags from the display-placement fixtures (oracle.py check, words aligned ref↔candidate). Columns:

  • dist: distance of the tag's first-word origin from the right margin (R), or from the left margin for leqno (L), in bp.
  • y: the baseline, in bp.
fixture tag word side pdflatex dist FlashTeX dist dx pdflatex y FlashTeX y dy
31-tag-equation (A) R 15.223 15.221 +0.002 146.720 146.720 -0.000
37-rich-tag-equation (hi R 29.539 29.535 +0.004 146.720 146.720 -0.000
37-rich-tag-equation (∗) R 12.734 12.730 +0.004 176.608 176.608 -0.000
37-rich-tag-equation (B R 28.574 28.573 +0.001 206.496 206.496 -0.000
38-rich-tag-star ± R 29.887 29.888 -0.001 146.720 146.720 -0.000
38-rich-tag-star [n R 28.671 28.672 -0.001 176.608 176.608 -0.000
39-rich-tag-leqno (hi L 0.000 0.000 +0.000 156.682 156.682 +0.000
40-align-rich-tags (a R 17.488 17.484 +0.004 156.682 156.682 +0.000
40-align-rich-tags (1) R 12.726 12.730 -0.004 171.626 171.626 +0.000
40-align-rich-tags (step R 38.807 38.806 +0.001 186.570 186.570 +0.000
41-gather-rich-tags (∗) R 12.732 12.730 +0.002 156.682 156.682 +0.000
41-gather-rich-tags (1) R 12.730 12.730 -0.000 171.626 171.626 +0.000
41-gather-rich-tags (ii R 22.589 22.584 +0.005 186.570 186.570 +0.000
42-multline-tag (M R 25.898 25.896 +0.002 189.559 189.559 +0.000
43-multline-tag-leqno (∗) L 0.000 0.000 +0.000 159.671 159.671 +0.000
45-text-math-display (i) R 11.593 11.590 +0.003 176.608 176.608 -0.000
46-align-wide-tag-own-line (a R 60.488 60.488 -0.000 168.638 168.638 -0.000
46-align-wide-tag-own-line (1) R 12.730 12.730 +0.000 196.533 196.533 +0.000
47-gather-wide-tag-own-line (tag R 51.501 51.501 -0.000 168.638 168.638 -0.000
47-gather-wide-tag-own-line (1) R 12.731 12.730 +0.001 184.578 184.578 -0.000
48-gather-wide-tag-leqno (1) L 0.003 0.000 -0.002 156.682 156.682 +0.000
48-gather-wide-tag-leqno (tag L 0.000 0.000 +0.000 172.623 172.623 -0.000

22 tags, worst |dx| and |dy| 0.005 bp. Fixture 44 (a rich tag too wide for its line, which drops onto a line of its own) and fixture 33 also pass word-for-word.

Test results

The scratch copy is crates/render-pipeline with vendor/compiler and vendor/math-layout replaced by this branch's crates. Nothing under vendor/ is committed.

  • display-placement/oracle.py check: TOTAL 45/48 within 0.5 bp. Fixtures 37–48 all PASS (worst 0.005 bp).
    • 15, 17 and 20 fail as on main. 15's \tag{$*$} and its \eqref are now placed within 0.005 bp, but math * extracts as *, not cmsy's ∗, so the words don't align.
    • Baseline (main's vendor, unchanged pipeline): TOTAL 33/36 within 0.5 bp.
  • crates/compiler/tests/amsmath_corpus/oracle.py check: TOTAL 59/59 within 0.5 bp.
  • cargo test --release --features linebreak-skip,compiler-text-run (scratch): 79 test result: ok. lines, 0 failed. Lib: 137 passed; 0 failed; 2 ignored; display_placement 1 passed (48 fixtures).
  • Default features against main's vendor: cargo check --tests finishes with no errors. The oracle is unchanged for 01–36 (TOTAL 33/48, where the only new failures are 37–48, which need the re-pin).
  • cargo test --manifest-path crates/compiler/Cargo.toml: 58 test result: ok. lines, 0 failed (lib 339 passed, text_runs 16 passed).
  • HW1, HW2, math-sheet, ps-calculus and lecture-notes: every glyph word is identical between the baseline and candidate renders (for example HW2.tex: pages 3/3 words 713/713 differing 0).
  • HW2: the ignored crates/compiler/tests/hw2_gate.rs is not tag-related. HW2.tex has no \tag or \text, and the ignore reason is main setting HW2 on 4 pages. It stays ignored. The render-pipeline hw2_sets_three_pages_with_the_reference_breaks test is not ignored and passes.

Overlap check

Not done

🤖 Generated with Claude Code

https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz

What changed:
- Added compiler regression tests for nested math in tags/text, text styles, unsupported commands, tag glue, and eqref labels.
- Added math-layout width/style-size regression tests.

What was run:
- test result: FAIL (expected): CARGO_TARGET_DIR=/Users/dqi26/flashtex/target-tag cargo test --manifest-path crates/compiler/Cargo.toml --test text_runs
- test result: FAIL (expected): CARGO_TARGET_DIR=/Users/dqi26/flashtex/target-tag cargo test --manifest-path crates/math-layout/Cargo.toml --test text_runs

Next step:
- Add the minimal text-run IR and parser/layout support.

Implementation-Agent: codex gpt-5.6-luna (max)

Commit-Executor: codex (this session)

Lane-Owner: daniel-parent (mac-m5pro-dq222)
What changed:
- Add compiler and math-layout TextRun/TextPiece IR while retaining plain Nucleus::Text output.
- Parse nested dollar and parenthesized math, text faces, tags, starred tags, and custom eqref labels.
- Lay out nested math in text-size hboxes and recurse through incremental/source-span paths.

What was run:
- test result: ok. 6 passed; 0 failed; compiler text_runs
- test result: ok. 8 passed; 0 failed; supported_latex inventory
- test result: ok. 12 passed; 0 failed; math-layout unit tests
- test result: ok. 28 passed; 0 failed; math-layout golden tests
- test result: ok. 2 passed; 0 failed; math-layout text_runs
- test result: ok. 327 passed; 0 failed; compiler unit tests
- test result: ok. 2 passed; 0 failed; corpus_gate
- test result: ok. 4 passed; 0 failed; hw1_preamble
- test result: ok. 1 passed; 0 failed; 1 ignored; hw2_gate
- test result: ok. render-pipeline vendored build
- test result: ok. pdflatex oracle widths 21.86809pt, 5.00002pt, 56.61810pt

Next step:
- Push this green PR1 step; leave render-pipeline rich display-list integration for PR2.

Implementation-Agent: codex gpt-5.6-luna (max)
Commit-Executor: codex (this session)
Lane-Owner: daniel-parent (mac-m5pro-dq222)
This addresses the independent review of 25c63aa.
- Restores main's 2-quad tag gap as INTERIM_TAG_GAP_EM until PR 2 places tags
  flush right, so \\tag{1} is no longer glued to the formula.
- \\text inside math inside \\text shares MAX_MATH_DEPTH and is diagnosed at
  depth 40 instead of overflowing the stack.
- \\eqref to a rich \\tag{hi $x^2$} resolves to the flattened tag text (hi x²).
  References carry strings, which is documented as a limitation.
- End-to-end parser and layout tests: tag widths, \\textbf{$x$}, unbalanced $,
  an unsupported command inside $, \\tag* and \\eqref.
The automatic equation number with \\tag is unchanged; main shows it too.

What was run (full crates): cargo test --manifest-path crates/compiler/Cargo.toml
and crates/math-layout/Cargo.toml. Every test result is ok (compiler lib 327
passed).

Implementation-Agent: codex gpt-5.6-luna (max), session 01a0a148-e56e-7722-b0a8-0436a343ed75 (resumed)
Commit-Executor: daniel-parent (the resumed Codex session cannot write .git)
Lane-Owner: daniel-parent (mac-m5pro-dq222)
Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz
…ag-textrun

# Conflicts:
#	crates/compiler/src/parser.rs
…ls and fractions; \\cref on tagged equations

This is the final fix round from the second independent review.
- \\tag* no longer strips parentheses, so \\tag*{(custom)} + \\eqref gives ((custom)).
- Flattening for \\eqref uses rendered glyphs where one exists (alpha_1 gives the Greek
  letter with a subscript one) and falls back to source text for radicals and
  fractions, never dropping them.
- Regression test: \\cref on a \\tag{A} equation gives eq. (A).
- The 24.88pt width assertion is labelled a legacy Core14 compiler-route pin, not
  a pdflatex oracle (pdflatex 29.64589pt; the real comparison is PR 2).

What was run (full crates): cargo test for crates/compiler and crates/math-layout.
Every test result is ok (compiler lib 334 passed).

Implementation-Agent: codex gpt-5.6-luna (max), session 01a0a148-e56e-7722-b0a8-0436a343ed75 (resumed)
Commit-Executor: daniel-parent (the resumed Codex session cannot write .git)
Lane-Owner: daniel-parent (mac-m5pro-dq222)
Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz
…ag-textrun

# Conflicts:
#	crates/compiler/src/math.rs
…441)

What changed:
- multirow_environment parses each row's cells before numbering it. A row
  carrying \tag (or \tag*) no longer steps the equation counter, and a
  \label on it takes the tag text (amsmath's \df@tag: \incr@eqnum never runs
  for a tagged row). pdflatex numbers `a &= b \tag{$a_1$} \\ c &= d` as
  (a1), (1); the compiler gave (a1) and (2), which renumbered every later
  equation.
- multline has one tag wherever \tag is written: with one, no row is
  numbered.
- INTERIM_TAG_GAP_EM's comment: the render pipeline drops the gap with the
  tag atoms and places the tag at the margin; the gap stays only on the
  compiler's own layout route.
- tests/text_runs.rs: tagged_align_and_gather_rows_do_not_step_the_equation_counter,
  a_tag_on_any_multline_row_replaces_the_display_number.

What was run:
- cargo test --manifest-path crates/compiler/Cargo.toml: 58 "test result: ok." lines, none failed
  (lib "339 passed; 0 failed", text_runs "16 passed; 0 failed").

Next step: the render-pipeline half (compiler-text-run feature) in the next commit.

Implementation-Agent: claude-opus-5 subagent of daniel-parent
Commit-Executor: daniel-parent subagent
Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz
…h does (#441, PR 2)

What changed (feature `compiler-text-run`, off until vendor/ is re-pinned past #470):
- The compiler's Nucleus::TextRun is converted to math-layout's TextRun: text
  pieces are shaped text handles (\textbf/\emph in their text font, with
  \check@icr's italic correction for slanted pieces), inline formulas are
  their own lists at \textstyle. hash_math, shift_math, math_grids,
  math_glue_em and math_approximations walk the nested lists.
- strip_tag keeps a rich tag (\tag{hi $x^2$}, \tag*{...}) as a one-atom math
  list, trimmed like \tagform@'s \ignorespaces/\unskip, and the display and
  row paths set it as \maketag@@@'s \hbox (Context::math_number_box) in place
  of the plain word boxes. The compiler's interim 2-quad gap is dropped with
  the tag atoms, as before.
- Not feature-gated (fixes on main's own paths):
  - multline sets its one tag on the last line, or the first under leqno,
    with \multlinetaggap + tag width on that line.
  - An align/gather tag that \calc@shift@align/\calc@shift@gather moves off
    its row is now set on a line of its own: under the row (\place@tag's
    \vtop of \strut@ tag and \lineht@) or above it with leqno. The line
    extents are chosen so the interline glue matches TeX's for the one taller
    row. This was a math_limitation warning with the tag left on the row.
  - adapter: the verbatim line break goes through line_break_inline, so the
    crate builds with linebreak-skip.
- display-placement fixtures 37-48 (rich tags; \tag*; leqno;
  align/gather/multline tags; a rich tag too wide for its line; \text with
  math; shifted tags), with pdflatex refs. tests/display_placement.rs checks
  them under compiler-text-run.

What was run (scratch copy of crates/render-pipeline with vendor/compiler and vendor/math-layout = this branch's crates; vendor/ not committed):
- display-placement oracle.py check: "TOTAL 45/48 within 0.5 bp" (37-48 all PASS, worst 0.005 bp; 15, 17, 20 fail as on main: 15's tag is placed exactly but math `*` extracts as `*`, not cmsy `∗`)
- amsmath_corpus oracle.py check: "TOTAL 59/59 within 0.5 bp"
- baseline (unchanged pipeline, main's vendor): "TOTAL 33/36 within 0.5 bp", "TOTAL 59/59 within 0.5 bp"
- cargo test --release --features linebreak-skip,compiler-text-run (scratch): 79 "test result: ok." lines, 0 failed (lib "137 passed; 0 failed; 2 ignored")
- cargo check --tests (default features, main's vendor): Finished, no errors
- HW1/HW2/math-sheet/ps-calculus/lecture-notes: every word identical between the baseline and candidate renders

Next step: re-pin vendor/compiler and vendor/math-layout past #470 and this branch's compiler commit, then make compiler-text-run a default feature.

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 15, 2026 •

Copy link
Copy Markdown
Contributor Author

daniel-parent independent review (subagent)

Verdict: APPROVE (logic/tests look sound to merge once re-pinned; this is a draft, explicitly pending the vendor re-pin past #470, and the PR's own "Not done" list reads accurate)

  1. Staleness vs compiler + math-layout: \tag and \text can contain math — a TextRun nucleus with nested $…$ (#441, PR 1 of 2) #470: git merge-base HEAD origin/agent/daniel-parent/tag-textrun equals compiler + math-layout: \tag and \text can contain math — a TextRun nucleus with nested $…$ (#441, PR 1 of 2) #470's current tip (976ce70c), i.e. that tip is an ancestor of this branch. compiler + math-layout: \tag and \text can contain math — a TextRun nucleus with nested $…$ (#441, PR 1 of 2) #470 has not moved since this branch stacked on it — no rebase needed before re-pin.

  2. Scratch-vendor build (uncommitted only): rsync'd crates/compiler/ and crates/math-layout/ over crates/render-pipeline/vendor/{compiler,math-layout}/ in a throwaway worktree; git status confirmed exactly the expected 12 modified + 3 untracked files under vendor/, nothing else. cargo test --release --manifest-path crates/render-pipeline/Cargo.toml --features linebreak-skip,compiler-text-run reproduced the PR's own numbers exactly: 79 test result: ok lines, 0 failed anywhere, lib 137 passed; 2 ignored, display_placement 1 passed.

  3. Independent oracle reproduction: regenerated pdflatex refs myself (TeX Live 2026, /Library/TeX/texbin/pdflatex) for fixtures 31 (plain equation), 39 (leqno), 40 (align), 41 (gather), 42 (multline) — byte-identical to the PR's committed JSON refs. Built flashtex-render with the same features and ran oracle.py check: 5/5 pass, worst 0.005 bp. Also ran the full 48-fixture suite: TOTAL 45/48, matching the PR's claim exactly — same pre-existing unrelated failures (15, 17, 20), all of 37-48 (every new tag fixture) pass.

  4. Default-features build (no overlay): cargo check --tests --manifest-path crates/render-pipeline/Cargo.toml against main's actual pinned vendor builds clean, no errors, confirming the feature is genuinely inert until the re-pin.

  5. render-pipeline: amsmath \sideset via math-layout left scripts (stacked on #581; needs re-pin) #582 discriminant collision check: fetched origin/agent/daniel-parent/sideset-pipeline directly (not just the PR prose) and confirmed its Nucleus::SideSet arm in hash_math hashes 17u8; this PR's Nucleus::TextRun arm hashes 18u8. No collision.

  6. Row-tag-replaces-number logic (parser.rs): for align/gather, tag = display_tag.clone().or(row_tag) with display_tag computed only for multline, so align/gather apply a tag per-row (counter only steps for untagged rows; a \label on a tagged row gets the tag text) while multline applies the single found tag/number uniformly to every row — correctly matching real amsmath (multline has one number for the whole display; align/gather number per row). This resolves the PR's own worked example (a&=b\tag{$a_1$}\\c&=d → row 2 is (1)) and is backed by structural assertions (tagged_align_and_gather_rows_do_not_step_the_equation_counter, a_tag_on_any_multline_row_replaces_the_display_number), not smoke tests. crates/compiler/tests/text_runs.rs additionally has explicit round-trip tests eqref_uses_a_custom_tag_as_the_label_value and eqref_uses_rich_starred_and_plain_tag_values covering custom/rich/starred \tag + \label + \eqref resolution end-to-end, all passing — the label-takes-tag path is genuinely test-covered, not just asserted in the PR body.

  7. Fixtures 37-48 aren't smoke tests: they're checked at real word-position level via the oracle (0.5 bp gate, 0.005 bp observed), and text_runs.rs asserts on parsed label/number structure directly.

  8. Minor, non-blocking: strip_tag/trim_tag_pieces (adapter.rs) recover a tag's bare label by string-level strip_prefix('(')/strip_suffix(')') rather than a structural marker, relying on parser.rs always wrapping non-starred \tag content with dedicated "("/")" pieces. Consistent on both sides and test-covered, but a user tag with its own unbalanced literal parens is an unexercised edge case worth a regression test eventually.

No logic bugs found. Per the review brief, the outstanding re-pin and default-feature wiring aren't held against this draft — the tag-placement logic itself is ready to land once #470 is re-pinned.

Notes:

  • Could not independently re-run the amsmath_corpus (59/59) and HW1/HW2 fidelity claims — the isolated worktree was removed by another process on this shared machine partway through the review, after the render-pipeline suite and display-placement oracle work above (the parts that actually exercise this PR's new code) had already completed and been recorded.
  • Caveat for context: an independent review of the same author's compiler: em/ex follow the active font, \hspace keeps its trailing space, \global length prefixes #587 (posted separately) found real cases where a claimed pdflatex reference value was wrong and where a claimed-invalid TeX construct actually compiles fine under real pdflatex — so the author's stated pdflatex numbers aren't unconditionally reliable in general. For this PR specifically, though, from-scratch pdflatex regeneration matched the checked-in refs and the placement numbers exactly (point 3 above), so there's no concrete evidence of a similar problem here.

d-q222 added a commit that referenced this pull request Sep 15, 2026
…he readiness merges

What changed:
- New docs/integration/repin-runbook.md covers the re-pin step by step:
  - the vendor copy commands for compiler, pdf, math-layout, tex-expansion, project-files and the new bibliography mirror;
  - the lockfile regeneration for render-pipeline and flashtex-cli (no Cargo.toml dependency line needed for bibliography);
  - the required default features: linebreak-skip, amsmath-sideset, compiler-text-run;
  - the optional features, the ignored test to restore, and the VENDORING.md rows to update;
  - the expected compile and test results, and the known remaining failures with owners.
- docs/integration/daniel-parent-preview.md:
  - corrects the bibliography row: the compiler depends on ../bibliography since #558;
  - records the #569/#584/#599/#582/#585 conflict resolutions and the HSpace fix.

What was run (scratch re-pin, vendor from c47e145, CARGO_BUILD_JOBS=4, never committed):
- render-pipeline cargo test --release --no-fail-fast: all binaries ok, 466 passed, 0 failed, 3 ignored
- page_para_control: test result: ok. 19 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.04s
- flashtex-cli cargo test --release: ok. 31 passed; 0 failed / ok. 26 passed; 0 failed; 1 ignored
- amsmath TOTAL 59/59 within 0.5 bp; amssymb TOTAL 38/39 within 0.5 bp; tabular TOTAL 128/128 (words 0.5 bp, rules 0.1 bp); display-placement TOTAL 47/48 within 0.5 bp

Next step:
- Integration lane applies the runbook after the queue merges.

Implementation-Agent: claude-opus-5 subagent of daniel-parent
Commit-Executor: daniel-parent subagent
Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz
GoKubar added a commit that referenced this pull request Sep 15, 2026
… (#646)

* render-pipeline: tabular lengths keep their group scope; \small survives a float caption; @{} glue (#56)

What changed:
- Table lengths (\tabcolsep, \arrayrulewidth, \doublerulesep, \extrarowheight,
  and longtable's) are read as seen at the table: only assignments whose
  group ({...}, \begingroup, an environment) is still open count, in every
  form (\setlength{\x}{v}, \setlength\x{v}, \addtolength, \x=v). The old
  scan took the last brace-form \setlength anywhere in the file.
- A float-level size declaration (\small before \caption) is carried into
  later content runs, as \@caption's \normalsize is inside its own group.
- @{...} material keeps glue at both ends (@{\hspace{1em}}, @{\quad}).
- \hspace{<n>em} is set as <n> quads of the current font, not the
  compiler's fixed-size em.
- 17 new tabular corpus fixtures (107-123) with pdflatex references.

What was run:
- oracle.py check: main 117/123, this branch 123/123 (words 0.5 bp, rules 0.1 bp)
- cargo test --release (render-pipeline): 79 test binaries ok, 0 failed
- tabular_oracle: test result: ok. 1 passed; 0 failed
- lib: test result: ok. 140 passed; 0 failed; 2 ignored

Next step: compiler PR accepting table length assignments without the
"not implemented here" warning / unknown \tabcolsep error.

Implementation-Agent: claude-opus-5 subagent of daniel-parent
Commit-Executor: daniel-parent subagent
Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz

* render-pipeline: report/book number figures and tables within the chapter

What changed:
- floats::number follows report.cls/book.cls: \thefigure and \thetable are
  \ifnum\c@chapter>\z@\thechapter.\fi\@Arabic\c@figure, reset by
  \@addtoreset{figure}{chapter}. \chapter* and book's \chapter outside
  \mainmatter step nothing; \appendix zeroes the chapter counter and makes
  \thechapter \@alph. Captions and \ref both use the value.
- FloatSpec.number is the printed string ("1.2"), not a bare counter.
- New pdflatex-pinned fixtures in fixtures/float-numbering (report chapters
  with \chapter*, report appendix, book front/main/back matter, an article
  control) and tests/float_numbering_oracle.rs: caption label, page and
  position within 1 bp, and the resolved \ref line.

What was run:
- cargo test --test float_numbering_oracle: test result: ok. 1 passed; 0 failed
- same test on origin/main sources: 17 mismatches (e.g. "Figure 1:" for
  pdflatex's "Figure 1.1:", chapter two's first figure printed "Figure 3")
- cargo test --test floats_oracle: ok. 2 passed; float_body_oracle: ok. 1
  passed; float_notes_oracle: ok. 1 passed; toc_oracle: ok. 1 passed;
  footnotes_oracle: ok. 1 passed; --lib floats: ok. 4 passed

Next step: open the GH-69 PR with the object-stream PDF sizing commit.

Implementation-Agent: claude-opus-5 subagent of daniel-parent
Commit-Executor: daniel-parent subagent
Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz

* render-pipeline: size PDF graphics whose page tree is in object streams

What changed:
- graphics::probe_pdf falls back to flashtex_pdf::reader when the byte scan
  fails on a PDF with /ObjStm (PDF 1.5 object streams, pdfTeX's default
  \pdfobjcompresslevel 2). Before, every such PDF was image_unavailable and
  took no space. CropBox/MediaBox/Rotate handling is shared (page_info).
- New fixtures/float-graphics: a 72 dpi PNG and two pdfTeX object-stream
  PDFs (one /Rotate 90), made by make_fixtures.py; oracle.py pins box size and
  position from pdflatex. tests/float_graphics_oracle.rs checks
  width=\linewidth, scale, keepaspectratio, angle before/after a size key,
  \textwidth multiples, and the PDFs, within 1 bp, with no image diagnostic.
- Unit test graphics::tests::pdf_object_streams_are_read.

What was run:
- cargo test --test float_graphics_oracle: test result: ok. 1 passed; 0 failed
- same test without the graphics.rs change: 7 mismatches
- cargo test --lib graphics: test result: ok. 8 passed; 0 failed

Next step: [H] from the float package, then the PR.

Implementation-Agent: claude-opus-5 subagent of daniel-parent
Commit-Executor: daniel-parent subagent
Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz

* render-pipeline: float.sty [H] sets the box exactly where it stands

What changed:
- FloatSpec::exact_here: with \usepackage{float}, a vertical-mode [H]
  float is not a float (\@float@HH). paginate splices \float@endH's
  \vskip\intextsep, the box and \vskip\intextsep at its marker, with TeX's
  interline glue (\lineskip against the line above; the next line's glue
  against the box's zero depth). It is never deferred or counted.
- [H] in the middle of a paragraph or on a two-column figure* now has its own
  diagnostic and falls back to h. [H] without the package keeps its old one.
- packages: float is implemented by the pipeline. \floatstyle, \restylefloat
  and \newfloat are still diagnosed by the compiler.
- fixtures/floats: make_fixtures.py adds 11-float-h and
  12-h-passes-deferred. oracle.py takes fixture names, so only those two
  were pinned; the other 10 sources and references are byte-identical.
  floats_oracle expects 12 fixtures, plus a diagnostics test for [H].

What was run:
- cargo test --test floats_oracle: test result: ok. 3 passed; 0 failed
  (11-float-h 2/2 pages, 13 anchors, max 0.002 bp; 12-h-passes-deferred
  3/3 pages, 9 anchors, max 0.003 bp)
- same fixtures on the pre-change sources: 26 mismatches
- cargo test --lib: test result: ok. 138 passed; 0 failed; 2 ignored
- float_body_oracle, float_notes_oracle, footnotes_oracle, toc_oracle,
  multicol_oracle, twocolumn_title_oracle: ok, 1 passed each;
  graphics_draft_demo: ok. 3 passed; float_numbering_oracle: ok. 1 passed;
  float_graphics_oracle: ok. 1 passed

Next step: open the GH-69 PR and post the verification table on #69.

Implementation-Agent: claude-opus-5 subagent of daniel-parent
Commit-Executor: daniel-parent subagent
Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz

* render-pipeline: \chapter in an \include'd file is a chapter

What changed:
The adapter read structural body commands (\chapter, \part, \appendix,
book matter, marks/page styles, \addcontentsline) from the entry
document's source only. A \chapter in chapters/one.tex was set as a plain
paragraph on the current page: no page clear, no number, no marks, no
contents line. Included documents now get the same scan; their commands
are laid out before that document's next unit, and any left after its
last unit are laid out when the entry document resumes. \maketitle,
\noindent, contents lists and nested \input stay entry-only.

Corpus extended/project-book-include (#42): 5 pages -> 7 (pdflatex 7).

What was run:
cargo test --release (render-pipeline): passed 377 failed 0 ignored 3
test result: ok. 2 passed; 0 failed (chapter_in_included_file)
test result: ok. 1 passed; 0 failed (input_order_oracle)
test result: ok. 1 passed; 0 failed (toc_oracle)
test result: ok. 20 passed; 0 failed (flashtex-cli cli)

Next step:
\include's own \clearpage before/after (article: pdflatex 3 pages, we
set 1) and the missing CONTENTS running head in book front matter are
separate follow-ups.

Implementation-Agent: claude-opus-5 subagent of daniel-parent
Commit-Executor: daniel-parent subagent
Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz

* pdf: an ellipsis's periods no longer make every period extract as "…"

What changed:
- v2 export reduced cluster text to ToUnicode by first use. The pipeline sets
  `\textellipsis` as three periods in one cluster whose text is "…", so the
  period glyph was mapped to U+2026 for the whole font: the ellipsis
  extracted as "………" and every later sentence-final period as "…"
  (measured on "em dash… ellipsis." in OT1 and T1+lmodern documents).
- Only a one-glyph cluster now names its glyph's text. A glyph seen only
  inside clusters of several glyphs takes the character the font's own cmap
  maps to it (new `TrueTypeFont::char_for_glyph`, lowest code point), and the
  cluster text only when the cmap has none. Ligatures (`fi`, one glyph)
  still extract as their cluster text.
- tests/v2.rs: `ellipsis_periods_keep_the_period_in_to_unicode` (fails on
  main with `{28: "a", 88: "…"}`).

What was run:
- cargo test --release --test v2
  test result: ok. 7 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
- cargo test --release (crates/pdf, whole crate): 118 passed, 0 failed
- flashtex build --v2 + flashtex-pdf-exact from-v2 on the survey documents
  d4-punct-ot1 / d5-punct-t1-lm: "em dash……… ellipsis…" -> "em dash... ellipsis."

Next step:
- Re-pin crates/render-pipeline/vendor/pdf so `flashtex build` and Export
  PDF pick it up (vendor re-pins are the integration lane's).

Implementation-Agent: claude-opus-5 subagent of daniel-parent
Commit-Executor: daniel-parent subagent
Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz

* math-layout: TeX's math font kerns (make_ord, tex.web §752) from the TFM lig/kern programs

What changed:
- tools/gen_cm_tfm.py emits each font's lig/kern program (lig_kern_starts,
  lig_kern, kerns) read from the real TFMs; cm_tfm.rs and ams_tfm.rs
  regenerated (additions only; existing char rows unchanged).
- tfm.rs: TfmFont::lig_kern walks the program as TeX does (first matching
  instruction; a ligature shadows a later kern).
- MathFontMetrics::ord_pair (default None) + CmMathMetrics impl: same-family
  check via symbol_slot, the scaled kern, and whether the font is a text font.
- layout.rs: make_ord appends the kern after an unscripted Ord character
  followed by an Ord..Punct character of the same family, and drops the
  italic correction in a text font (§755). Bins demoted by Rule 6 are not kerned.

What was run:
- cargo test --test math_font_kerns: test result: ok. 2 passed; 0 failed
- cargo test (math-layout): all suites ok (12, 4, 5, 28, 4, 2, 11 passed; 0 failed)

Next step: feature-gated forwarding in render-pipeline's TexMathMetrics, then HW1 and amsmath corpus measurement.

Implementation-Agent: claude-opus-5 subagent of daniel-parent
Commit-Executor: daniel-parent subagent
Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz

* render-pipeline: an em is the quad of the font in force; table lengths follow macro invocations (#525 review)

What changed:
- `\hspace{<n>em}`, `\quad` and `\qquad` in running text are now set in
  quads of the font current where they are read. `Item::Quad` carries a
  style: the series/family come from the source declarations at the
  command, the size from the compiler's sizes of the text around it
  (`glue_size`). Before, the quad was the paragraph's base font, so
  `{\Large Ff\hspace{2em}Gg}` was 8.165 bp short and `{\bfseries ..}`
  2.989 bp short.
- The blank after `\hspace{..}`'s closing brace is an ordinary space.
  It was being skipped as if it followed a control word (3.3-3.9 bp).
- Size environments (`\begin{small}..\end{small}`, all ten sizes) give
  text, rules, kerns and tables their size unless a declaration made
  inside is still in force. A paragraph whose `\par` is read inside one
  gets that size's `\baselineskip`. The compiler's "environment is not
  implemented" warning for them is superseded.
- `length_at` applies the `\setlength`/`\addtolength`/`\<len>=` a user
  macro makes at the top level of its body (nested macros too, `#k`
  from braced arguments) at the invocation, with the invocation's group
  scope. An assignment that cannot be read (optional argument, unbraced
  argument) is left out and reported as a `table_limitation` warning.
- Corpus fixtures 124-126 (`\hspace{em}`/`\quad` under
  `\small`/`\normalsize`/`\Large`, `\bfseries` and size environments, in
  body text and tables, at 10/11/12pt), 127 (size-environment
  paragraphs) and 128 (macro `\setlength`/`\addtolength` before tables),
  with pdflatex references. Unit tests:
  table_lengths_follow_macro_invocations,
  size_environments_give_their_size_until_a_declaration,
  glue_takes_the_size_of_the_text_it_is_read_with.

What was run:
- python3 oracle.py check --render .../flashtex-render: TOTAL 128/128 (words 0.5 bp, rules 0.1 bp)
- cargo test --release (crates/render-pipeline): 79 test binaries, all "test result: ok", 0 failed
- lib: test result: ok. 143 passed; 0 failed; 2 ignored
- tests/tabular_oracle.rs: tabular_oracle: 128/128 fixtures match pdflatex; test result: ok. 1 passed; 0 failed

Next step: re-review of #525.

Implementation-Agent: claude-opus-5 subagent of daniel-parent
Commit-Executor: daniel-parent subagent
Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz

* render-pipeline: math-font-kerns feature forwards math-layout's ord_pair (off until re-pin)

What changed:
- Cargo.toml: new off-by-default `math-font-kerns` feature; render-pipeline
  depends on vendor/math-layout (not crates/math-layout), which predates
  MathFontMetrics::ord_pair.
- mathtex.rs: TexMathMetrics::ord_pair asks the embedded CM programs for
  families 1-3 and the installed rm-lmr TFM for family 0.
- mathtext.rs: TextRunMetrics forwards, never kerning a \text handle.
- tests/math_font_kerns.rs (feature-gated): glyph origins of $r,a,b$,
  $f,P,Y.$, $f(x)$ $\Gamma,\Delta$ $x_1,x_2$ $V_{a}$ and HW1's display
  against pdflatex within 0.02 bp.

What was run (scratch copy of crates/render-pipeline with vendor/math-layout
replaced by this branch's crates/math-layout, feature on; vendor/ untouched):
- cargo test --release --features math-font-kerns --test math_font_kerns: test result: ok. 1 passed; 0 failed
- same test with ord_pair forced to None: fails, $r,a,b$ glyph 1 +0.608 bp, $f,P,Y.$ glyph 5 +3.633 bp
- amsmath corpus oracle.py check: TOTAL 59/59 within 0.5 bp (before and after)
- rank.py --only hw1: page 2 within 0.5 bp 203 -> 212; the 9 kern words (lines 560.9/585.4) from 0.60-0.61 bp to <=0.005 bp; no other word moved by more than 0.005 bp
- cargo build --release --bin flashtex-render against vendor/ (feature off): ok

Next step: re-pin vendor/math-layout (integration lane), then make math-font-kerns a default feature.

Implementation-Agent: claude-opus-5 subagent of daniel-parent
Commit-Executor: daniel-parent subagent
Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz

* math-layout: keep the ord_pair imports and impl clear of #470's lines

What changed: separate use lines for MathChar/OrdPair and CmMathMetrics::ord_pair moved after accent_sizes, so this branch merges cleanly with #470 (tag-textrun). No behaviour change.

What was run:
- cargo test (math-layout): every suite test result: ok, 0 failed

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

* render-pipeline: number floats in the order the \include tree is read

What changed:
- adapter::reading_order walks \input/\include from the entry file
  (compiler lookup: path, then path.tex; the preamble's last \includeonly;
  cycles and unknown files read nothing) into ordered byte ranges.
- floats::number steps chapter/appendix/matter and the figure/table
  counters over those ranges, so an entry-file float after an \include
  whose file has its own \chapter gets 2.1, not 1.2. A float of a file
  never read (\includeonly-excluded) has no number, label, spec or .lof
  line.
- LoF/LoT entries take the float's own number (report pre-chapter float
  is "1", not "0.1") and merge in reading order.
- Float markers in paginate are placed by reading order, so an entry
  float after an included chapter follows that chapter's blocks.
- \include issues its \clearpage before the file and after it.
- Fixtures 05 (report, two files), 06 (book, \include + \input +
  appendix include), 07 (report, \includeonly) with pdflatex references;
  oracle.py handles multi-file projects; tests/include_float_lists.rs pins
  LoF/LoT/\ref against pdflatex's .lof/.lot/.aux.

What was run:
cargo test --release --test float_numbering_oracle
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
cargo test --release --test include_float_lists
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
cargo test --release --test toc_oracle
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
cargo test --release --test floats_oracle
test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
cargo test --release --lib reading_order
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 140 filtered out

Next step: full crate run, then PR stacked on #537 and #538.

Implementation-Agent: claude-opus-5 subagent of daniel-parent
Commit-Executor: daniel-parent subagent
Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz

* math-layout: math ligatures in make_ord and kerns/ligatures inside text runs (tex.web §752-§753)

What changed:
- `OrdPair` carries the pair's ligature instruction (`OrdLigature { op, ch }`);
  `CmMathMetrics::ord_pair` reports cmr's `=:` ligatures (ff, fi, fl, ffi,
  ffl, and the quote/dash/Spanish marks) as Unicode text characters, and
  `text_glyph` boxes those characters from their OT1 slots.
- `layout`: the first pass runs `make_ord` over the list before boxing. A
  ligature rewrites the list as §753 does: `=:` merges the pair (the ligature
  takes the right atom's scripts), `=:|`/`|=:` replace one side, `|=:|`
  inserts, and the pair is retried unless the op is a `>` form. So
  `$\mathrm{f}\mathrm{i}$` is one fi glyph and `$\mathrm{f}\mathrm{i}^2$` is fi^2.
- `make_text` (`Nucleus::Text`, the multi-character `\mathrm{..}` and
  operator runs) applies the same program between its characters: the font
  kerns (`AV`, `Tr`, `Wa`) and ligatures (`ff`, `ffi`), last italic kept.
- tests/math_font_kerns.rs: 19 new widths pinned to pdfTeX `\wd0`, plus a
  synthetic program exercising every ligature form on both paths.

What was run:
cargo test --manifest-path crates/math-layout/Cargo.toml --test math_font_kerns
test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
cargo test --manifest-path crates/math-layout/Cargo.toml
test result: ok. 12 / 4 / 5 / 28 / 4 / 3 / 2 / 11 passed; 0 failed
before this change the new widths fail, e.g. $\mathrm{AV}$ 15.13890pt vs pdfTeX 14.02777pt

Next step: forward ligatures through render-pipeline's TexMathMetrics and
one-character \mathrm groups; measure the pipeline against pdflatex.

Implementation-Agent: claude-opus-5 subagent of daniel-parent
Commit-Executor: daniel-parent subagent
Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz

* render-pipeline: math ligatures and one-character alphabet kerns behind math-font-kerns

What changed:
- `TexMathMetrics::ord_pair` reads family 0's instruction straight from the
  installed rm-lmr TFM program (`Tfm::pair_program`, no text-mode boundary
  handling) and reports its ligatures, so `make_ord` forms them;
  `text_glyph` boxes a formed ligature (U+FB01 ...) from its OT1 slot.
- A one-character math alphabet pair of the same alphabet
  (`\mathbf{T}\mathbf{o}`, `\mathit{A}\mathit{V}`) is kerned from that
  alphabet's text-font TFM. Ligatures there are not formed (no character
  addresses a ligature slot of those fonts).
- `typeset`: a one-letter/digit `\mathrm{X}` is math-layout's `TextChar`
  (TeX §1186), so it joins its neighbour. All behind `math-font-kerns`.
- math-layout `cm::ligature_char` shared by both providers.
- tests/math_ligatures.rs pins glyph origins against pdflatex (lmodern).

What was run (scratch copy, vendor/math-layout := this branch's crate):
cargo test --release --features math-font-kerns --test math_ligatures
test result: ok. 1 passed; 0 failed
  negative control on #560's overlay: fails, "$x\mathrm{A}\mathrm{V}x$: glyph 2 at x 140.215 bp, pdflatex 139.003 (+1.212)"
cargo test --release --no-fail-fast --features math-font-kerns (whole crate): 377 passed; 0 failed; 3 ignored
oracle.py check: TOTAL 59/59 within 0.5 bp (before and after, per-fixture lines identical)
rank.py --only hw1: page 2 within 0.5 bp 212 of 215, pages 1 and 3 unchanged (same as #560)
worktree, feature off: cargo check --release --tests ok

Next step: open the PR stacked on #560.

Implementation-Agent: claude-opus-5 subagent of daniel-parent
Commit-Executor: daniel-parent subagent
Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz

* math-layout: keep the new layout.rs imports clear of #470's lines

What changed: the OrdLigature/SizeClass/Cow imports move to a block of their
own, so #560's import lines stay byte-identical and #470 still merges cleanly.

What was run:
git merge-tree --write-tree HEAD origin/agent/daniel-parent/tag-textrun: no conflict
cargo test --manifest-path crates/math-layout/Cargo.toml
test result: ok. 12 / 4 / 5 / 28 / 4 / 3 / 2 / 11 passed; 0 failed

Next step: open the PR stacked on #560.

Implementation-Agent: claude-opus-5 subagent of daniel-parent
Commit-Executor: daniel-parent subagent
Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz

* render-pipeline: a chapter whose body is only a float still clears its page

What changed:
The adapter lays an \include'd file's structural commands (\chapter, ...)
out before that file's next unit (paragraph, heading, rule, picture). A
file whose whole body is a captioned float has no unit, so its \chapter
(heading, page clear, number) was never laid out and the floats piled onto
one page ahead of later text. Likewise a trailing entry \chapter with only a
float after it was dropped: the end-of-document loop handled only marks,
page styles and \maketitle.
- An entry \input/\include consumed without a unit of the file it reads
  (found from the reading order) lays that file's commands out in place,
  then \include's closing \clearpage.
- A unit of an included file flushes up to the command that reads its
  file, not merely the next \input/\include.
- Included files read so far are finished whenever the next file is read,
  not only when the entry file resumes.
- The unit loop takes one last pass after the last unit, so commands after
  it (\chapter, \include, marks, \maketitle) go through the same code; the
  separate trailing loop is gone.
tests/include_float_only_chapters.rs pins pages, lines and baselines
against pdflatex for two and three float-only \include'd chapters, the same
under \includeonly (with and without trailing text), and single-file
float-only chapters.

What was run:
cargo test --release --test include_float_only_chapters
test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
same test without the adapter change: test result: FAILED. 0 passed; 3 failed
chapter_in_included_file: test result: ok. 2 passed; 0 failed
float_body_oracle: test result: ok. 1 passed; 0 failed
float_graphics_oracle: test result: ok. 1 passed; 0 failed
float_notes_oracle: test result: ok. 1 passed; 0 failed
float_numbering_oracle: test result: ok. 1 passed; 0 failed
floats_oracle: test result: ok. 3 passed; 0 failed
include_float_lists: test result: ok. 1 passed; 0 failed
input_order_oracle: test result: ok. 1 passed; 0 failed
toc_oracle: test result: ok. 1 passed; 0 failed
cargo test --release -p flashtex-render-pipeline --no-fail-fast: passed 386, failed 0, ignored 3

Next step: a float right after a body \clearpage (no \include) still lands
on the old page; that break is carried by the next block's eject and is
left to the #569/#583/#584 page-break stack.

Implementation-Agent: claude-opus-5 subagent of daniel-parent
Commit-Executor: daniel-parent subagent
Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz

* render-pipeline: \check@icl italic correction and nested list closing skips (display-placement 35/36)

What changed:
- An upright text font command (\textbf, \textup, \texttt, \emph in italic
  text, ...) and amsmath's \eqref (\textup{\tagform@{..}}) put the italic
  correction of the character before them under the interword space
  (latex.ltx \check@icl -> \maybe@ic -> \sw@slant). Fixture 17's `(2.1).`
  was 0.784 bp left (the `f` of "Ref", kern 0.7922 pt).
- A list's closing \addvspace\@topsepadd uses the \topsep of the level that
  closes (was always level 1), with that list's own \partopsep flag; lists
  closing together and a following \item's \addvspace\itemsep keep the
  larger natural skip instead of the sum. Fixture 20's `2. Outer again` was
  7.97 bp low.
- A paragraph right after \end{itemize}/\end{enumerate} with no blank line
  is not indented (\@endpe), as after center/quote.
- Pins: tests/text_command_left_italic_correction.rs,
  tests/nested_list_end_skips.rs (pdflatex numbers; all four fail on main
  by -0.791, +7.970, -1.993, +3.985 bp); display_placement.rs PASSING adds
  17 and 20; baseline-render-pipeline.json refreshed.

What was run:
- display-placement oracle.py check: TOTAL 35/36 within 0.5 bp (main: 33/36;
  15 still fails on the rich \tag, owned by #470/#585)
- amsmath_corpus oracle.py check: TOTAL 59/59 within 0.5 bp
- cargo test --release -p flashtex-render-pipeline (all targets): 81 test
  binaries, 379 passed, 0 failed, 3 ignored

Next step: fixture 15 lands with #585 plus the math ToUnicode lane.

Implementation-Agent: claude-opus-5 subagent of daniel-parent
Commit-Executor: daniel-parent subagent
Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz

* render-pipeline: math minus, asterisk and phi extract as the right Unicode

What changed:
- Math '-' extracts as U+2212 MINUS SIGN and '*'/\ast as U+2217 ASTERISK
  OPERATOR (both were ASCII); \phi/\varphi now extract as U+03D5/U+03C6
  (they were swapped). Glyph selection and positions are unchanged.
- Tests assert semantically correct Unicode, not pdflatex parity: pdflatex
  without the cmap package extracts cmex/cmsy glyphs as artefacts
  (\sum -> P, \mapsto -> 7->), which are deliberately not copied.

What was run:
- render-pipeline math targets: 68 passed, 0 failed
- render-pipeline lib: 138 passed, 0 failed, 2 ignored
- crates/pdf: all suites passed; git diff --check: passed

Next step:
- independent review.

Implementation-Agent: codex gpt-5.6-luna (max)
Commit-Executor: daniel-parent (committed Codex's working tree; sandbox blocked its git index)
Lane-Owner: daniel-parent (mac-m5pro-dq222)
Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz

* render-pipeline: keep only the four semantic math extraction fixes

What changed:
- The previous commit accidentally shipped the first-pass table that copied
  pdflatex's cmex/cmsy extraction artefacts (\mapsto -> 7->, \Longrightarrow
  -> =>, \circ -> bullet, \setminus -> ASCII backslash, ...). This commit
  applies the corrected working tree: extraction_text only maps '-' ->
  U+2212, '*' -> U+2217 and swaps \phi/\varphi; every other glyph keeps
  main's text. Tests assert semantically correct Unicode.

What was run:
- render-pipeline math targets and lib (see next comment on #597)

Next step:
- re-run tests; update #597.

Implementation-Agent: codex gpt-5.6-luna (max)
Commit-Executor: daniel-parent (staging slip in the previous commit)
Lane-Owner: daniel-parent (mac-m5pro-dq222)
Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz

* render-pipeline: long arrows extract as their drawn join pieces

What changed:
- The long arrows move out of common_math_glyph_runs_use_semantic_unicode
  into long_arrows_extract_as_their_drawn_pieces (option C from #536).
- A two-glyph join (#536's drawing) must extract as `=⇒` / `−→`, matching
  pdfTeX's own PDF (`x =⇒y −→z`, pdflatex + PyMuPDF). While main still draws
  one Latin Modern Math glyph, the text is the single `⟹` / `⟶`.
- A comment records that one `⟹` for two drawn glyphs needs PDF /ActualText
  marked content, a future crates/pdf change outside this PR.

What was run:
- math_symbols (debug): test result: ok. 14 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.46s

Next step:
- Merge into agent/daniel-parent/integration-preview and rerun math_symbols there.

Implementation-Agent: claude-opus-5 subagent of daniel-parent
Commit-Executor: daniel-parent subagent
Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz

* oracles: a math minus sign aligns with the references' hyphen-minus

What changed:
- tools/visual-oracle/rank.py `norm` folds U+2212 MINUS SIGN into U+002D
  before alignment. pdfTeX's own PDFs extract a math minus as U+2212
  (PyMuPDF on pdflatex's 19-vmatrix.pdf: "= ad −bc"; 28-xrightarrow.pdf:
  "f−→B", "h←−"), which is what this branch now emits. The pinned references
  read "-" only because pdftext's glyph-name table maps `minus` to "-". The
  references and FlashTeX are both right; the word matcher was not.
- amsmath_corpus/oracle.py `regroup` orders coincident glyphs (the \relbar
  and arrow head of \xrightarrow) with the same fold, so `−→` sorts like the
  references' `-→`.
- test_rank.py: a minus sign aligns with a hyphen-minus.

What was run:
- amsmath oracle, this branch's flashtex-render: TOTAL 58/59 after the norm
  fold alone (28-xrightarrow order tie), TOTAL 59/59 within 0.5 bp with both
- amsmath oracle, main's flashtex-render (36fe7ec): TOTAL 59/59 within 0.5 bp
- amssymb oracle, main and this branch: TOTAL 38/39 within 0.5 bp (both;
  32-braces-narrow fails identically on main)
- tabular oracle, main and this branch: TOTAL 106/106 (words 0.5 bp, rules 0.1 bp)
- display-placement oracle, main and this branch: TOTAL 33/36 within 0.5 bp (identical rows)
- python3 -m unittest discover -s tools/visual-oracle -p 'test_*.py': Ran 14 tests, OK

Next step: merge into the integration preview (#609) and rerun there.

Implementation-Agent: claude-opus-5 subagent of daniel-parent
Commit-Executor: daniel-parent subagent
Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz

* visual-oracle: candidate word text slices cluster byte ranges as bytes

What changed:
- rank.v2_words sliced the glyph run's Python str with the display list's
  cluster ranges, which are UTF-8 byte offsets. After the first non-ASCII
  character in a run (`∈`, and now this branch's U+2212 minus) every later
  glyph got its neighbour's text: `|f(x_k) − f(y_k)|` read as words `−f`,
  `(y` instead of `−`, `f(y`, and `x ∈ K` left an empty-text word. The
  sweep-2 "apparent regressions with identical pixels" (inline-math p1/p2,
  math-sheet p2, hw1 p1, conf-paper p2) were this. The amsmath oracle's own
  reader already encoded before slicing.
- test_rank.py: the v2 fixture helper writes byte offsets; a run with
  `−` and `∈` keeps its word text.

What was run (tools/visual-oracle/rank.py, all 22 real-world fixtures, same
flashtex-pdf-exact; aligned words summed over every page):
- old rank.py: main 36fe7ec 15285, preview 5d1eb06 15253
- this rank.py: main 15330, preview 15326
- pages whose aligned/within-0.5 counts differed main vs preview only
  through text (conf-paper p2, hw1 p1, inline-math p1/p2, math-sheet p1/p2,
  ps-calculus p2/p3, twelvept-plain p2, lecture-notes p2) are now identical
- amsmath 59/59, amssymb 38/39, tabular 106/106, display-placement 33/36
  (main) and 35/36 (preview): unchanged by this commit
- python3 -m unittest discover -s tools/visual-oracle -p 'test_*.py': OK

Next step: merge into the integration preview (#609).

Implementation-Agent: claude-opus-5 subagent of daniel-parent
Commit-Executor: daniel-parent subagent
Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz

* render-pipeline: read each table length once per adapt call, not per table (#525 review, #623)

What changed:
- `length_at_checked` scanned the source before every table (a CmdScan of
  the prefix, plus a `group_open_between` rescan per assignment) for each
  of the four tabular lengths and the five longtable lengths. On a
  document with many tables that is quadratic or worse: 800 tables spent
  1.6 s in it. It is the same class of bug #623 fixed in
  `split_at_page_breaks`.
- Within an adapt call (`MacroDefsScope`) each length is now indexed once
  per document: `length_assignments` collects every `\setlength`/
  `\addtolength`/`\<name>=` and assigning macro invocation of the whole
  source once, `GroupTokens` lexes the group depth once (the tokens
  `group_open_between` counts, with the next-lower-depth token of each),
  and `LengthIndex` links each assignment to the last earlier one still in
  force at its end. A table binary-searches its byte offset and walks that
  chain past closed groups. The value and `unresolved` flag are folded in
  the same order as the scan, so the floats are bit-identical.
- Outside an adapt call, at a byte inside a control word, or for a document
  whose assignments do not form a chain (an assigning macro in another's
  argument, an assignment ending inside a comment), the old scan runs
  unchanged as `length_at_scan`.
- The indexes live in a new `lengths` field of `MacroDefsEntry`, placed
  before `index` so #623's `setlengths` field merges without conflict
  (`git merge-tree` of this commit with #623's head is clean).

What was run:
- `cargo test --release --lib -- table_length`: test result: ok. 5 passed; 0 failed
  - table_length_index_matches_the_prefix_scan: the indexed lookup equals
    the scan at every byte of 8 hand-written and 300 generated sources,
    for tabcolsep/arrayrulewidth/LTpre (both index and fallback paths hit).
  - table_lengths_scale_linearly_with_the_number_of_tables:
    before: 200 tables 41.2ms, 400 tables 242.7ms, 800 tables 1.637s (panicked: not linear)
    after:  200 tables 393µs, 400 tables 717µs, 800 tables 1.42ms
- flashtex-render end to end, generated doc, best of 3 (before -> after, v2 identical):
  200 tables 0.16s -> 0.08s; 400 tables 0.71s -> 0.22s; 800 tables 4.05s -> 0.73s
- v2 JSON + compile_result of all 128 tabular_corpus fixtures and 22
  fixtures/real-world documents, head 99defd5 vs this commit: `diff -rq` IDENTICAL (150/150)
- `oracle.py check`: TOTAL 128/128 (words 0.5 bp, rules 0.1 bp)
- `cargo test --release` (render-pipeline): exit 0, 79 test binaries, 383 passed; 0 failed; 3 ignored

Next step: merge #623 after #525 (or the reverse); the rest of the
remaining 800-table time is #623's `split_at_page_breaks` fix.

Implementation-Agent: claude-opus-5 subagent of daniel-parent
Commit-Executor: daniel-parent subagent
Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz

* integration: #639's layout_cache_keys test constructs #525's Item::Quad with its style field

Main's tests/layout_cache_keys.rs (#639) predates #525's Item::Quad
{ em, style }; the test's shared TextStyle fills the new field.

Implementation-Agent: fable-integration-rp
Commit-Executor: fable-integration-rp (direct; Cursor usage limit)

* integration: a file-tail float keeps its blank-line mask; include_float_lists expects #608's joined paragraph

Two #578 x #608 interactions on the combined head:

- floats::mask (#608) turned a float-only line into a % comment; for a
  float at the very tail of an \included file that left the paragraph
  open at EOF, and the compiler joined it with the entry document's
  next text, so #578's closing \clearpage landed after the merged
  paragraph (4 pages instead of pdflatex's 5). A float with nothing
  but blanks/comments after it now keeps the blank-line mask; entry
  documents are unaffected (\end{document} follows their floats).
- tests/include_float_lists.rs (#578) expected "Refs ..." on its own
  line; under #608 the [h] floats stay inside the paragraph (pdflatex
  behaviour), so the refs share the paragraph's line.

Implementation-Agent: fable-integration-rp
Commit-Executor: fable-integration-rp (direct; Cursor usage limit)

* integration: restore #543's entry-document chapter starts for \thelstlisting

The #578 delta removed the chapter_starts push together with the
chapter-based figure numbering it replaced, but #543's listing numbers
(list_blocks' Lol entries and listings::apply captions) still come from
chapter_numbers over those starts (toc_oracle fixture
37-report-lstlistoflistings).

Implementation-Agent: fable-integration-rp
Commit-Executor: fable-integration-rp (direct; Cursor usage limit)

---------

Co-authored-by: d-q222 <[email protected]>
…ag-placement-pipeline

What changed:
- #470's compiler `Nucleus::TextRun`/`TextPiece` and math-layout `TextRun`
  have landed on main, so most conflicted hunks were this branch's copy of
  main's material and took main's side:
  - crates/compiler/src/math.rs: 2 of 3 (the `\mathbf` `split_hyphen_runs`
    rewrite and its `-` mathcode comment). The third, `INTERIM_TAG_GAP_EM`'s
    doc comment, is this PR's own commit 1b6f03f and was kept.
  - crates/compiler/src/parser.rs: the `comment_environment` hunk took main.
  - crates/math-layout/src/lib.rs and src/layout.rs: main (`LeftScripts` in
    the import lists; main's removal of `make_text_styled`).
  - crates/compiler/tests/text_runs.rs (add/add): kept this PR's two tag
    tests, which main's side does not have.
- Two hunks needed a real merge rather than a side:
  - crates/compiler/src/parser.rs `multirow_environment`. Main gained #552's
    `\shoveleft`/`\shoveright`, which lifts shove tokens out of each row's
    cells before they are parsed, inside the row loop; this PR pre-parses
    every row up front so it can find each row's `\tag` before numbering.
    The shove lifting now runs as its own `rows.iter_mut()` pass ahead of the
    pre-parse and is zipped into the row loop, so both behaviours survive.
  - crates/render-pipeline/Cargo.toml: union of the feature blocks —
    `compiler-text-run` (this PR) alongside main's `math-font-kerns` and
    `tikz-patterns`.
  - crates/render-pipeline/tests/display_placement.rs module comment: main's
    current statement of what passes (17, 18, nested list 20) plus this PR's
    `compiler-text-run` paragraph; only 15 is still listed as not passing.
- Two silent auto-merge duplications had to be removed by hand; both made the
  tree fail to compile and neither is a behaviour change:
  - crates/math-layout/src/cm.rs: a second copy of
    `fn text_space(&self, size: SizeClass)` (E0201).
  - crates/compiler/src/math.rs: a second copy of the whole 376-line text-run
    reference-text block (16 items, E0428). main's copy is a strict superset
    (it carries the `Nucleus::Lap` and `Nucleus::SideSet` arms), so the
    branch's copy was deleted.
- #736 (`adapter::strip_tag`'s silent-drop fix) is NOT on origin/main yet, so
  this merge did not touch it and nothing of it was undone. This branch's
  `strip_tag` is unchanged: the `Text`/`Symbol` arm, the
  `#[cfg(feature = "compiler-text-run")]` `TextRun` arm and the `_ => {}`
  fallback. The one-directional resolution #736 describes is still owed
  whichever of the two lands second.
- `sh crates/compiler/scripts/render_supported_latex.sh` was re-run; the
  generated artefacts come back identical to main.
- `git diff origin/main` is now exactly this PR's own payload: the compiler
  tag-numbering commit (math.rs, parser.rs, tests/text_runs.rs) and the
  render-pipeline half (Cargo.toml, adapter.rs, incremental.rs, mathtext.rs,
  typeset.rs, tests/display_placement.rs, fixtures 37-48 and their refs).

What was run:
  crates/compiler:
    cargo test --lib
      test result: ok. 412 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
    cargo test --test text_runs
      test result: ok. 16 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
    cargo test            77 "test result: ok." lines, 0 failed
  crates/render-pipeline (pinned vendor, default features):
    cargo build --lib --tests -> Finished
    cargo test --lib
      test result: ok. 164 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out
    cargo test --test display_placement
      test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
    cargo test --no-fail-fast
      binaries=105 passed=469 failed=13 ignored=4
      All 13 failures panic at crates/render-pipeline/src/adapter.rs:1311
      (main's 1308, shifted by this branch), the known stale vendor/compiler
      pin. Same 13 as on main today.

Next step:
- Still blocked on the vendor/compiler + vendor/math-layout re-pin (#711);
  until it moves, `compiler-text-run` cannot go default and fixtures 37-48
  cannot show their end-to-end behaviour.
- Whichever of #585 and #736 lands second still owes the one-directional
  strip_tag resolution #736's body sets out.

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

Merged current origin/main in (merge commit 6eeb3691, not a rebase; no force-push). The branch is no longer conflicting.

#736 first, since it was the risk

#736 is not on origin/main yet — strip_tag there still has the original two-arm if let — so this merge never met it and nothing of #736's fix was undone. This branch's strip_tag is exactly as it was: the Text/Symbol arm, the #[cfg(feature = "compiler-text-run")] TextRun arm, and the _ => {} fallback. The one-directional resolution #736's body sets out (its compiler-node-surface arm replaced by #585's compiler-text-run arm, the Space and _ arms and the notes parameter kept) is still owed by whichever of the two lands second.

How it resolved

#470's compiler Nucleus::TextRun/TextPiece and math-layout TextRun are on main, so most hunks were this branch's copy of main's material.

file conflicts resolution
crates/compiler/src/math.rs 3 main for 2 (the \mathbf split_hyphen_runs rewrite, the - mathcode comment); kept HEAD for INTERIM_TAG_GAP_EM's doc comment, which is this PR's own commit 1b6f03f2
crates/compiler/src/parser.rs 3 main for comment_environment; the other two merged (below)
crates/compiler/tests/text_runs.rs 1 (add/add) kept HEAD — this PR's two tag tests; main's side of the hunk is empty
crates/math-layout/src/lib.rs, src/layout.rs 3 main (LeftScripts in the import lists; main's removal of make_text_styled)
crates/render-pipeline/Cargo.toml 1 union — compiler-text-run alongside main's math-font-kerns and tikz-patterns
crates/render-pipeline/tests/display_placement.rs 1 merged module comment

Two hunks needed a real merge rather than a side:

parser.rs multirow_environment. Main gained #552's \shoveleft/\shoveright, which lifts shove tokens out of each row's cells before they are parsed, inside the row loop. This PR pre-parses every row up front, before the loop, so it can find each row's \tag and decide numbering. Neither ordering survives the other, so the shove lifting became its own pass ahead of the pre-parse and is zipped into the row loop:

let is_multline = name.starts_with("multline");
let shoves: Vec<Option<ShoveDirection>> = rows
    .iter_mut()
    .map(|(cells, ..)| is_multline.then(|| Self::take_row_shove(cells)).flatten())
    .collect();

let packages = self.math_packages;
let parsed: Vec<Vec<MathList>> = rows.iter()...   // unchanged
...
for ((((raw_cells, unnumbered, row_labels, intertext), cells), row_tag), shove) in
    rows.into_iter().zip(parsed).zip(row_tags).zip(shoves)

Both behaviours are exercised: text_runs.rs's two tag tests and the compiler suite's shove tests all pass.

display_placement.rs module comment. Main's current statement of what passes (17 and 18 both pass now; display 20's nested-list \topsep) plus this PR's compiler-text-run paragraph. Only 15 is still listed as not passing.

Two silent auto-merge duplications

Neither raised a conflict; both made the tree fail to compile, and neither is a behaviour change.

error[E0201]: duplicate definitions with name `text_space`
  --> crates/math-layout/src/cm.rs:704:5
error[E0428]: the name `text_run_plain_text` is defined multiple times
  --> crates/compiler/src/math.rs:704:1     (and 15 more in the same block)

cm.rs had a second copy of fn text_space(&self, size: SizeClass). math.rs had a second copy of the entire 376-line text-run reference-text block — 16 items. Main's copy is a strict superset of the branch's (it carries the Nucleus::Lap and Nucleus::SideSet arms in append_math_reference_text and reference_atom_end), so the branch's copy was deleted and main's kept.

Generated artefacts

Not hand-merged. sh crates/compiler/scripts/render_supported_latex.sh → regenerated docs/user/compiler.md and crates/compiler/supported/{supported-latex.json,coverage.md}, sync-supported-latex.sh: bundled copy is current (2e9dff55b6e4). They come back identical to main.

git diff origin/main is now exactly this PR's own payload: the compiler tag-numbering commit (math.rs, parser.rs, tests/text_runs.rs) and the render-pipeline half (Cargo.toml, adapter.rs, incremental.rs, mathtext.rs, typeset.rs, tests/display_placement.rs, fixtures 37–48 and their refs) — 34 files, +2742/−65.

Test results (post-merge, CARGO_TARGET_DIR=target-mg-585, CARGO_BUILD_JOBS=4)

# crates/compiler
cargo test --lib
test result: ok. 412 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.66s

cargo test --test text_runs
test result: ok. 16 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.01s

cargo test
77 "test result: ok." lines, 0 failed

# crates/render-pipeline, pinned vendor, default features
cargo build --lib --tests            Finished `dev` profile
cargo test --lib
test result: ok. 164 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out; finished in 2.65s

cargo test --test display_placement
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.27s

cargo test --no-fail-fast
binaries=105 passed=469 failed=13 ignored=4

All 13 failures panic at crates/render-pipeline/src/adapter.rs:1311 (main's :1308, shifted by this branch) — the known stale vendor/compiler pin, the same 13 that are red on main today, and the same count #736 reports against the pinned vendor.

Still blocked

The re-pin (#711). Until vendor/compiler and vendor/math-layout move past #470, compiler-text-run cannot go default and fixtures 37–48 cannot show their end-to-end behaviour — unchanged from this PR's own description.

🤖 Generated with Claude Code

https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz

d-q222 added a commit that referenced this pull request Sep 16, 2026
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
ItsAkilesh pushed a commit to ItsAkilesh/flashtex that referenced this pull request Sep 18, 2026
…tic equation number (flash-tex#441)

What changed:
`adapter::strip_tag` read only a flat `Nucleus::Text`/`Symbol` label. Once
`vendor/compiler` is re-pinned past flash-tex#470, `\tag{hi $x^2$}` arrives as
`Nucleus::TextRun` instead, so the label was dropped and the caller's
`None` arm — the *automatic* equation number — stood in for it. The
document then said `(2)`/`(3)` where the source says `\tag{hi $x^2$}`,
with no diagnostic: wrong in a way that looks right.

`strip_tag` now matches the nucleus exhaustively:
- `Text`/`Symbol`: unchanged.
- `Space`: the compiler's interim 2-quad gap, dropped as before (it spans
  the command too, and is not a label).
- `TextRun` (behind `compiler-node-surface`, the feature that presumes the
  newer compiler): set as the run's text — the same flattening the compiler
  uses for `\eqref` to this tag — with a `math_limitation` at the `\tag`
  saying the nested math is not yet set as math.
- anything else: no label set, the display left unnumbered, and the reason
  reported.

The rich label is an approximation, not the box amsmath builds: it is
~1.31 bp from pdflatex, against 0.005 bp for a plain `\tag{hi}`. PR flash-tex#585
sets it exactly (0.004 bp measured there); this commit only removes the
silence, and is inert on the default pinned-vendor path.

What was run:
Scratch vendor swap per docs/integration/repin-runbook.md §3 (nothing under
vendor/ is committed; `git diff --stat | grep -c vendor` is 0).

  # crates/render-pipeline, re-pinned vendor, compiler-node-surface+linebreak-skip
  binaries=106 passed=489 failed=0 ignored=4
  # crates/render-pipeline, pinned vendor, default features (main's 13 reds)
  binaries=106 passed=469 failed=13 ignored=4
  # tests/tag_rich_label.rs, re-pinned vendor
  test a_rich_tag_is_never_silently_replaced_by_the_automatic_number ... ok
  test a_rich_tag_reports_that_its_math_is_set_as_text ... ok
  test a_plain_tag_is_unchanged_and_matches_pdflatex ... ok
  test an_untagged_equation_still_gets_its_number ... ok
  test result: ok. 4 passed; 0 failed
  # the same file with this commit's adapter.rs reverted
  test result: FAILED. 2 passed; 2 failed
  # fixtures/display-placement/oracle.py check
  TOTAL 35/36 within 0.5 bp     (baseline without this change: 35/36)
  # crates/compiler/tests/amsmath_corpus/oracle.py check
  PASS 22-tag                     words  13 ok  13 unaligned   0 worst    0.006
  TOTAL 59/59 within 0.5 bp

pdflatex (TeX Live 2026, PyMuPDF), 10pt article + lmodern + amsmath:

  '(hi)'  x0 461.433     FlashTeX 461.428   dx 0.005
  '(x2)'  x0 459.573     FlashTeX 460.892   dx 1.319   (was: "(2)")
  '(hi'   x0 447.959     FlashTeX 449.270   dx 1.311   (was: "(3)")
  'x2)'   x0 463.461     FlashTeX 464.767   dx 1.306

Next step:
flash-tex#585 replaces the text approximation with `\maketag@@@`'s hbox and adds the
compiler half that makes `\eqref` to a rich tag resolve to the tag rather
than to a stale number; this commit does not touch either.

Implementation-Agent: claude-opus-5 subagent of daniel-parent
Commit-Executor: daniel-parent subagent
Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz
@jay3332
jay3332 merged commit 297dbc7 into main Sep 19, 2026
21 of 22 checks passed
jay3332 added a commit that referenced this pull request Sep 19, 2026
… of the #736 approximation (#441)

`tag_rich_label.rs`, `tag_eqref_flatten.rs` and `tag_greek_label.rs` were
written for the interim behaviour -- a rich `\tag` set as its flattened text under a
`math_limitation` note, and a `\frac` in a tag falling back to its source
text on both the tag and the `\eqref` -- which the #585 merge replaces.

- `a_rich_tag_reports_that_its_math_is_set_as_text` becomes
  `a_rich_tag_reports_no_limitation`: nothing is approximated, so nothing
  is reported.
- New `a_rich_tag_is_set_where_pdflatex_sets_it`: `\tag{$x^2$}` and
  `\tag{hi $x^2$}` word origins against pdflatex (TeX Live 2026, lmodern:
  `(` 459.564, `x` 463.438, `2` 469.136 raised 3.616 bp; `(hi` 447.949,
  `x` 463.444), within 0.5 bp; the superscript is a raised script run,
  never the text `²`.
- `frac_tag_and_eqref_produce_identical_flattened_text` becomes
  `frac_tag_and_eqref_set_the_same_fraction`: `\tag{$\frac{1}{2}$}` and
  `\eqref` to it stack `1` over `2` at the same offsets from their `(`
  (pdflatex: numerator 5.066 bp in, 3.923 bp up), with no `\frac` on the
  page.

- `tag_greek_label.rs` (GH-805): `\tag{$\alpha$}` no longer needs the text
  face's math-face fallback -- the α is math italic in `\maketag@@@`'s
  box -- so `greek_tag_reports_where_its_alpha_came_from` becomes
  `greek_tag_raises_no_missing_glyph`, and the tag's and `\eqref`'s
  `(`/`α`/`)` are pinned at pdflatex's origins (463.322/467.195/473.605
  and 151.478/155.351/161.761 bp).

The "never the automatic number" regression test keeps its contract.

Implementation-Agent: Claude Code (mac-claude-a / lane-tagmath)
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.

2 participants