Repository navigation
compiler: proof/theorem environments now inherit the enclosing size group (fixes #701) - #718
Merged
Merged
Conversation
begin_proof and begin_theorem reset self.style to size-less defaults,
dropping an enclosing size group (e.g. {\large ...}): head, number, note
and body all fell back to normalsize. Capture the ambient size at entry
and merge it into the heading, head/number, note and body styles; the
proof QED symbol now uses the body style. TheoremStyle::head/body_style
stay context-free; unscoped output is unchanged.
Implementation-Agent: muse-spark-1.3-contributor
This was referenced Sep 16, 2026
d-q222
added a commit
that referenced
this pull request
Sep 17, 2026
#784 All eight independently reviewed APPROVE. Batch verification: compiler 935/0, render-pipeline 487/0, perf-bench 14/0, perf gate OK (270 metrics, no regression), swift build --build-tests OK, CompletionTests 29/0. Commit-Executor: daniel-parent Claude-Session: https://claude.ai/code/session_012c9XLkHjePPGBuarrmE2mz
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Scope
Fixes #701: a size group (
\large, etc.) around\begin{proof}...\end{proof}or a
\newtheorem-declared environment was being dropped entirely — both thehead ("Proof."/"Theorem 1.") and body rendered at
\normalsizeregardless ofthe enclosing size.
crates/compiler/only (2 files, +234/-6);crates/render-pipeline/untouched.
Scoped as requested before fixing:
itemize,quote, andcenterallalready correctly carry
\largeinto their contents (confirmed via a freshflashtex-clibuild's--v2display-list JSON font references, off currentmain). Only amsthm/
\newtheorem-style theorem environments were affected —verified against both
proofand a plain\newtheorem-declaredtheorem.Not a general "size register isn't carried into environment bodies" bug.
Root cause:
begin_proofandbegin_theorem(crates/compiler/src/parser.rs)unconditionally rebuilt
self.style/head-and-body text styles fromTextStyle::default()/TheoremStyle::head_style()/body_style()(context-free style definitions in
theorems.rs), discarding whateversize: Option<FontSizeLevel>was in effect on entry. Fix: capturelet ambient_size = self.style.sizeat entry to each function and merge itinto the head/number/note/body styles (
TextStyle { size: ambient_size, ..X })rather than changing
TheoremStyle::head_style()/body_style()themselves(verified they have no other call sites). The closing "∎" now also uses the
body's current
self.styleinstead of a hardcoded default. The\thm@notefontnote style was confirmed against the realamsthm.stysource (
\fontseries\mddefault\upshape— series/shape only, never resetssize), so it also inherits ambient size like the head.
Overlap check
No overlap: compiler-only, no
vendor/touch, no other open PR touchesbegin_proof/begin_theorem/TheoremStyle.Test results
6 new exact-
TextStyletests incrates/compiler/tests/amsthm.rs: proofhead+body+QED at
\large, plain-theorem head+punctuation+body at\large,note at
\large, definition-style at\large, remark-style (italic head,upright
\@upnnumber, upright body) at\large, and an itemize/quote/centerregression guard confirming they still work under
\large.Independently re-verified by the supervisor (fresh
CARGO_TARGET_DIR):cargo test --test amsthm: 25 passed, 0 failed — matches the lane'sown report exactly.
reverted
parser.rsto its pre-fix state viagit checkout origin/main -- crates/compiler/src/parser.rs, re-ran the suite: exactly 5 tests fail(
definition_style_preserves_enclosing_size,plain_theorem_preserves_enclosing_size_in_head_and_body,proof_preserves_enclosing_size_in_head_and_body,remark_style_preserves_enclosing_size,theorem_note_preserves_enclosing_size), each with the exact dropped-sizeassertion failure (
size: Nonevs expectedSome(Large1)). Restored →25/25 pass again.
crates/compilersuite (fresh target dir): all suites green, 0failures.
Not done
CLI/
--v2-visible confirmation is blocked on thecrates/render-pipeline/vendor/compilerre-pin (that mirror predates this fix and has no
ambient_sizeconcept) —out of scope for this compiler-only slice per the issue's own instruction.
The lane's positive control (
{\large\begin{itemize}...}renders atLMRoman12-Regularthrough the same CLI binary) confirms the render pathcorrectly maps
Large1→12pt once the compiler emits it; this PR is whatmakes proof/theorem emit it. Once the pending vendor re-pin (daniel-parent's
PR #711) lands,
flashtex buildon the issue's repro should showLMRoman12-*for the proof/theorem head and body.🤖 Generated with Claude Code