Repository navigation
render-pipeline: a proof's QED mark is amsthm's \openbox, four rules, not the glyph-less U+220E (#443) - #699
Conversation
… not U+220E
What changed:
`\end{proof}` appends `\hfill` + U+220E (END OF PROOF), but amsthm's
`\qedsymbol` is `\openbox` -- not a character at all:
\hbox to.77778em{\hfil\vrule\vbox to.675em{\hrule width.6em\vfil\hrule}\vrule\hfil}
an *open* square .6em wide and .675em tall drawn with four rules at TeX's
default 0.4pt thickness. U+220E is a *filled* square and Latin Modern has no
glyph for it, so the mark warned `missing_glyph` and drew nothing (GH#443).
- adapter.rs: new `Item::QedBox { style, span }`. The compiler's proof-end
marker is unambiguous -- `\end{proof}` emits an `Inline::HFill` with no
leader and an `Inline::Text` of U+220E with the *same* span -- so only that
pair converts; a U+220E typed in the source still takes the text path.
- typeset.rs: `Context::qed_items` sets the hbox: a kern per `\hfil`, four
`BoxRec::Rule`s, and a kern pulling the second `\hrule` back over the first.
`em` is the face's quad (`\fontdimen6`); the 0.4pt thickness is absolute.
Kerns between boxes are not break points, so the mark stays on one line.
- incremental.rs: cache-key hash and span relocation for the new item.
- tests/qed_box.rs: the pdflatex oracle's four rules, to 0.1bp, at 10pt and
12pt.
What was run:
cargo test --test qed_box --test theorem_head_separator --test theorem_items \
--test layout_cache_keys --test v2_and_math --test amsthm_topsep
test proof_ends_with_amsthms_open_box_where_pdflatex_draws_it ... ok
test the_open_box_is_measured_in_the_current_fonts_quad ... ok
test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out (qed_box)
test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out (amsthm_topsep)
test result: ok. 6 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out (layout_cache_keys)
test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out (theorem_head_separator)
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out (theorem_items)
test result: ok. 6 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out (v2_and_math)
flashtex build on the issue's repro, was `warning[missing_glyph] U+220E ...`:
flashtex: qed.tex: ok, 1 page, 0 errors, 0 warnings
and the PDF now holds, against pdflatex's strokes at 470.417/470.616/476.793:
470.2177829742431640625 657.23536777496337890625 0.398505210876464843 6.724781990051269 re f
470.6162891387939453125 663.56164455413818359375 5.977583885192871093 0.398505210876464 re f
470.6162891387939453125 657.23536777496337890625 5.977583885192871093 0.398505210876464 re f
476.5938730239868164062 657.23536777496337890625 0.398505210876464843 6.724781990051269 re f
Next step:
`\qedhere` and a proof ending in a display (issue #443 items 2 and 3) are a
compiler lane; the compiler still emits U+220E rather than a dedicated marker
because the pipeline builds against the frozen vendor/compiler mirror.
Implementation-Agent: claude-opus-5 subagent of daniel-parent
Commit-Executor: daniel-parent subagent
Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz
…699) What changed: This PR (agent/daniel-parent/qed-glyph, #699) intentionally changes how a proof's QED mark renders: amsthm's `\openbox` (four drawn rules) instead of the glyph-less U+220E, which has no glyph in the shipped fonts. That is exactly the rendering path `lecture-notes` exercises, so its 10 output digests (cold.reply, export.pdf, and 8 warm-scenario reply hashes) change; every other case's digests, and all `metrics`/`meta`, are untouched. Re-recorded with the new digest-only merge tool from #770 (see that PR for the full mechanism and rationale): cargo build --release --bin flashtex-perf-bench # CARGO_TARGET_DIR=target-perfdigest, CARGO_BUILD_JOBS=4 ./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 Recorded on macOS/arm64 (not the pinned Ryzen/Linux reference host), which is fine for digests specifically: they hash only rendered-output bytes, with no timing/RSS/CPU input, and were independently confirmed portable (a full 26-case, 214-digest recording on this machine matched the committed Linux baseline byte-for-byte except for these exact 10 entries). `metrics`/`meta` (host_fingerprint, cpu, build_target, ...) are untouched — this machine's numbers were never written anywhere near the committed file. What was run: - Full-corpus recording (26 cases, release build): 214 digest entries total, 25 of 26 cases unchanged, only `lecture-notes` differs, in exactly the 10 keys listed above (diffed independently with a separate script, not just the merge tool's own report). - merge_digests.py's built-in self-check (schema_version/meta/targets/ unmeasured/every other case/every other field of this case all byte-identical before it would write) passed. - `--print <new report> --baseline <updated baseline>`: no digest mismatch reported for any case (the only FAIL shown is an unrelated font-path timing warning between two macOS runs' font_dirs, irrelevant to the digest gate and irrelevant on CI, where --require-same-host means the timing checks never fire on GitHub's runner pool anyway). Next step: CI's `engine performance` digest check should now pass on this PR. Timing metrics/meta remain the original Ryzen/Linux baseline, so --require-same-host continues to gate correctly wherever it can actually fire. Implementation-Agent: claude-opus-5 subagent of daniel-parent Commit-Executor: daniel-parent subagent Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz
|
Why the new output is correct: this PR changes a proof's QED mark from What changed, exactly:
CI should now pass the digest check. |
… QED-glyph re-record Merging main brought in #699's own digest re-record (lecture-notes, 10 keys, for the unrelated QED-glyph fix), which conflicted textually with this branch's own lecture-notes change on the same single-line JSON file. Re-recorded all 19 previously-changed cases on the fully-merged tree (main's tip + this branch's fix) rather than hand-resolving the conflict, so lecture-notes' digests now reflect both fixes composed together correctly, not just one side. --check: OK, 549 metrics, no regression.
…nd main's #699 Same conflict class as #754's own merge just now: re-recorded all 19 previously-changed cases on the fully-merged tree (main's tip + #754's fix + this branch's own text-run fix) rather than hand-resolving the single-line JSON conflict, so every digest reflects all three changes composed together. --check: OK, 549 metrics, no regression.
What changed: `engine performance` was failing on ~10 open PRs. Two prior lanes established the CI gate's TIMING checks never fire on GitHub runners (--require-same-host never matches the pinned linux-x86_64-ryzen7-7800x3d host), so the ONLY thing that can actually fail is a byte-identical output-digest mismatch against crates/perf-bench/baselines/linux-x86_64-ryzen7-7800x3d.json. Several open PRs legitimately change rendered output and trip that correctly - they need their affected digests re-recorded, but perf-bench had no way to do that without `--json`/`--update-baseline` overwriting the whole report, including the Ryzen-only `metrics` and `meta.host_fingerprint`, which would silently destroy the timing baseline and disable --require-same-host forever. Adds crates/perf-bench/scripts/merge_digests.py: copies ONLY the named cases' `digests` from a freshly recorded report into the committed baseline via a text splice (not a re-serialize), leaving metrics/meta/schema_version/ targets/unmeasured and every non-named case byte-identical - verified both by construction and by a self-check before it writes. No case list defaults to "update everything"; every case must be named explicitly with --case, and zero --case flags is a legitimate no-op, not a shortcut. Refuses to run if the baseline/new-report case-id sets differ, if a named case is missing from either, or if a case is repeated on the command line. Documents the re-record process in crates/perf-bench/README.md: digests are portable (proven separately: a full macOS/arm64 recording matched the committed Linux baseline byte-for-byte across all 26 cases/214 digest entries), metrics/meta are not and must never be regenerated off the pinned reference host, and a PR author re-recording digests must justify in the PR why the new rendered output is correct - a digest update is a claim of intent, which is the entire reason the gate exists. Applied as a worked example to flash-tex#699 (qed-glyph) in a separate commit/push to that PR's own branch, not included here. Known unrelated breakage, noted but not fixed here: perf-bench's separate `memprofile` bin fails to link on macOS (`_malloc_trim` is glibc-only); the main `flashtex-perf-bench` binary is unaffected. Worked around throughout by building with `--bin flashtex-perf-bench`. Confirmed by reproduction: `cargo build --release --bin memprofile` -> "Undefined symbols ... _malloc_trim ... ld: symbol(s) not found for architecture arm64". Probably worth its own issue; not filed here to stay in scope. What was run: - python3 -m unittest discover -s crates/perf-bench/scripts -p 'test_*.py': Ran 6 tests in 0.005s, OK (round-trip identity, single-case merge leaves meta/other-case/other-fields untouched, and all three refusal paths: mismatched case-id sets, unknown --case, duplicate --case). - Manual round-trip proof against the real 126 KB committed baseline (self vs self, 0 cases): `diff`/`cmp` both report byte-identical. - Manual one-case proof against a real macOS --release recording of this repo's own corpus (case `lecture-notes`, the flash-tex#699 worked example): only that case's 10 digest keys changed; independently verified (separate script, not the tool's own report) that schema_version/meta/targets/ unmeasured and every other case/field were untouched. Next step: Commander/reviewers hand out the remaining ~6 PRs with legitimate rendering changes to their respective authors, each re-recording with this tool and justifying their own case(s) in their own PR. Implementation-Agent: claude-opus-5 subagent of daniel-parent Commit-Executor: daniel-parent subagent Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz
What
\begin{proof}...\end{proof}now ends with amsthm's real QED mark, drawn wherepdflatex draws it. Before this the mark was invisible (GH#443):
The compiler appends
\hfill+ U+220E (END OF PROOF) at\end{proof}, butamsthm's
\qedsymbolis\openbox, which is not a character at all:— an open square
.6emwide and.675emtall drawn with four rules atTeX's default 0.4 pt thickness. U+220E is a filled square, and Latin Modern
has no glyph for it, so nothing was drawn.
adapter.rs: newItem::QedBox { style, span }. The compiler's proof-endmarker is unambiguous —
\end{proof}appends anInline::HFillwith noleader and an
Inline::Textholding U+220E, and gives both the same span(the
\end{proof}bytes) — so only that pair converts toQedBox. A U+220Etyped in the source is a lone text inline with its own span and still goes
through the ordinary text path.
typeset.rs:Context::qed_itemssets the hbox — a kern for each\hfil,four
BoxRec::Rules, and a kern pulling the second\hruleback over thefirst.
emis the current face's quad (\fontdimen6), which is what amsthm's.6/.675/.77778are of; the 0.4 pt rule thickness is absolute and doesnot scale. Kerns between boxes are not legal break points, so the mark never
splits across a line.
incremental.rs: cache-key hash and span relocation for the new item.Why
\openboxis rules, not a glyph, so there was no glyph to substitute: anylookalike from another family (
\square,\blacksquare, Latin Modern Math'sU+220E) has different metrics and the wrong fill. Drawing the rules is both the
faithful and the only metric-correct option.
Overlap check
python3 scripts/coord.py claims— no claim on amsthm: proof's automatic QED is invisible — U+220E has no glyph in Latin Modern; draw amsthm's \openbox with rules; \qedhere unsupported #443; claimedGH-443-QED-GLYPHbefore starting.gh pr list --state all --search "qedsymbol" / "proof" / "qed"— the onlyQED-adjacent PRs are compiler: theorem records, kernel/amsthm heads, \newtheoremstyle, \qedhere #149 and render-pipeline: theorem layout like latex.ltx and amsthm (oracle 36/43; needs #149 re-pin) #156, both closed unmerged. No open PR
touches
adapter.rs's item conversion or the proof end.vendor/file is touched.Test results
New
crates/render-pipeline/tests/qed_box.rs, measured against/Library/TeX/texbin/pdflatex(TeX Live 2026). The oracle page carries noglyph for the mark, only four stroked segments:
As filled rectangles in y-down page bp, against what the pipeline now emits
(
x, top, width, height; the rule gate is 0.1 bp):\vruleleft\hruletop\hrulebottom\vrulerightand the
[12pt]class (cmr12, quad 11.74988pt — reading.6em/.675emoff thenominal 12 pt instead would be 0.15/0.17 bp out):
\vruleleft\hruletop\hrulebottom\vrulerightEvery delta is inside the oracle's own 3-decimal rounding. The test also asserts
the page carries no U+220E glyph run, reports no
missing_glyph, and that thebox's lowest edge is the last line's baseline (134.765 bp, pdflatex's).
The neighbouring suites:
And the whole crate,
cargo test: everything green except one pre-existingfailure that is already filed as #667 —
frame_env'sshared_colorbox_path_draws_border_with_content_inside, adebug_assert_eq!(leadings.len(), parsed.blocks.len())atadapter.rsgivingleft: 2, right: 1. It is aboutblock_par_leadingvs block counts in acolorboxdocument and cannot interact with a new inline item.End to end on the issue's own repro, which used to warn
missing_glyph U+220E:and the PDF
flashtex buildwrites now holds the four rectangles, againstpdflatex's strokes above:
Not done
Issue #443 asks for three things; this is item 1, so #443 stays open rather
than being closed by this PR (no duplicate follow-up filed — items 2 and 3 are
already itemised there):
\qedhere(item 2) is stillerror[compiler] \qedhere is not supported in math mode. It needs compiler work, not pipeline work.after the display. Untouched here. The ordinary placement — flush right at
the end of the proof's last text line, falling to its own line when it does
not fit — needed no work: it is the compiler's
\hfillplus the mark's ownwidth, and the oracle rows above are exactly that position.
Inline::QedSymbol, which is what amsthm: proof's automatic QED is invisible — U+220E has no glyph in Latin Modern; draw amsthm's \openbox with rules; \qedhere unsupported #443 suggests. Deliberate: the pipelinebuilds against the frozen
vendor/compilermirror, so a change incrates/compilerwould not reach the render path until a re-pin — and wouldbreak this PR's marker detection when it did. The compiler-side marker and the
matching adapter arm belong in the same re-pin PR.
{\large\begin{proof}...\end{proof}}is not set at\largeby this pipelineat all (the proof head and body come out at
\normalsize), so the size testhere uses the
[12pt]class option instead. Pre-existing and unrelated.🤖 Generated with Claude Code
https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz