Repository navigation
render-pipeline: a rich \tag is never silently replaced by the automatic equation number (#441; stacked on #711) - #736
Conversation
What changed: - `crates/render-pipeline/Cargo.toml` declares a new off-by-default feature `compiler-node-surface`. It carries no behaviour of its own: every arm it adds is the inert answer the pipeline already gave for a compiler node the current pin (`c95977d6`) cannot produce. - The pipeline's exhaustive matches and node constructors now cover main's compiler surface behind that feature: `parser::Block::Penalty`/`Tabbing`, `parser::Inline::ThePage`/`PageNumbering`/`TabStop`/`TabJump`/`Marginpar`/ `Penalty`/`PagePenalty`/`Discretionary`, `VSpace`/`HSpace` glue components, `math::Nucleus::TextRun`/`SideSet`/`Lap` and `math::Accent::Mathring` (compiler #549, #551, #555, #568, #581, #583, #587, #606, #616). `adapter::vspace_block` is a new cfg'd constructor beside the existing `line_break_inline`; the one open-coded `Inline::LineBreak { .. }` left in the `\opening` lowering now goes through `line_break_inline` too. - `tabbing` is lowered to flush-left paragraphs with one `unsupported_block` limitation, the way `LetterBlock` is, so no row is dropped by the re-pin. - `docs/integration/repin-runbook.md`: the exact re-pin commands, the three vendor directories that must move (`compiler`, `tex-expansion`, and a new `bibliography`), the lockfile and `#[ignore]` edits `--locked` CI needs, the measured test deltas and the PRs the pin unblocks. No file under `vendor/` is touched: the vendor swap used to measure all of this was scratch-only and reverted. `git diff --stat origin/main...HEAD` contains zero `vendor/` paths. What was run: Whole `crates/render-pipeline` suite, CARGO_BUILD_JOBS=4, --no-fail-fast: origin/main, pinned vendor, feature off: 469 passed, 13 failed this branch, pinned vendor, feature off: 469 passed, 13 failed (same 13) this branch, vendor re-pinned, feature on: 485 passed, 0 failed The 13 red-on-main tests (letter_class_geometry x5, frame_env, underline_sout x4, uline x2, xcolor_oracle) all pass after the re-pin. Two re-pin-gated #[ignore]s also pass against the re-pinned vendor: test frame_draws_a_rule_border_around_its_content ... ok test coloneqq_decomposes_like_mathtools ... ok crates/flashtex-cli against the same re-pinned vendor: test result: ok. 58 passed; 0 failed cargo check --all-targets on this branch at the current pin: 0 errors. Next step: The integration lane applies docs/integration/repin-runbook.md section 3 -- swap the three vendor trees, move `compiler-node-surface` (and `linebreak-skip`) into `default`, refresh both Cargo.locks, drop the two `#[ignore]`s, update vendor/VENDORING.md. Implementation-Agent: claude-opus-5 subagent of daniel-parent Commit-Executor: daniel-parent subagent Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz
…tic equation number (#441) What changed: `adapter::strip_tag` read only a flat `Nucleus::Text`/`Symbol` label. Once `vendor/compiler` is re-pinned past #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 #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: #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
…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
left a comment
There was a problem hiding this comment.
Independent verification — VERIFIED
Reviewed at f72fc306, parent 36dff72e (#711). Worktree ~/flashtex-wt/vrfy-736,
CARGO_TARGET_DIR=/Users/dqi26/flashtex/target-vrfy-736, CARGO_BUILD_JOBS=4,
fetched as git fetch origin pull/736/head:refs/review/pr-736.
The claim I was asked to test hardest is the regression test's strength — that it
really asserts no (<digits>) word survives, and that it really fails on the parent.
Both hold, and the parent's failure output is the exact (2)/(3) the PR describes.
Scratch re-pin (runbook §3, from #711's branch)
$ cd ~/flashtex-wt/vrfy-736
$ NEW=$(git rev-parse origin/main) # 9c5b028dab1a2a74efb755b2220b35a027ef3364
$ for c in compiler tex-expansion; do
rm -rf crates/render-pipeline/vendor/$c; mkdir -p crates/render-pipeline/vendor/$c
git archive "${NEW}:crates/${c}" | tar -x -C crates/render-pipeline/vendor/$c
echo "$NEW" > crates/render-pipeline/vendor/$c/PIN
done
$ mkdir -p crates/render-pipeline/vendor/bibliography
$ git archive "${NEW}:crates/bibliography" | tar -x -C crates/render-pipeline/vendor/bibliography
$ echo "$NEW" > crates/render-pipeline/vendor/bibliography/PIN
(Note for anyone repeating this in zsh: "$NEW:crates/$c" is eaten by the :c
history modifier and git archive fails with not a valid object name. Brace it —
"${NEW}:crates/${c}". Worth a line in the runbook.)
1. The four tests pass on the branch
$ cargo test --features compiler-node-surface,linebreak-skip --test tag_rich_label
running 4 tests
test an_untagged_equation_still_gets_its_number ... ok
test a_plain_tag_is_unchanged_and_matches_pdflatex ... ok
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 result: ok. 4 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.11s
2. They fail on the parent — with the silent (2)/(3)
$ git checkout HEAD~1 -- crates/render-pipeline/src/adapter.rs # 36dff72e, #711 alone
$ cargo test --features compiler-node-surface,linebreak-skip --test tag_rich_label
running 4 tests
test an_untagged_equation_still_gets_its_number ... ok
test a_plain_tag_is_unchanged_and_matches_pdflatex ... ok
test a_rich_tag_is_never_silently_replaced_by_the_automatic_number ... FAILED
test a_rich_tag_reports_that_its_math_is_set_as_text ... FAILED
---- a_rich_tag_is_never_silently_replaced_by_the_automatic_number stdout ----
panicked at tests/tag_rich_label.rs:83:5:
automatic equation numbers ["(2)", "(3)"] were set for \tag'ged displays:
["Text.", "a", "=", "b", "(hi)", "Text.", "c", "=", "d", "(2)", "Text.", "e", "=", "f", "(3)"]
---- a_rich_tag_reports_that_its_math_is_set_as_text stdout ----
panicked at tests/tag_rich_label.rs:103:5:
assertion `left == right` failed: one note per rich tag, none for the plain one: []
left: 0
right: 2
test result: FAILED. 2 passed; 2 failed; 0 ignored; 0 measured; 0 filtered out
Exactly the 2 passed; 2 failed the PR body reports, and the failure message is the
bug: (2) and (3) on the page and an empty diagnostic list. The silence is what
makes this worse than #441's original noisy failure, and the parent run proves it
rather than asserting it.
3. The assertion is as strong as claimed
crates/render-pipeline/tests/tag_rich_label.rs:76-86:
let numbers: Vec<&String> = words.iter()
.filter(|w| w.starts_with('(') && w.ends_with(')')
&& w[1..w.len() - 1].chars().all(|c| c.is_ascii_digit()) && w.len() > 2)
.collect();
assert!(numbers.is_empty(), ...);Any (<digits>) word, not just (1) — which matters, because the counter keeps
stepping and the substituted numbers here are (2) and (3); an == "(1)" test would
have passed on the broken parent. The w.len() > 2 guard is last, so "()" is excluded
without an empty-slice panic, and the byte slice [1..len-1] is always on a char
boundary (( and ) are one byte each), so a label like (x²) cannot panic it. It is
backed by the positive assertions on :88-90 that the label's own text actually reaches
the page, so it cannot be satisfied by numbering breaking — and
an_untagged_equation_still_gets_its_number pins that independently.
The diagnostic test is anchored at the \tag's own span (:110-117), which is the part
that would silently rot if the note were ever moved to the display.
4. "Inert on the default pinned-vendor path" — checked, and true
The _ => arm at adapter.rs:3271 is not feature-gated and changes a previously
silent fall-through into Some(String::new()) + a math_limitation, so I checked that
no default-path input reaches it. With the vendor tree restored to the pinned
c95977d6, default features, rendering \tag{hi} / \tag{$x^2$} / \tag{\textbf{A}}
/ an untagged equation, branch and parent print byte-identical pages:
branch f72fc306: WORDS = ["Text.","a","=","b","(hi)","Text.","c","=","d","($x^2$)","Text.","e","=","f","(\\textbfA)","Text.","g","=","h","(4)"]
parent 36dff72e: WORDS = ["Text.","a","=","b","(hi)","Text.","c","=","d","($x^2$)","Text.","e","=","f","(\\textbfA)","Text.","g","=","h","(4)"]
DIAGS = [] on both
The old pin flattens even a rich label to one Nucleus::Text, so the Text arm still
takes it and the new arms never fire. The claim holds. (Probe file deleted; nothing
committed.)
Notes, not blockers
strip_tag's_arm sets*tag = Some(String::new()), so the caller'sSome(t)
path formats an empty tag. It is deliberate and documented ("left unnumbered"), and
unreachable today, but it is the one arm no test covers — after the re-pin makes it
reachable it would be worth a case.- The re-pin is #711's, and everything above is scratch.
git statusclean afterwards:
crates/render-pipeline/vendorrestored,PINback toc95977d6, no commit, no push.
Verdict
VERIFIED — the regression test asserts what the PR says it asserts, fails on the
parent for the stated reason with the stated output, and the change is genuinely inert
on the default path.
— independently verified by daniel-parent's review lane
d-q222
left a comment
There was a problem hiding this comment.
Independent verification round 4 (re-check after #745/#746 churn) — VERIFIED
Head f72fc306, parent 36dff72e (#711's head). Own worktrees, own
CARGO_TARGET_DIRs (target-vr4-736, target-vr4-736base, target-vr4-736repin),
CARGO_BUILD_JOBS=4.
The re-pinned evidence is the whole point of this PR and cannot be produced against the
pinned vendor, so rather than take it on trust I reproduced the re-pin — in a scratch
export outside the repository, never in a worktree:
$ git archive refs/review/pr-736 | tar -x -C <scratch>
$ git archive origin/main:crates/compiler | tar -x -C <scratch>/…/vendor/compiler
$ git archive origin/main:crates/tex-expansion | tar -x -C <scratch>/…/vendor/tex-expansion
$ git archive origin/main:crates/bibliography | tar -x -C <scratch>/…/vendor/bibliography # new
exactly the three moves docs/integration/repin-runbook.md §1 prescribes. No
vendor/ directory in the repository or in any worktree was touched, and the scratch
tree is discarded.
1. Four tests pass on the re-pinned surface
$ cargo test --release --features compiler-node-surface,linebreak-skip --test tag_rich_label
test an_untagged_equation_still_gets_its_number ... ok
test a_rich_tag_reports_that_its_math_is_set_as_text ... ok
test a_rich_tag_is_never_silently_replaced_by_the_automatic_number ... ok
test a_plain_tag_is_unchanged_and_matches_pdflatex ... ok
test result: ok. 4 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.01s
Matches the PR's claimed 4 passed; 0 failed. (--features compiler-node-surface
alone does not build — one E0063: missing field skip_pt in
parser::Inline — linebreak-skip is required too, which the PR's own command line
already says.)
2. The regression test still fails on the parent, with the literal (2)/(3)
I restored the parent's (36dff72e) two-arm body verbatim into strip_tag
(crates/render-pipeline/src/adapter.rs:3252), changing nothing else:
if let Nucleus::Text(s) | Nucleus::Symbol(s) = &a.nucleus {
*tag = Some(s.clone());
}$ cargo test --release --features compiler-node-surface,linebreak-skip --test tag_rich_label
test an_untagged_equation_still_gets_its_number ... ok
test a_plain_tag_is_unchanged_and_matches_pdflatex ... ok
test a_rich_tag_reports_that_its_math_is_set_as_text ... FAILED
test a_rich_tag_is_never_silently_replaced_by_the_automatic_number ... FAILED
panicked at tests/tag_rich_label.rs:83:5:
automatic equation numbers ["(2)", "(3)"] were set for \tag'ged displays:
["Text.", "a", "=", "b", "(hi)", "Text.", "c", "=", "d", "(2)", "Text.", "e", "=", "f", "(3)"]
panicked at tests/tag_rich_label.rs:103:5:
assertion `left == right` failed: one note per rich tag, none for the plain one: []
test result: FAILED. 2 passed; 2 failed; 0 ignored; 0 measured; 0 filtered out
["(2)", "(3)"] — the literal numbers the PR says the silent substitution produced,
in the exact positions it describes: (hi) survives (flat Nucleus::Text), and the
two rich tags become the stepping automatic counter with no diagnostic at all ([]).
2 passed; 2 failed matches the PR's own reverted-adapter.rs run exactly. The
regression test is real and still discriminates after the #745/#746 churn.
3. Inert on the default pinned-vendor path
The whole test file is #![cfg(feature = "compiler-node-surface")]
(tests/tag_rich_label.rs:32), so on the shipped configuration it is not merely
skipped, it does not exist:
$ cargo test --release --test tag_rich_label # default features, pinned vendor
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
Behaviour, not just tests. strip_tag's new _ => arm is not feature-gated, so it
is live on the default path — it is inert only if the old pin can never hand a
\tag a nucleus that is not Text/Symbol/Space. I tested that rather than assumed
it. Built flashtex-render on the branch and on the parent with default features and
the pinned vendor, and compared full v2 display lists:
% \tag{$x^2$}, \tag{hi $x^2$}, \tag{hi}, plus an untagged control
DEFAULT-VENDOR OUTPUT: IDENTICAL
base ['a','=','b','(1)','c','=','d','($x^2$)','e','=','f','(hi','$x^2$)','g','=','h','(hi)']
branch ['a','=','b','(1)','c','=','d','($x^2$)','e','=','f','(hi','$x^2$)','g','=','h','(hi)']
% harder shapes: \tag{\textbf{A}}, \tag*{hi}, \tag{\ensuremath{\alpha}},
% \tag{$\frac{1}{2}$}, an align row \tag{$*$}, \tag{\textit{x} $y$}, untagged
t2 IDENTICAL
base ['a','=','b','(\textbfA)','c','=','d','hi','e','=','f','(\ensuremath\alpha)','i','=','j',
'($\frac12$)','k','=','l','($*$)','m','=','n','(6)','o','=','p','(\textitx','$y$)','q','=','r','(8)']
branch … identical …
and the whole corpus:
=== 736 corpus (pinned vendor): identical=21 differs=0 ===
The old compiler flattens every one of these to a single Nucleus::Text (note
($x^2$) — the $…$ survives as literal text), so the Text|Symbol arm always fires
and neither the TextRun nor the _ arm is ever reached. Inert on the default
pinned-vendor path: confirmed empirically, on 7 tag shapes and 21 fixtures.
Findings
-
crates/render-pipeline/src/adapter.rs:3278— the_ =>arm is live on the
default path, and the PR body does not say so. The body frames the change as
"behindcompiler-node-surface"; only theTextRunarm is. The catch-all arm
(notes.push(…),*tag = Some(String::new())) compiles unconditionally, so if any
future compiler surface — not just the re-pin — starts handing\taga nucleus
other thanText/Symbol/Space, that arm changes shipped behaviour with no
feature flag in the way. §3 shows it is unreachable today, which is why this is a
note rather than a blocker, and the arm is the right safety net to have. But
"inert" here is an empirical property of the current pin, not a structural
guarantee, and the body should say which of the two it is claiming. -
crates/render-pipeline/tests/tag_rich_label.rshas no default-features
counterpart. Because the file is entirelycfg-gated, the_ =>arm from
finding 1 is covered by nothing on the shipped configuration — the 21-fixture
comparison in §3 is mine, not a test in the tree. A one-line default-features test
that a plain\tag{hi}still sets(hi)would pin the inertness the PR relies on.
Not blocking.
Everything the PR claims reproduced: 4 passed on the re-pin, 2 passed; 2 failed
with adapter.rs reverted, the literal (2)/(3), and inertness on the pinned
vendor. VERIFIED.
— independently verified by daniel-parent's review lane
|
Commander (daniel-parent), independent Opus review of PR #736 review: render-pipeline: a rich \tag is never silently replaced by the automatic numberReviewer: opus (independent, read-only). Head Context checked against source
MATERIAL findingsNone. The new
Both call sites (the Non-blocking notes
Tests run (sequentially,
|
…470 re-pin (#441) Brings daniel-parent's `agent/daniel-parent/tag-placement-pipeline` in against today's `crates/render-pipeline`, 730 commits past its merge base: - The compiler half of the branch (`1b6f03f2`: a `\tag` in an `align`/`gather`/`multline` row replaces its number) is dropped -- main's parser already does this (`custom_tag_text`, multline label resolution), so `crates/compiler` is untouched. - The `compiler-text-run` feature is folded into the default `compiler-node-surface`: `vendor/compiler` and `vendor/math-layout` carry `TextRun`/`TextPiece` already (PIN `0bc4a2c7a`, `456ff1e6`), so the arms are live rather than gated off. - `incremental.rs` (`hash_math`/`shift_math` TextRun arms), the `math_grids`/`math_glue_em`/`math_approximations` walks and the `line_break_inline` lowering keep main's versions, which already cover the branch's. - The `TextRun` conversion arm replaces main's interim splice (formulas spliced into one list at the enclosing style) with math-layout's `Nucleus::TextRun`: text pieces in the face their `TextStyle` names (`\textbf`/`\emph` with `\check@icr`'s italic correction), formulas as their own lists at `\textstyle`. - `strip_tag` keeps main's `notes` argument and its "never `None`" contract (#736); a `TextRun` label now becomes a `TagLabel` carrying the run, set by `math_number_box` as `\maketag@@@`'s `\hbox`, and the `math_limitation` warning for it goes away. main's multline number move in the adapter now carries `number_math` with `number` (the branch had no such move, so its tag would have been set as flattened text). - `rows_block` keeps main's `eqnarray` strut/`\jot` handling around the branch's own-line tag placement (`\place@tag`/`\place@tag@gather`). - Fixtures 47/48 collided with main's `cm-math-roman-boxes`; the branch's gather own-line fixtures are 51/52. `display_placement.rs` lists the twelve rich-tag fixtures unconditionally. Measured on this lane's tree (display-placement `oracle.py check`, pdflatex TeX Live 2026, 0.5 bp): 37-46, 51, 52 all PASS, worst 0.005 bp, the pre-existing set unchanged; `render-corpus-v2.sh` output for all 71 real-world and divergence fixtures is byte-identical to `c859468d1`'s. 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
… 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
Stacked on #711 (
agent/daniel-parent/repin-evidence), whosecompiler-node-surfacefeature this needs, so the diff carries #711's commit until it lands. One commit is mine:
f72fc306,crates/render-pipeline/src/adapter.rs(+52/-5) and a newcrates/render-pipeline/tests/tag_rich_label.rs.What
adapter::strip_tagread only a flatNucleus::Text/Symbollabel:Once
vendor/compileris re-pinned past #470,\tag{hi $x^2$}arrives asNucleus::TextRuninstead of a flat string. Theif letdid not match, the atom wasdropped anyway,
tagstayedNone— and the caller'sNonearm is the automaticequation number. So the tag vanished and a plausible
(2)/(3)took its place, withno diagnostic of any kind.
That is worse than the diagnostic #441 was filed for. The old failure was noisy and the
user knew; this one makes the document wrong in a way that looks right — a reader
cross-referencing "equation (3)" against a source that says
\tag{hi $x^2$}has nothingto notice.
strip_tagnow matches the nucleus exhaustively:\tagText/Symbol(\tag{hi})Space(the compiler's interim2\quadgap, which spans the command too)TextRun(\tag{hi $x^2$},\tag{\textbf{A}})math_limitationat the\tagThe
TextRunarm is behindcompiler-node-surface(the feature that presumes the newercompiler surface — the old pin cannot produce the variant). The text it sets is
math::text_run_reference_text, the same flattening the compiler uses for\eqreftothis tag, so the set label and a reference to it read alike.
This diagnoses and approximates; it does not set the tag as amsmath does. The label
is upright text with a Unicode superscript, not
\maketag@@@'s hbox, so it lands~1.31 bp from pdflatex where a plain tag lands 0.005 bp away. That is exactly what the
math_limitationsays.Why this is a new PR and not part of #585
#585 is the real fix and I did not touch it. But #585 does not close this hole: its
rich-label arm is
#[cfg(feature = "compiler-text-run")], and its fallback is still_ => {}— the same silent drop — whenever that feature is off, which is how #585 landsand how it stays until
vendor/compilerandvendor/math-layoutare both re-pinned.The compiler half (#470) is already on
main, so the window between the compiler re-pinand #585's feature going default is precisely when a
\tag{hi $x^2$}silently becomes anumber. This commit closes that window and nothing more.
The two touch the same function, so #585 will conflict here textually. The resolution is
one-directional and small: #585's
compiler-text-runarm replaces this one'scompiler-node-surfacearm, theSpaceand_arms stay, and thenotesparameterstays so the
_arm can still report. I have not pre-empted any of #585's placement,leqno, own-line,align/gather/multlineor\tag*work.Before / after, all three tag shapes
10 pt article +
lmodern+ amsmath, oneequationeach, re-pinned vendor,compiler-node-surface.x0in bp; pdflatex is TeX Live 2026 via PyMuPDF.\tag{hi}(hi)@ 461.433(hi)@ 461.428(hi)@ 461.428 (dx 0.005)\tag{$x^2$}(x2)@ 459.573(2)@ 464.749, no diagnostic(x²)@ 460.892 (dx 1.319) +math_limitation\tag{hi $x^2$}(hi@ 447.959,x2)@ 463.461(3)@ 464.749, no diagnostic(hi@ 449.270,x²)@ 464.767 (dx 1.311 / 1.306) +math_limitationThe diagnostic, at the
\tag's own span:The existing oracle fixture
15-align-tag-notag-eqrefshows the same thing in a realcorpus document — its third
alignrow is\tag{$*$}:Regression test
crates/render-pipeline/tests/tag_rich_label.rs, four tests. Two of them fail on thisbranch with only
adapter.rsreverted:The first asserts no
(<digits>)word survives on a page whose every display is\tagged — not just(1), because the counter keeps stepping and the substitutednumbers were
(2)and(3). The controls pin that a plain\tag{hi}still matchespdflatex within 0.5 bp and reports nothing, and that an untagged
equationstillgets its number.
Overlap check
gh pr list --state open --search "tag": render-pipeline: rich \tag placed as amsmath does — margin, leqno, own line, align/gather/multline (#441 PR 2; needs re-pin past #470) #585 (above, read before changing anything),render-pipeline: \textsuperscript/\textsubscript raised at sf@size (needs #507 re-pin) #508 (
\textsuperscript, other functions), compiler:\item[<label>]is a text run — nested math, styles, no silent drops (#676, PR 1 of 2) #702 (\item[..]text runs, compiler side).--search "441"finds render-pipeline: rich \tag placed as amsmath does — margin, leqno, own line, align/gather/multline (#441 PR 2; needs re-pin past #470) #585 and compiler + math-layout: \tag and \text can contain math — a TextRun nucleus with nested $…$ (#441, PR 1 of 2) #470 only.python3 scripts/coord.py claims:GH-441-TAG-TEXTRUN(compiler + math-layout: \tag and \text can contain math — a TextRun nucleus with nested $…$ (#441, PR 1 of 2) #470, daniel-parent, thecompiler half of this issue) and
GH-441-TAG-PLACEMENT-PIPELINE(render-pipeline: rich \tag placed as amsmath does — margin, leqno, own line, align/gather/multline (#441 PR 2; needs re-pin past #470) #585). ClaimedGH-441-TAG-SILENT-DROPasdaniel-parenton this branch before starting.strip_tagonorigin/mainstill has the two-armif let, and reproducing against a scratch re-pin printed(2)/(3)(above).Vendor gate
git diff --stat origin/main...HEAD | grep -c vendoris 0. The scratch swap used forevery measurement below (runbook §3:
compiler,tex-expansion, newbibliography) wasreverted with
git checkout -- crates/render-pipeline/vendor && git clean -fd crates/render-pipeline/vendor, andcrates/render-pipeline/Cargo.lockwas restored too —the lockfile stanza belongs to the re-pin, not here.
Test results
Not done
(hi x²)is upright text with a Unicode superscript,1.31 bp from pdflatex. render-pipeline: rich \tag placed as amsmath does — margin, leqno, own line, align/gather/multline (#441 PR 2; needs re-pin past #470) #585 sets it as
\maketag@@@'s hbox at 0.004 bp; this PR is thestopgap for the window described above, not a replacement for it.
\eqrefto a rich tag still resolves to the stale automatic number ((2)infixture 15 where pdflatex gives
(∗)). That is compiler-side — render-pipeline: rich \tag placed as amsmath does — margin, leqno, own line, align/gather/multline (#441 PR 2; needs re-pin past #470) #585 carries thecommit that makes a row's
\labeltake its\tag— and is out of scope here.\ignorespaces…\unskiptrimming of a rich label (\tag{ hi }) is notapplied; render-pipeline: rich \tag placed as amsmath does — margin, leqno, own line, align/gather/multline (#441 PR 2; needs re-pin past #470) #585's
trim_tag_piecesdoes it.until render-pipeline: rich \tag placed as amsmath does — margin, leqno, own line, align/gather/multline (#441 PR 2; needs re-pin past #470) #585 lands, and pinning a reference the approximation fails would just add a
known-red row;
tag_rich_label.rspins the pdflatex numbers in its own assertionsinstead.
🤖 Generated with Claude Code
https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz