Repository navigation
compiler: amsthm sets the whole theorem head in the head font - #196
Merged
Merged
Conversation
`\@begintheorem` builds the head as
\the\thm@headfont \thm@indent <name> <number> <note> \the\thm@headpunct
so everything the head is made of -- the name, the space tokens between its
pieces and the trailing punctuation -- is read in `\thm@headfont`
(`\bfseries`, `\itshape` for `remark`). Only two things inside it are not:
the note, which amsthm wraps in `\thm@notefont{\fontseries\mddefault
\upshape}`, and the number, which `\thmhead@plain` wraps in `\@upn`
(`\textup`).
This crate emitted the trailing `.` and the space before the note with
`TextStyle::default()`, i.e. from the body font, and numbered an italic
`remark` head in italics.
Measured against pdflatex (TeX Live 2025, oracle only, never in the product
path), `\documentclass[11pt]{article}` + `[T1]{fontenc}` + amsthm with
`\tracingoutput=1`. `fixtures/real-world/lecture-notes`' own first head
ships as
\T1/cmr/bx/n/10.95 D e ^^\ (ligature fi) n i t i o n
\kern 0.0
\glue 4.17043 plus 2.08443 minus 1.3896 % the *bold* space
\T1/cmr/bx/n/10.95 1 . 1
\kern 0.0
\glue 4.17043 plus 2.08443 minus 1.3896 % bold again
\T1/cmr/m/n/10.95 ( D i v i d e s ) % \thm@notefont
\T1/cmr/bx/n/10.95 . % \the\thm@headpunct
\glue 5.0 plus 1.0 minus 1.0 % \hskip\thm@headsep
\T1/cmr/m/n/10.95 L e t % the body
and a numbered `remark` as italic `R e m a r k`, `\kern 1.17863`,
`\glue 3.91763 plus 1.67899 minus 1.11932` (italic), `\OT1/cmr/m/n/10.95 1`,
`\OT1/cmr/m/it/10.95 .`.
So: the head punctuation now takes the head style, the space before the note
is emitted as its own head-styled run (the note itself stays upright medium),
and a number whose `\@upn` shape differs from the head's -- only a `remark` --
becomes its own upright run. Where `\@upn` is a no-op the name and number stay
a single run, as before.
Not changed here, with the measurement that says why:
* the head-to-body separator (`\hskip\thm@headsep`, `\glue 5.0 plus 1.0
minus 1.0`; `proof` instead gets `\@item`'s trailing `\hskip\labelsep`,
5.475pt rigid at 11pt). `Inline` has no rubber horizontal glue -- `HSpace`
is fixed -- and the consumer that has to stop deriving an interword space
from the source gap at that point is the render pipeline, which reads this
crate through `crates/render-pipeline/vendor/compiler`. It is the pipeline
change that lands it (see the companion PR); adding a new inline here would
only reach the pipeline at its next vendor re-pin, and until then would be
either invisible or doubled.
* the `\kern 1.17863` italic correction `\@upn` inserts in a `remark` head,
and `\@addpunct`'s "no second period when the heading already ends in one"
test for `proof`'s optional heading.
`crates/compiler`: 443 passed, 0 failed (441 on the base + the two new tests).
No committed oracle data was regenerated; this box is TeX Live 2025.
Implementation-Agent: engine-engineer (Claude Opus 5), linux-primary
Commit-Executor: engine-engineer (Claude Opus 5), direct git
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu
This was referenced Sep 13, 2026
GoKubar
marked this pull request as ready for review
September 13, 2026 23:36
This was referenced Sep 15, 2026
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.
Finishes the first of the two amsthm items #190 left deliberately: the head's
trailing punctuation is emitted with the default style where amsthm sets it in
the head font. The second (the head→body separator) is
#197, which is independent and also based on
main.Together they let #190 leave draft: with all three in place the fixture's
theorem heads are exact rather than merely close (numbers below).
What amsthm actually builds
\@begintheorem(amsthm.sty 2020/05/29):Everything the head is made of is read inside
\the\thm@headfont(
\bfseries,\itshapeforremark) — the name, the space tokens betweenits pieces and the trailing punctuation. Exactly two things inside it are
not:
\thmhead@plainwraps the note in\thm@notefont{\fontseries\mddefault \upshape}and the number in\@upn(\textup).This crate emitted the
.and the space before the note withTextStyle::default(), and numbered an italicremarkhead in italics.Measured, not read off the .sty
pdflatex, TeX Live 2025, oracle only, never in the product path.
\documentclass[11pt]{article}+[T1]{fontenc}+ amsthm,\showboxbreadth=100 \showboxdepth=100 \tracingoutput=1.fixtures/real-world/lecture-notes' ownfirst head ships as:
The body face's interword space is
3.63054 plus 1.81337 minus 1.20892, so thetwo head spaces are 0.54 pt wider each than what we were emitting. A numbered
remarkships as italicR e m a r k,\kern 1.17863,\glue 3.91763 plus 1.67899 minus 1.11932(italic),\OT1/cmr/m/n/10.95 1,\OT1/cmr/m/it/10.95 .— italic name, italic space, upright number, italic period.
The change
stays upright medium;
\@upnshape differs from the head's — only aremark— isits own upright run. Where
\@upnis a no-op the name and number stay onerun, so nothing else in the tree moves.
proofalready emittedProof.as one italic run, which is what\item[\hskip\labelsep \itshape #1\@addpunct{.}]produces; a test now pins it.Gates
crates/compiler,cargo test --release --no-fail-fast: 446 passed, 0failed against a control checkout of the same base (
9abbf330) at 444passed, 0 failed — same set, +2 = the tests added here.
Real-world corpus through the render pipeline, with this crate patched into
crates/render-pipeline/vendor/compiler(locally, not committed) so theeffect is measurable at all: nine of ten fixtures byte-identical to an
origin/maincontrol (hw1, hw2, cv, inline-math, input-bibliography, letter,math-sheet, unicode-accents, article-twocolumn),
lecture-notesthe only onethat moves, with byte-identical diagnostics (8, no font substitution, 0
overfull) and unchanged page counts. amsmath oracle corpus 59/59 within
0.5 bp. Bundled
apps/mac/Fontswith the explicitFLASHTEX_TFM_DIRSspelling that reaches the rooted metrics reader; never the system TeX Live.
lecture-notesword geometry against the committedreference.pdf(difflib-aligned words, |dx| in bp, 419 aligned words in every row):
mainThis PR changes nothing measurable on its own, by design. Without #190 the
pipeline reads a theorem's weights from the source's brace groups, not from
this crate's scoping, so a bold period here is simply not consulted; the
lecture-notesdisplay list differs only in run structure. That is also why itis safe to land in any order.
On the fixture's
Definition 3.1.line, body start against the oracle's155.3717 bp:
main+ #190 155.8772 (+0.5055), with #197 instead 154.9534(−0.4183), with both 155.3744 (+0.0027) — and the rest of that line then
lands inside 0.06 bp. Two errors of opposite sign again, exactly as #190 warned;
neither PR should be judged alone on this fixture.
Left, with the measurement that says why
\hskip\thm@headsep=\glue 5.0 plus 1.0 minus 1.0, and forproof\@item's trailing\hskip\labelsep(5.475 ptrigid at 11pt).
Inlinehas no rubber horizontal glue (HSpaceis fixed),and the consumer that also has to stop deriving an interword space from the
source gap at that point is the render pipeline, which reads this crate
through its pinned
vendor/compiler. Adding an inline here would reach theproduct only at the next vendor re-pin and, until the pipeline stopped
deriving its own space, would be doubled. It is render-pipeline: the amsthm head separator is the package's glue, not a space #197 that lands it.
\kern 1.17863italic correction\@upninserts in aremarkhead.\@addpunct's "no second period when the heading already ends in one" test,for
proof's optional heading (\begin{proof}[Proof of Lemma 2.]).No committed oracle data was regenerated — this box is TeX Live 2025, not
MacTeX. Nothing under
crates/render-pipeline/vendor/is committed.Merge order
Independent of #190 and #197; lands in any order. The fixture only becomes
exact once #190 → this PR's next vendor re-pin → #197 are all in (the
first two are what make the bold period visible at all).
🤖 Generated with Claude Code
https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu