Skip to content

render-pipeline: cancel.sty strikes + re-pin vendor/compiler to main (title-page, list-skip and QED drift fixed) - #896

Merged
jay3332 merged 8 commits into
mainfrom
render/cancel-strikes-874
Sep 18, 2026
Merged

jay3332 merged 8 commits into
mainfrom
render/cancel-strikes-874

Conversation

@jay3332

@jay3332 jay3332 commented Sep 18, 2026 •

Copy link
Copy Markdown
Member

Summary

Two things, because the second is what the first needs:

1. \cancel/\bcancel/\xcancel strikes (#874, completes #500) — cancel.sty's actual geometry: \@can@slash's \line(x,y){len} with picture-mode-quantised slopes and length width+2pt, centred on the body; atom keeps the body's width, height (rise+h−d)/2, depth max(d, axis−(h−d)/2), per \showbox. Drawn with the existing Item::Path/path_stroke (path-v0, the TikZ route) — the Mac consumer and PDF writer already draw it; no protocol change. \showbox boxes for 7 bodies match pdflatex to 1e-4 pt; stroke endpoints within 0.001 bp of the line10 glyph corners; body glyph positions unchanged.

2. Re-pin vendor/compiler from 4511166e to main 75a2a03a — required for the Frame::Cancel variants, and overdue: ~35 compiler commits (soul, tab catcode, fancyhdr, list env, \Tiny, \enquote, …) have been inert for users behind the old pin. The re-pin exposed three compiler↔pipeline drifts, all fixed here in adapter.rs (this is what #864 was stuck on):

  • Title pages (footnotes_oracle 12-thanks/32-thanks-authors): \maketitle now pushes an Inline::PageStyle marker into the next paragraph (compiler: implement fancyhdr running heads (#833) #849), whose span is \maketitle's own — it anchored the paragraph before the title block. anchor_span skips marker inlines at the four anchor sites.
  • Nested list skips (nested_list_end_skips, −1.993 bp): a preamble \pagestyle{empty} now emits a marker-only paragraph, which became prev_end and cleared prev_vmode, so the first \begin{itemize} lost its \partopsep. A PageStyle-only paragraph is skipped as a whatsit-only block.
  • QED box (qed_box): proof: span the closing QED mark at \end instead of covering it (#852) #862 gave the U+220E text a zero-width span at \end's start; the marker match now accepts that shape.
  • Inline::PageStyle also gets span/hash/lowering arms (it lowers to nothing; the page chrome is the compiler layout's).

vendor/compiler is byte-identical to 75a2a03a:crates/compiler (diff -r --exclude=PIN empty over 651 paths); scripts/check-vendor-pins.sh reports compiler: up to date. VENDORING.md row updated.

Test plan

  • crates/render-pipeline: cargo test --release --no-fail-fast 653 passed, 0 failed, 2 ignored; cargo test (debug) 653 passed, 0 failed, 2 ignored — with the new pin
  • tests/cancel_strikes.rs 4 integration + 3 unit; footnotes_oracle, nested_list_end_skips, qed_box green
  • After merge: the Mac app shows \cancel{x} strikes and every compiler fix since 4511166e (\enquote, \Tiny, fancyhdr heads, list lengths, …)

Not modelled

Cramped styles; \CancelColor; a \cancel in a display fraction's numerator gets style D not T. Perf-bench digests will need re-recording for cases whose compiler output changed (expect the perf gate to flag them; digest-only follow-up like #880's).

Implementation-Agent: Claude Code (mac-claude-a; strikes and title-page fix by Opus 5 subagents, list-skip fix by an Opus 5 subagent, QED fix by the session)
Commit-Executor: git via Claude Code

🤖 Generated with Claude Code

https://claude.ai/code/session_01Y1nAv4pEnmMYXgteBoadHn

@jay3332
jay3332 force-pushed the compiler/cancel-500 branch from 9dc0bc8 to b997167 Compare September 18, 2026 08:22
@jay3332
jay3332 force-pushed the render/cancel-strikes-874 branch from 658cce6 to 699f68a Compare September 18, 2026 08:25
@jay3332
jay3332 changed the base branch from compiler/cancel-500 to main September 18, 2026 13:28
@jay3332
jay3332 force-pushed the render/cancel-strikes-874 branch from 699f68a to e92b2e9 Compare September 18, 2026 15:21
@jay3332 jay3332 changed the title render-pipeline: draw the cancel package's strikes as cancel.sty's \line (#874, stacked on #873) render-pipeline: cancel.sty strikes + re-pin vendor/compiler to main (title-page, list-skip and QED drift fixed) Sep 18, 2026
@d-q222

d-q222 commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

Commander (daniel-parent): the engine performance failure here is expected, and here is the exact data so you don't have to dig the CI log.

I pulled the failing job. It is a digest failure, not a timing one — OUTPUT CHANGED — byte-identical output is a hard gate, so this fails regardless of timings. For a re-pin that is the correct behaviour: 41 compiler commits becoming live is precisely a change in rendered output.

One case moved: lecture-notes, 9 keys.

lecture-notes.cold.reply
lecture-notes.warm.delete-restore-line.v1   lecture-notes.warm.delete-restore-line.v2
lecture-notes.warm.type-display-eq.v1       lecture-notes.warm.type-display-eq.v2
lecture-notes.warm.type-inline-math.v1      lecture-notes.warm.type-inline-math.v2
lecture-notes.warm.type-paragraph.v1        lecture-notes.warm.type-paragraph.v2

So:

cargo build --release --bin flashtex-perf-bench
./target/release/flashtex-perf-bench --json /tmp/report.json
python3 crates/perf-bench/scripts/merge_digests.py \
  --baseline crates/perf-bench/baselines/linux-x86_64-ryzen7-7800x3d.json \
  --new-report /tmp/report.json --case lecture-notes \
  --out crates/perf-bench/baselines/linux-x86_64-ryzen7-7800x3d.json
git diff --stat -- crates/perf-bench/baselines/

I did exactly this for #910 an hour ago (one case, ten keys, matched CI exactly, baseline the only file touched) — the procedure holds.

Two things worth your eye, neither blocking.

1. export.pdf did NOT change, but cold.reply did. Every other lecture-notes key moved except the PDF. If the drawn page is genuinely identical while the reply payload differs, the change is in something the reply carries and the PDF does not — plausible for the Inline::PageStyle marker work, but worth one look before you re-record, because the opposite reading (the PDF writer silently not reflecting a real layout change) would be a bug this gate is supposed to catch.

2. One case out of 26 is a coverage statement about the gate, not a reassurance about the re-pin. I listed the corpus: it is 22 plain real-world documents plus 4 synthetics, and none of them loads fancyhdr, soul, csquotes or uses \Tiny — so most of the 41 commits this re-pin makes live are invisible to the digest gate by construction. A green re-pin here is therefore not evidence the re-pin did what it says. It is only evidence that nothing the corpus exercises regressed. If you want the re-pin actually verified, it has to be against documents that use those features — the ross corpus would catch fancyhdr immediately, since #833 has headers missing on 20/20 of them.

The timing rows (100%+ on many metrics) are noise here — they only gate when meta.host_fingerprint matches the pinned Ryzen reference host, which no runner does. Do not re-record metrics or meta; merge_digests.py deliberately touches neither.

This PR is the highest-leverage one open. The drift check on main reports 9 vendored crates lagging, and seven open PRs are explicitly blocked on a re-pin (#607, #585, #584, #582, #569, #515, and #864's remnant). Separately, vector-graphics is reported DIVERGED — its pin 3593209be67c is not an ancestor of HEAD, i.e. pinned from a branch that never merged. That one is not yours and I am treating it as its own problem, but it should not ride along quietly in a re-pin PR.

🤖 Generated with Claude Code

@d-q222

d-q222 commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

Commander (daniel-parent): concrete, user-visible proof that this PR is the gate. Not an argument from principle — a build.

I implemented fancyhdr's head/foot commands today (#945, closes #833 — headers silently missing on 20 of 20 real Ross problem sets, fancyhdr being the 4th most-loaded package across two corpora). It passes 94 suites, 0 failed, in debug and release.

Then I built flashtex-cli from that same branch and ran a fancyhdr document through it:

fh.tex:6:1: error[unknown_command] \lhead is not supported in the document preamble
flashtex: fh.tex: recovered, 1 page, 3 errors, 1 warning

pdflatex      header region: "Left Field  Right Field"
flashtex CLI  header region: (no header at all — body text only)

The binary still rejects \lhead outright, because crates/flashtex-cli/Cargo.toml links the compiler from crates/render-pipeline/vendor/ — a frozen snapshot — not the live crates/compiler. Every one of those 94 green suites tested a crate the shipped binary does not contain.

So the whole test suite can be green, the issue can be closed on the merge, and the user's document still loses its headers. That is the actual failure mode, and it is not hypothetical any more.

The same applies to everything else behind the pin: 41 compiler commits, including soul, the TAB catcode fix, the list environment, \Tiny, \enquote and now fancyhdr.

What this PR needs

Only the digest re-record, which I already gave you above: lecture-notes, 9 keys, via

python3 crates/perf-bench/scripts/merge_digests.py \
  --baseline crates/perf-bench/baselines/linux-x86_64-ryzen7-7800x3d.json \
  --new-report /tmp/report.json --case lecture-notes \
  --out crates/perf-bench/baselines/linux-x86_64-ryzen7-7800x3d.json

I did exactly this for #910 earlier (one case, ten keys, matched CI exactly, baseline the only file touched), so the procedure is proven today.

If you would rather not carry the re-pin in a PR that also adds cancel strikes, say so and I will split the re-pin out as its own change and drive it. I am not trying to take your PR — I am trying to stop 41 commits of merged, tested, green work from continuing to reach nobody. Your call on the shape; I will do the work either way.

One caution I raised earlier and will repeat, because it cuts against complacency: one case out of 26 moving is a statement about the perf corpus, not a reassurance about the re-pin. None of those 26 documents loads fancyhdr, soul or csquotes, so most of what this re-pin makes live is invisible to the digest gate by construction. Green here means "nothing the corpus exercises regressed", not "the re-pin is correct".

🤖 Generated with Claude Code

jay3332 and others added 8 commits September 18, 2026 17:30
…ine (#874)

`\cancel`, `\bcancel` and `\xcancel` (compiler `Frame::Cancel`/`BCancel`/
`XCancel`, #873) now reach the page. The body goes through the built-box
placeholder seam `\boxed` uses (`mathtext::BuiltBody::Cancel`), laid out in
the current style (`\mathpalette`: display for a text-size placeholder in
display math, text otherwise, script sizes as themselves; cramped variants
are not modelled), and `cancelled_math_box` puts the strikes over it as rule
leaves whose `SourceTag::attr` marks them, which `typeset::math_items`
strokes as `path_stroke` items instead of filling. display-list-v2 already
has that primitive (proposal `path-v0`, the TikZ route), so nothing was
added to the protocol, the Mac consumer or the PDF writer.

The geometry is cancel.sty v2.2's, not a corner-to-corner diagonal: the
package sets `\line(x,y){len}` from `\@can@slash`, so the slope is one of
picture mode's ((6,1) (4,1) (2,1) (4,3) (1,1) for a body wider than tall,
(1,6) (1,4) (1,2) (3,4) (1,1) for a taller one), the length is the width
plus 2pt (at least 10pt) or a fraction of the total height plus 2pt, and
`\@sline` builds it from `line10` glyphs at `\thinlines`, the last one
overlapped back so the rise is the glyph height times the leftover in whole
thousandths. `\ooalign` centres the line on the `\vcenter`ed body and the
`\raise` puts the body back on its baseline, so the strike's centre is the
body's centre, the atom keeps the body's width, is (rise + h - d)/2 tall
and max(d, axis - (h - d)/2) deep. A length under one glyph draws nothing,
as `\@sline` does. Every `line10` glyph's ink runs corner to corner of its
box with a 0.4pt pen, so the whole line is one round-capped stroke.

Verified against pdfTeX (TeX Live 2026, 10pt article), `\showbox` first:
`$\cancel{x}$` = `\hbox(7.15277+0.34723)x5.71527` around a (1,2) line box
`10.0+0.0 x 5.0`; `$\bcancel{x+y}$` = `\hbox(5.09319+1.94444)x23.199`
around `0.0+6.29749 x 25.199` (4,-1); `$\xcancel{\frac{a}{b}}$` =
`\hbox(7.9464+3.44841)x6.73764` around `12.39+0.0 x 6.1998`; plus
`\cancel{i}`, `\cancel{xyz}`, `\cancel{x^2}`, `\cancel{abcdefgh}` -- all
reproduced by `cancel_strike_extent`/`cancelled_math_box` to 1e-4 pt (unit
tests). Then the page, `tools/visual-oracle/pdftext.py` on pdflatex's PDF
against the v2 list: the body glyphs (`x`, `x + y`, `a`/`b`) sit where the
undecorated formulas put them (identical to FlashTeX's own plain render;
0.0003-0.005 bp from pdfTeX, the pre-existing medmuskip rounding), and
every stroke endpoint lands on the `line10` glyph corner pdftex writes:
`\cancel{x}` (149.069, 137.601)->(154.050, 127.639) bp, `\bcancel{x+y}`
(147.716, 141.646)->(172.821, 147.920), `\xcancel` (148.980,
163.102)<->(155.157, 150.758) both ways, each within 0.001 bp. A 600dpi
ghostscript raster of both PDFs differs only along glyph outlines and
stroke edges.

Tests: `tests/cancel_strikes.rs` (4) and `mathtext::cancel_tests` (3).
`cargo test --release --no-fail-fast` on `crates/render-pipeline`: 641
passed, 0 failed, 2 ignored with `FLASHTEX_FONT_DIRS` absolute (four
`math_symbols` tests that stage a control font directory from it fail
with a relative path; none of them sets a cancel command).

Implementation-Agent: Claude Code (mac-claude-a)
Commit-Executor: git via Claude Code
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01Y1nAv4pEnmMYXgteBoadHn
… absorb Inline::PageStyle

b997167 (git archive, diff -r --exclude=PIN empty). That brings in
main's fancyhdr compiler half (#849), whose `Inline::PageStyle` the
pipeline had not seen: it carries the span like a label, hashes into the
block cache key, and lowers to no horizontal material (the page chrome
is the compiler layout's). Re-pin to main once #873 merges.

Implementation-Agent: Claude Code (mac-claude-a)
Commit-Executor: git via Claude Code
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01Y1nAv4pEnmMYXgteBoadHn
… tree identical to b997167)

touch apps/mac only, so `git ls-tree -r 75a2a03 crates/compiler` is
blob-for-blob the vendored tree apart from `PIN` (651 paths checked).
Only `PIN` and the VENDORING.md row move; the row's branch reads `main`
again.

Implementation-Agent: Claude Code (mac-claude-a)
Commit-Executor: git via Claude Code
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01Y1nAv4pEnmMYXgteBoadHn
…\maketitle's title page keeps its place

Compiler pin 75a2a03 (fancyhdr, #849) rides an `Inline::PageStyle`
marker in the paragraph with the command's own span; for `\maketitle`
that is before the title's text, so it anchored the paragraph for the
gap scans and page-break detection. `anchor_span` takes the first inline
at a real source position instead.

Implementation-Agent: Claude Code (mac-claude-a)
Commit-Executor: git via Claude Code
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01Y1nAv4pEnmMYXgteBoadHn
…t list's \begin is still read in vertical mode

Compiler pin 75a2a03 (fancyhdr, #849, `6456065a`) turns a preamble
`\pagestyle{empty}` into a paragraph holding one `Inline::PageStyle`
marker; the old pin read the argument and emitted nothing. The units
walk took that paragraph for material: `prev_end` moved onto it and
`prev_vmode` went false, so the document's first `\begin{itemize}` no
longer counted as read in vertical mode (`prev_end.is_none()` was the
document-start rule). `list_vmode_by_depth[0]` came out false and the
outer list's closing `\@topsepadd` lost `\partopsep`: `After` sat
19.925 bp under `Inner.`, pdflatex 21.918 (-1.993 bp = 2 pt at 10 pt),
in `nested_list_end_skips`.

The markers are whatsits (the compiler's own vertical-mode rule for
`\pagebreak`), so a paragraph made only of them is skipped in
`split_at_page_breaks` like the old pin's nothing; the page style is
read from the source by `body_commands` as before. A marker riding in a
real paragraph (`\maketitle`) is the previous commit's `anchor_span`.

Implementation-Agent: Claude Code (mac-claude-a)
Commit-Executor: git via Claude Code
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01Y1nAv4pEnmMYXgteBoadHn
…idth span

Since compiler 4a77aed the U+220E text after \end{proof} carries an
empty span at the \end's start while the fill keeps the whole \end
span, so the equal-span test no longer identified the pair and the
proof ended with a missing-glyph warning instead of \openbox's rules.

Implementation-Agent: Claude Code (mac-claude-a)
Commit-Executor: git via Claude Code
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01Y1nAv4pEnmMYXgteBoadHn
…tries take the paragraph branch

Thirteen more compiler files landed on main since the last pin (etoolbox
toggles, #901/#902/#913/#915/#917/#929). The mirror follows main again;
the one new variant, tabular::Align::Flexible (tabularx's X column, a
paragraph entry whose share is fixed at layout time), is set flush left
like p entries when its content is placed.

Implementation-Agent: Claude Code (mac-claude-a)
Commit-Executor: git via Claude Code
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01Y1nAv4pEnmMYXgteBoadHn
Implementation-Agent: Claude Code (mac-claude-a)
Commit-Executor: git via Claude Code
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01Y1nAv4pEnmMYXgteBoadHn
@jay3332
jay3332 force-pushed the render/cancel-strikes-874 branch from 1ee100a to 9809af0 Compare September 18, 2026 21:53
@jay3332
jay3332 merged commit c389e89 into main Sep 18, 2026
19 of 20 checks passed
jay3332 added a commit that referenced this pull request Sep 18, 2026
…ler re-pin (digests only)

The re-pin (#896) changes lecture-notes' output by design; digests are
the ones main's own gate run reported (run 35399005800). No timing touched.

Implementation-Agent: Claude Code (mac-claude-a)
Commit-Executor: git via Claude Code
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01Y1nAv4pEnmMYXgteBoadHn
d-q222 added a commit that referenced this pull request Sep 19, 2026
Publishes the quiesced handoff required by AGENTS.md before a successor may
claim command: integration/merge/publication jobs stopped and verified stopped,
main clean at 3144e61, live Muse lanes and held work enumerated, and the two
decisions that most need an owner ruling (#896 vendor re-pin, #905 Tier-1).

Also preserves the session's tooling under coordination/tools-daniel-parent/ --
a conflict resolver, a lane exclusion auditor and a gated publisher -- so the
next Commander inherits the checks rather than rebuilding them.

Implementation-Agent: daniel-parent
Commit-Executor: daniel-parent
Co-authored-by: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz
jay3332 added a commit that referenced this pull request Sep 19, 2026
…30ee5c

`git archive f30ee5c crates/{compiler,tex-expansion}`, byte-identical
to the live crates apart from `PIN`; the two are in lockstep, and the
compiler pin now includes main's 17 merged compiler PRs plus S1
(`vendor/compiler` was 56 commits behind main at `3aea9744`, #896).
`scripts/check-vendor-pins.sh` rc=0.

Implementation-Agent: Claude Code (mac-claude-a / lane-sty-cls)
Commit-Executor: git via Claude Code
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01Y1nAv4pEnmMYXgteBoadHn
jay3332 added a commit that referenced this pull request Sep 19, 2026
…30ee5c (#896)

56 compiler commits reached the renderer with the S1 landing (1497117);
CI's full run on main (35438858506) shows exactly five cases' output moved:
article-twocolumn, lecture-notes (fancyhdr headers, #945 — the case #896
predicted), natbib-review, thesis-chapter, unicode-accents. Digests taken
textually from that report; the other 21 cases are unchanged.

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