Repository navigation
Conversation
…m the AMS tables (#796) Under amsart/amsbook/amsproc, \larger/\smaller now move one rung per step on the classes' own 11-rung \@typesizes ladder (clamped at \Tiny/\Huge) instead of relsize's magstep scaling, and plain \tiny..\Huge resolve to the AMS per-option tables (8/9/10/11/12pt) rather than article's. acmart and beamer keep the existing relsize-magstep path (acmart defines its own \larger/\smaller too, but nothing shows it shares the AMS ladder; beamer uses the package like everyone else). The AMS size tables and the discrete-index stepping algorithm are transcribed directly from the real amsart.cls/amsbook.cls/amsproc.cls sources (TeX Live 2026, amscls package; the three classes share byte-identical ladder logic, verified by diff) -- no pdflatex run needed to verify a straight table transcription, and this sandbox doesn't have TeX Live anyway. - layout.rs: ams_size_declaration_pt (5 tables x 11 rungs), ams_rung/ ams_rung_level, class-aware size_declaration_pt_for_class, new LayoutConstraints::ams_sizes flag. - parser.rs: FontSizeLevel::stepped_ams (pure index step + clamp, no magstep math), is_ams_size_class, \documentclass 8pt/9pt parsing gated to AMS classes, relative_size_command routes to stepped_ams for AMS classes. - incremental.rs: one-line mechanical fix (new struct field in an exhaustive test literal). - 8 new tests: exhaustive table checks for 8/10pt, spot-checked 9/11/12pt; the tiny->larger->larger->larger = small stepping example; clamping at both ends; acmart confirmed to stay on the relsize path. Verified: full `cargo test --release --locked` for flashtex-compiler (lib + all integration targets), independently re-run on the exact tree being published: 83 test result lines, all ok, 0 failed. Implementation-Agent: muse-spark-1.3-contributor (Muse Code, lane ams-sizes, slice 1) Commit-Executor: daniel-muse-lead-2 (Claude Sonnet) Reviewed-by: daniel-muse-lead-2 (Claude Sonnet) Muse-Lane-Head: 6316f2d331840ff7960b61f242f6d7e5262d8e4a
…cro names (#796 review) Independent review found the AMS \@typesizes tables used the literal digits in the class source's \@xipt-family macro names (11, 14, 17, 20, 25) instead of what those macros actually render at: NFSS design-size substitutions to the nearest real Computer Modern design size (10.95, 14.4, 17.28, 20.74, 24.88). \@xiipt (12pt) needed no substitution -- it already is an exact CM design size -- which is why it was already correct and stayed unchanged. Independently re-verified against a real pdflatex run (\f@size dumps for \Huge and \tiny+\smaller under amsart[10pt] and amsart[12pt]) before trusting the review's own dump. - Corrected all 5 point-size tables' font-size column (baselineskip was already right, per the review). - Fixed the 3 tests that asserted the implementation's own wrong literals instead of pdflatex-verified ones, including one subtlety the review didn't need to spell out: \normalsize at 11pt stays 11.0, not 10.95 -- it resolves through the pre-existing, separately-documented 11pt body-size approximation, not through the AMS ladder table at all. Not fixed here (documented as a known gap, not hidden): \Tiny (rung 0) still folds onto \tiny (rung 1) in ams_rung_level, so \smaller below \tiny still doesn't reach pdflatex's genuinely smaller \Tiny value. Representing rung 0 for real needs a new state slot (a FontSizeLevel variant or an AMS-specific rung field), which reaches roughly 80 call sites across this crate -- deliberately kept as a separate, focused follow-up rather than folded into this numeric-correctness fix under time pressure. Verified: cargo build --release --locked clean; full cargo test --release --locked for flashtex-compiler and flashtex-render-pipeline, independently re-run: 0 failures in either crate. Implementation-Agent: muse-spark-1.3-contributor (n/a -- direct supervisor edit) Commit-Executor: daniel-muse-lead-2 (Claude Sonnet)
… for \normalsize (#796) Per Commander's ruling on the scope split: filed GH-824 for the \Tiny rung-0 fold and linked it from the doc comment. Also clarified that ams_size_declaration_pt's rung 5 (10.95 at 11pt) entry is dead for \normalsize specifically, which resolves through the pre-existing 11pt body-size approximation instead, not through the AMS ladder at all -- only \larger/\smaller stepping onto rung 5 from elsewhere reads it. Implementation-Agent: muse-spark-1.3-contributor (n/a -- direct supervisor edit) Commit-Executor: daniel-muse-lead-2 (Claude Sonnet)
Follow-up from #816's review, deliberately kept out of that PR to keep its scope to numeric correctness. The AMS classes' (amsart, amsbook, amsproc) own 11-rung \@typesizes ladder has a genuinely separate \Tiny rung (rung 0, smaller than \tiny, rung 1) that ams_rung_level folded onto FontSizeLevel::Tiny (rung 1's own value), so amsart[10pt] \tiny\smaller measured 6pt instead of pdflatex's 5pt. Chose a separate ams_tiny: bool sidecar on TextStyle over a new FontSizeLevel variant: crates/render-pipeline/src/adapter.rs::declared_size matches FontSizeLevel exhaustively with no wildcard against a frozen vendor snapshot, so a 10th variant would break a crate this PR may not touch. The sidecar bit keeps FontSizeLevel, and every downstream consumer of it, byte-identical; #816's own ams_rung/ams_rung_level (including the 0|1 => Tiny fold) and size tables are untouched, only their doc comments were extended to note where rung-exactness now lives. ams_tiny rides the existing TextStyle save/restore (style_stack/ env_styles whole-copies) for correct group scoping, and is cleared whenever an absolute size command is issued (\tiny itself still selects plain rung 1). New LayoutCursor::run_size_pt centralizes the six call sites that previously read style.size directly, so rung 0 is measured consistently everywhere a size-scoped run is laid out. One line in font_units.rs (outside this PR's originally scoped files) completes a pre-existing struct literal that the new TextStyle field requires; it's logic-free (the expansion engine's size codes address only the nine document-visible levels, never the AMS-only rung). Tests: amsart[10pt] \tiny\smaller measures 5pt (all three AMS classes); \larger from the new bottom rung round-trips back to \tiny; group scoping and absolute \tiny reset correctly; article (non-AMS) keeps its pre-existing relsize-based value, confirming no cross-contamination. Full cargo test --locked in crates/compiler (independently re-run by the supervisor): every target ok, 0 failed. Implementation-Agent: muse-spark-1.3-contributor (Muse Code, lane ams-tiny-rung, slice 1) Commit-Executor: daniel-muse-lead (Claude Sonnet) Reviewed-by: daniel-muse-lead (Claude Sonnet) Co-authored-by: d-q222 <[email protected]>
|
Commander (daniel-parent): independent Opus review of PR #827 — represent the AMS classes' own
|
| body | \Tiny |
\tiny |
\tiny\smaller |
\tiny\smaller\smaller |
\tiny\smaller\larger |
\tiny\smaller + 3×\larger |
|---|---|---|---|---|---|---|
| 10pt | 5 | 6 | 5 | 5 (clamped) | 6 | 8 |
| 11pt | 6 | 7 | 6 | 6 (clamped) | 7 | 10 |
| 12pt | 7 | 8 | 7 | 7 (clamped) | 8 | 12 |
amsbook/amsproc are identical. This is exactly the claim under review: \tiny\smaller = 5/6/7 at
10/11/12pt, and \tiny\smaller\larger returns to \tiny.
Verification
\tiny\smaller reaches rung 0 — VERIFIED at all three body sizes, all three classes. The PR's own
tests only pin 10pt, so I ran the compiler independently across the matrix (probe test, written, run,
removed):
PROBE ams amsart 10pt: tiny=6 tiny+smaller=5 +larger=6 (pdflatex: 6 / 5 / 6)
PROBE ams amsbook 10pt: tiny=6 tiny+smaller=5 +larger=6 (pdflatex: 6 / 5 / 6)
PROBE ams amsproc 10pt: tiny=6 tiny+smaller=5 +larger=6 (pdflatex: 6 / 5 / 6)
PROBE ams amsart 11pt: tiny=7 tiny+smaller=6 +larger=7 (pdflatex: 7 / 6 / 7)
PROBE ams amsbook 11pt: tiny=7 tiny+smaller=6 +larger=7 (pdflatex: 7 / 6 / 7)
PROBE ams amsproc 11pt: tiny=7 tiny+smaller=6 +larger=7 (pdflatex: 7 / 6 / 7)
PROBE ams amsart 12pt: tiny=8 tiny+smaller=7 +larger=8 (pdflatex: 8 / 7 / 8)
PROBE ams amsbook 12pt: tiny=8 tiny+smaller=7 +larger=8 (pdflatex: 8 / 7 / 8)
PROBE ams amsproc 12pt: tiny=8 tiny+smaller=7 +larger=8 (pdflatex: 8 / 7 / 8)
Exact agreement in all nine cells. ams_size_declaration_pt's rung-0 column
(layout.rs:2428-2446) is (5,6)/(6,7)/(7,8) for 10/11/12pt, matching the \Tiny row of the oracle
table above.
\tiny\smaller\larger returns to \tiny — VERIFIED. +larger column above, and the unit test
ams_larger_from_the_tiny_rung_returns_to_tiny also pins the 3-step walks: \smaller[3] from rung 1
clamps at rung 0 (5pt, oracle 5pt) and \larger[3] from rung 0 lands on rung 3 (8pt, oracle
tiny+sm+3larger = 8pt). The stepping arithmetic is a genuine round trip, not a special case:
stepped_ams takes base = 0 when the incoming state is rung 0, then the same
clamp(0, AMS_RUNG_COUNT-1) every other rung uses.
Nothing in the non-AMS ladder shifts — VERIFIED.
- Oracle,
article+relsize:\tiny/\tiny\smaller/\tiny\smaller\larger= 5/5/5 at 10pt,
6/6/8 at 11pt, 6/6/8 at 12pt. - Compiler on this head:
article 10pt: 5 / 5 / 5,article 11pt: 6 / 6 / 8,
article 12pt: 6 / 6 / 8. Exact match, so the relsize closest-value path is untouched. - By construction too:
run_size_pt(layout.rs:886-895) gates the rung-0 read on
self.constraints.ams_sizesand the style bit, andrelative_size_command(parser.rs:4296-4306)
only ever callsstepped_amsbehindis_ams_size_class, so the bit cannot be set for a non-AMS
class in the first place. Two independent gates. acmartkeeps the relsize-magstep path (acmart_larger_stays_on_the_relsize_path, still green).
State-slot plumbing is complete. I checked for the classic sidecar failure — a bit read in some
size paths and not others. Every style.size.map_or(size, |level| c.declaration_pt(level)) site in
layout.rs was converted to run_size_pt: Text (3026), Tabular (3209), Logo (3247), Kern (3251),
Rule (3264), TextScript (3333). grep finds no remaining declaration_pt call on a TextStyle::size
anywhere in src/. Every TextStyle literal in the parser that carries size now also carries
ams_tiny (theorem head/number/body at 6971-7101, proof at 7091-7101); the rest are
..TextStyle::default() resets that zero both fields together, so the two stay consistent.
apply_style's clearing list (parser.rs:1266-1284) covers all twelve arms that re-select a size —
I enumerated the match arms and there is no size arm outside the list. Group/environment scoping is
free because the bit rides TextStyle on the existing style stack; the ams_tiny_rung_is_scoped_and_reset_like_other_sizes
test confirms both the group restore and the absolute-\tiny re-select.
Downstream blast radius. crates/bridge and crates/paragraph-layout are the only live
path = "../compiler" dependents; both build clean against this head, and neither reads
FontSizeLevel. See note 2 for render-pipeline.
MATERIAL findings
None.
Non-blocking notes
-
Tests pin only 10pt. The whole point of rung 0 is a per-body-size table column, and a wrong
11pt/12pt entry would pass the suite. I verified those two rows by hand (above) and they are
correct, but please fold at least one of them into
ams_tiny_smaller_reaches_the_tiny_rung— parameterising the existing loop over
[(10, 6.0, 5.0), (11, 7.0, 6.0), (12, 8.0, 7.0)]is a two-line change and pins the column. -
The stated rationale for the sidecar is not accurate today. The PR body says a new
FontSizeLevelvariant "would break a crate this PR may not touch" because
render-pipeline'sdeclared_sizematches exhaustively.crates/render-pipeline/Cargo.toml
depends onvendor/compiler, a frozengit archivesnapshot (vendor/VENDORING.md: "frozen
snapshots, not live mirrors … read-only here"), not on../compiler— so a new variant would not
break it now. The sidecar is still the better choice (smaller blast radius, no ABI change), but the
justification should say "would break render-pipeline at its next re-pin" rather than today. -
Forward-looking divergence at the next vendor re-pin. Because
ams_tinyis a new field that
declared_sizewill not know about, oncevendor/compileris re-pinned past this commit
render-pipeline will compile unchanged and silently renderamsart[10pt] \tiny\smallerat 6pt
while the compiler's own layout gives 5pt. The PR body's "keeps every downstreamFontSizeLevel
consumer byte-identical" is true of compilation and exactly the problem for behaviour. Worth a line
indocs/proposals/rendering-abi.md/ the render-pipeline README so the re-pin notices. -
The
ams_tiny ⇒ size == Some(Tiny)invariant is documented but unenforced.run_size_pt
(layout.rs:889) matchesSome(_) if style.ams_tiny && …, notSome(FontSizeLevel::Tiny) if …, so
a future violation returns the\Tinysize for an arbitrary level, silently. The invariant does
hold on every current path (I traced all three writers), but tightening the pattern or adding a
debug_assert!makes a regression loud for free. -
\Tiny,\SMALLand\Smallare still unsupported commands. Probe on this head:PROBE \Tiny: size=Some(10.0) diags=["\\Tiny is not supported by this compiler version"] PROBE \SMALL: size=Some(10.0) diags=["\\SMALL is not supported by this compiler version"] PROBE \Small: size=Some(10.0) diags=["\\Small is not supported by this compiler version"]So rung 0 is reachable only through
\smaller, never through the AMS classes' own spelling of it —
which is what anamsartauthor actually types, and it silently renders at body size. Issue compiler: AMS \Tiny (rung 0) folds onto \tiny, so \smaller below \tiny doesn't reach it #824
asks only for the\smallerfold, so this PR closes it correctly and this is out of scope; but the
machinery this PR adds is exactly what an\Tinyarm needs (size: Some(Tiny), ams_tiny: true,
plus\SMALL/\Smallas rung 2/3 aliases). Worth filing as the natural follow-up. -
ams_size_declaration_pt's baselineskip column is still never read — only.0is used
anywhere insrc/, and leading is a flatLINE_SPACING = 1.2. The oracle shows the AMS rungs are
not 1.2×:\Tiny5/6 is 1.20, but\tiny6/7 is 1.167 and\Small8/10 is 1.25. Inherited from
compiler: AMS classes' own size ladder for \larger/\smaller and \tiny..\Huge (#796) #816, not introduced here, and rung 0's own ratio happens to be exactly 1.2 so this PR's sizes are
unaffected. Noting because the table now looks authoritative while half of it is decorative. -
parser.rs:4453,parser.rs:9174andfont_units.rs:40compute a point size fromstyle.size
with the non-AMSsize_declaration_pt(word-space widths for\hspace, expansion-engine
metrics). They ignore the entire AMS table, not justams_tiny, so they are a pre-existing compiler: AMS classes' own size ladder for \larger/\smaller and \tiny..\Huge (#796) #816-era
gap rather than anything this change introduces — but they are the remaining places where an AMS
document's sizes are computed off the wrong ladder.
Tests run
Worktree ~/flashtex-wt/review-827, CARGO_TARGET_DIR=$HOME/flashtex-wt/review-target,
CARGO_BUILD_JOBS=3, nice -n 15, one command at a time, from each crate directory.
cargo test --lockedincrates/compiler— 1011 passed, 0 failed. Includes the four new tests
(ams_tiny_smaller_reaches_the_tiny_rung,ams_larger_from_the_tiny_rung_returns_to_tiny,
ams_tiny_rung_is_scoped_and_reset_like_other_sizes,article_tiny_smaller_keeps_its_relsize_value)
and the rewrittenams_larger_steps_one_rung_per_commandtable.cargo build --lockedincrates/bridge— Finished, no errors.cargo build --lockedincrates/paragraph-layout— Finished, no errors.- pdflatex oracles (scratchpad
tex/a{10,11,12}.tex,tex/b{10,11,12}.tex):\f@size/\f@baselineskip
dumps foramsartandarticle+relsizeat 10/11/12pt across\Tiny,\tiny,\smaller
chains,\largerround trips,\SMALL,\Small,\footnotesize,\scriptsize,\normalsize. - Ad-hoc compiler probes
tests/zz_probe_amstiny.rsandtests/zz_probe2.rs(written, run, deleted)
for the 3-class × 3-body-size matrix, the article regression rows and the\Tinycommand state.
VERDICT: APPROVE
|
mac-claude-a review (comment only) — oracle agrees on every value; two gaps. pdflatex
A lane here implemented both pieces stacked on #816's head: |
0284fc9 to
ea3f93c
Compare
…cro names (#796 review) Cherry-picked from #827's stack (9581607, originally by d-q222): main's squash of #816 (ea3f93c) lacks this review fix. The AMS \@typesizes tables used the class source's \@xipt-family macro names' literal digits (11, 14, 17, 20, 25) instead of the NFSS design-size substitutions those macros render at (10.95, 14.4, 17.28, 20.74, 24.88). Tests updated to the pdflatex-verified values. (cherry picked from commit 9581607) Original-Author: d-q222 <[email protected]> Implementation-Agent: Claude Code (mac-claude-a / lane-integrate2) Commit-Executor: git via Claude Code Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01Y1nAv4pEnmMYXgteBoadHn
… for \normalsize (#796) Cherry-picked from #827's stack (711242b, originally by d-q222); doc comments only. (cherry picked from commit 711242b) Original-Author: d-q222 <[email protected]> Implementation-Agent: Claude Code (mac-claude-a / lane-integrate2) Commit-Executor: git via Claude Code Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01Y1nAv4pEnmMYXgteBoadHn
Cherry-picked from #827 (a869225, originally by d-q222). A separate `ams_tiny: bool` sidecar on `TextStyle`, set only when the AMS `\smaller` path lands on rung 0, so `amsart[10pt] \tiny\smaller` measures 5pt like pdflatex instead of re-entering at `\tiny`'s 6pt. `FontSizeLevel` and every downstream consumer keep their shape. Integration fix: main's `alltt` environment (newer than #827) rebuilds the style with a struct literal; it now carries `ams_tiny` through like `size`. (cherry picked from commit a869225) Original-Author: d-q222 <[email protected]> Implementation-Agent: Claude Code (mac-claude-a / lane-integrate2) Commit-Executor: git via Claude Code Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01Y1nAv4pEnmMYXgteBoadHn
…he integration batch + package definitions The pin reads main again after the second integration pass (#827 cherry-picks, #863, #950, #737/#739/#758/#732/#740/#825, visual-oracle tooling) and the `metadata.packages` work (`crate::package_definitions`, tex-expansion's `package_defs.rs`). `git archive` of this tree's `crates/compiler` and `crates/tex-expansion`, PINs at the merge commit, VENDORING.md rows updated, `scripts/check-vendor-pins.sh` both "up to date". render-pipeline 819/0 in both profiles against the new pins; compiler 1368/0, tex-expansion 150/0 release; Mac inventory sync current; swift build clean. 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
|
Landed on main 2d6ac3e by cherry-pick (e2a746b, d889f9a, 2ebd29c with an Original-Author line): its base duplicated main's squashed #816, and main's squash had lost the table correction (11→10.95, 14→14.4, 17→17.28, 20→20.74, 25→24.88) — oracle-verified with pdflatex (amsart[11pt] \Huge=24.88, \tiny\smaller=6). #888's two review points remain open questions; the AMS rung itself is in. |
What
Follow-up from #816's own review, deliberately kept out of that PR. Stacked on #816's branch since this builds directly on its 11-rung
\@typesizesinfrastructure (AMS_RUNG_COUNT,ams_rung_level) — retarget tomainonce #816 merges.The AMS classes' (
amsart,amsbook,amsproc) own ladder has a genuinely separate\Tinyrung (rung 0, smaller than\tiny) thatams_rung_levelfolded ontoFontSizeLevel::Tiny(rung 1's value), soamsart[10pt] \tiny\smallermeasured 6pt instead of pdflatex's 5pt.Approach: a separate
ams_tiny: boolsidecar onTextStyle, not a newFontSizeLevelvariant —render-pipeline's vendoredadapter.rs::declared_sizematchesFontSizeLevelexhaustively with no wildcard, so a 10th variant would break a crate this PR may not touch. The sidecar keepsFontSizeLeveland every downstream consumer byte-identical. #816's ownams_rung/ams_rung_levellogic is untouched.Tests
amsart[10pt] \tiny\smallermeasures 5pt (all three AMS classes);\largerfrom the new bottom rung round-trips to\tiny; group scoping correct;article(non-AMS) unaffected. Fullcargo test --lockedincrates/compiler(independently re-run by the supervisor): every target ok, 0 failed.Closes #824.
Implementation-Agent: muse-spark-1.3-contributor (Muse Code, lane ams-tiny-rung, slice 1)
Commit-Executor: daniel-muse-lead (Claude Sonnet)
Reviewed-by: daniel-muse-lead (Claude Sonnet)
🤖 Generated with Claude Code