Repository navigation
Conversation
…ins, and the slots the new symbols need
`fontmath.ltx` 457-505 declares twelve `\DeclareMathDelimiter`s that
`cm::delimiter_slot` did not carry: `\Vert` `\vert` `\backslash`
`\updownarrow` `\Updownarrow` `\lgroup` `\rgroup` `\lmoustache`
`\rmoustache` `\arrowvert` `\Arrowvert` `\bracevert`. Four of the twelve
already had a *character* row, because `\left|` and `\left\|` reach the same
cmsy slots, but nothing named the pair for the other eight, so
`var_delimiter` had no chain to walk and the fence could not grow.
Each row is the pair `fontmath.ltx` declares — a small variant and a
`largesymbols` growth chain — not a look-alike character:
U+21D5 `\Updownarrow` (Symbol "6D, cmex "77)
U+27EE/U+27EF `\lgroup`/`\rgroup` (cmex "3A/"3B as both variants)
U+23B0/U+23B1 `\lmoustache`/`\rmoustache` (cmex "7A/"7B, cmex "40/"41)
U+23D0 `\arrowvert` (Symbol "6A, cmex "3C)
U+23AA `\bracevert` (cmex "3E as both variants)
`cm::ARROWVERT_DOUBLE` `\Arrowvert` (Symbol "6B, cmex "3D)
`\Arrowvert` is the one that cannot be spelled with a Unicode character:
it sets `\Vert`'s double bar but grows through cmex's *extension* recipe
"3D rather than `\Vert`'s delimiter recipe "0D, and Unicode names only the
single vertical extension (U+23D0, which is `\arrowvert`). It travels as a
BMP private-use code point, the convention render-pipeline already uses for
`\varnothing`, and is painted from U+2016.
Three oversights on rows that were already there, found while measuring:
`\uparrow` `\downarrow` `\updownarrow` `\Uparrow` `\Downarrow`
`\Updownarrow` are all `\mathrel` (471-482) and only the horizontal arrows
were; `\Uparrow`/`\Downarrow` had no delimiter pair at all, so `\left\Uparrow`
had no sizes; and `\bigtriangledown` is `\mathbin` (267), not Ord.
Also the slots the compiler's new symbols are set from: U+25B3/U+25BD at
cmsy "34/"35 (`\triangle`, `\bigtriangleup`, `\varbigtriangleup` and the
down forms all name that slot in `fontmath.ltx` 229/266-269) and U+02DA at
cmr "17 for `\mathring` (422).
render-pipeline:
* `\smallint` (`fontmath.ltx` 263) is cmsy "73, a text-size integral that
never grows, where `\int` is cmex "52 with a chain. No face carries a
second integral code point, so it travels as U+222B with the advance
forced, and `SMALLINT_SENTINEL` keeps the two apart for the metrics
providers exactly as `VARNOTHING_SENTINEL` does for `\emptyset`. A forced
class no longer bypasses that substitution: class and advance are
independent, and `\smallint` needs both.
* `\lmoustache`/`\rmoustache` are drawn from New Computer Modern Math, the
secondary face `\mathbb`/`\mathcal`/`\varnothing` already use: Latin
Modern Math has no glyph at U+23B0 or U+23B1 at all. Without this they
were reported `math_glyph_unmapped` and nothing was drawn.
* `class_override_of` learns the kernel's second `\DeclareMathSymbol`s for a
slot another command owns (`\vert` `\backslash` `\ldotp` `\cdotp`
`\lvert` `\rvert` `\lVert` `\rVert` `\varbigtriangleup`), `\smallint`'s
Op and `\varinjlim`/`\varprojlim`'s, which amsopn wraps in `\mathop`; the
`\underrightarrow`-shaped atom now honours a forced class, which is the
3mu those two were missing.
* `accent_char` is keyed by `Accent::command()` rather than by the variant,
so `\mathring` maps as soon as `vendor/compiler` carries it and the crate
still builds against the current pin. An accent the table does not know
becomes U+FFFD, which math-layout reports as `MissingAccent`.
`tests/kernel_delimiters.rs` pins, for all twelve, the `\hbox{$\sym$}` box
and the extensible recipe pdfTeX 3.141592653-2.6-1.40.27 (TeX Live 2025)
produces at 10pt, plus the classes and the two `\Vert`/`\Arrowvert`,
`\vert`/`\arrowvert` chain splits. All five tests passed first run.
Gates on this box, against a control checkout of origin/main, fonts
configured (a fontless `cargo test` silently skips ~110 guarded tests):
math-layout 56 -> 61 passed, 0 failed; render-pipeline 181 passed with the
same 8 pre-existing partial-font control failures on both sides; amsmath
59/59 and amssymb 38/39 (`32-braces-narrow`, which fails on main too),
per-fixture identical; HW1/HW2 3 pages each, 0 errors, 0 overfull, 0 font
diagnostics; real-world corpus 20/20 producer pairs identical.
Implementation-Agent: Claude Opus 5 (engine-engineer kernel-math lane, nixos-pc-kabir)
Commit-Executor: Claude Code direct Git
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu
… dots
The sibling compiler branch makes `\ldots`/`\cdots` the group of three
punctuation atoms `fontmath.ltx` 400-402 defines
(`\mathinner{\ldotp\ldotp\ldotp}`), instead of one three-character text run,
which lost both 3mu gaps — 1.66 bp each at 10pt in an ordinary
`$1, 2, \dots, n$`. `class_override_of` answers Inner for the eight command
names so the group is an inner atom rather than an ordinary one.
The three dots carry the command's span too, so this row answers for them as
well. That is not a compromise: TeX's chapter-18 table gives Punct-Punct and
Inner-Inner the same thin space, in the same text-styles-only way (this
crate's own `spacing::TABLE` rows agree), so the two gaps measure
identically either way. Verified against pdfTeX in both styles —
`$1, 2, \dots, n$` +0.0027 bp, `$x^{a \dots b}$` -0.0004 bp, `$\ldots$`
-0.0036 bp.
Gates unchanged from the first commit: math-layout 61 passed, 0 failed;
render-pipeline 181 passed with the same 8 pre-existing partial-font control
failures as the control; amsmath 59/59, amssymb 38/39, per-fixture
identical; HW1/HW2 3 pages, 0 errors, 0 overfull; real-world corpus 20/20
producer pairs identical.
Implementation-Agent: Claude Opus 5 (engine-engineer kernel-math lane, nixos-pc-kabir)
Commit-Executor: Claude Code direct Git
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu
This was referenced Sep 13, 2026
This was referenced Sep 14, 2026
This was referenced Sep 14, 2026
Contributor
Author
|
Closing as superseded — the work is already on Replacement: \mathring and delimiter growth are on main; #227/#239 merged Closed by the integration lane while clearing a 219-PR backlog (112 of them drafts). If this is wrong, reopen it and tell me — I would rather be corrected than leave stale work buried. — orchestrator-astra (Commander) |
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.
Layout half of the LaTeX kernel math gap #180's sweep found. Compiler half is #200 (
agent/kabir-claude/kernel-delimiters-compiler). Both are based onmain9abbf330independently — no stacking, no file in common, either can merge first. Neither touches #180/#181/#185/#186's branches.What changed
cm::delimiter_slotis the table that decides where a\left/\rightfence's sizes come from: a small variant and alargesymbolsgrowth chainvar_delimiterwalks.fontmath.ltx457-505 declares twelve delimiters, and eight of them had no pair at all — so even once the compiler emitted them, the fence could not grow.\Updownarrow"6D"77\lgroup/\rgroup"3A/"3B\lmoustache/\rmoustache"7A/"7B"40/"41\arrowvert"6A"3Ccm::ARROWVERT_DOUBLE\Arrowvert"6B"3D\bracevert"3EThe other four (
\Vert\vert\backslash\updownarrow) already had a character row, because\left|and\left\|reach the same cmsy slots.\lgroup,\rgroupand\bracevertname the samelargesymbolsslot as both variants, because cmex has no discrete sizes for them — only the extensible recipe that slot already carries, so the chain walk stops immediately and the one glyph serves as the small variant.\Arrowvertis the one that cannot be spelled with a Unicode character. It sets\Vert's double bar but grows through cmex's extension recipe"3D(a bare repeated piece) rather than\Vert's delimiter recipe"0D, and Unicode names only the single vertical extension — U+23D0, which is\arrowvert. It travels as a BMP private-use code point, the convention render-pipeline already uses for\varnothing, and every consumer paints U+2016 for it. The difference is not cosmetic: around a fraction at 10pt pdfTeX gives\Arrowverta 7.7778pt-wide fence and\Verta 5.5556pt one.Three oversights on rows that were already there, found while measuring:
fontmath.ltx471-482 declares all six arrow delimiters\mathrel; only the horizontal ones were.\uparrow\downarrow\Uparrow\Downarrowwere ordinaries.\Uparrow/\Downarrow(U+21D1/U+21D3) had no delimiter pair, so\left\Uparrowhad no sizes at all.\bigtriangledownis\mathbin(267), not Ord.Plus the slots the sibling's new symbols are set from: U+25B3/U+25BD at cmsy
"34/"35(fontmath.ltx229/266-269 puts\triangle,\bigtriangleupand\varbigtriangleupon one slot and the two down forms on the other) and U+02DA at cmr"17for\mathring(422). Both replace an OpenType-metrics fallback with the TFM box pdfLaTeX sets.render-pipeline
\smallint(263) is cmsy"73, a text-size integral that never grows, where\intis cmex"52with a chain. No face carries a second integral code point, so it travels as U+222B with the advance forced andSMALLINT_SENTINELkeeps the two apart for the metrics providers — exactly the shapeVARNOTHING_SENTINELuses for\emptyset. A forced class no longer bypasses that substitution: class and advance are independent, and\smallintneeds both.\lmoustache/\rmoustacheare drawn from New Computer Modern Math, the secondary face\mathbb/\mathcal/\varnothingalready use. Latin Modern Math has no glyph at U+23B0 or U+23B1 at all (checked against the bundledlatinmodern-math.otf); without this they were reportedmath_glyph_unmappedand nothing was drawn.class_override_oflearns the kernel's second\DeclareMathSymbols for a slot another command owns (\vert\backslash\ldotp\cdotp\lvert\rvert\lVert\rVert\varbigtriangleup),\smallint's Op, and\varinjlim/\varprojlim's, which amsopn 98-103 wraps in\mathop. The\underrightarrow-shaped atom now honours a forced class — that 3mu is exactly what those two were missing (measured −1.6578 bp before, exact after).accent_charis keyed byAccent::command()rather than by the enum variant, so\mathringmaps as soon asvendor/compilercarries it while the crate still builds against the current pin. An accent the table does not know becomes U+FFFD, which math-layout reports asLimitation::MissingAccentrather than drawing something else.Measured against pdfTeX, not assumed
tests/kernel_delimiters.rspins numbers from pdfTeX 3.141592653-2.6-1.40.27 (TeX Live 2025) at 10pt, for all twelve:\showthe\wd0/\ht0/\dp0of\hbox{$\sym$}— the TFM box of the slot the small variant names. A wrong family or slot moves it.\hbox{$\left\sym\vrule height 45pt depth 45pt width 0pt\right.$}less\nulldelimiterspace— a body far taller than any discrete size, sovar_delimiterhas reached the end of the chain and the numbers are the extensible recipe's, which is what the growth chain is for.TOP/MID/BOT/REPslots, read fromcmex10.tfmwithtftopl.\hbox{$a\sym b$}against the$ab$control (9.57755pt at 10pt).All five tests passed first run. The growth was also checked at six body heights (5, 10, 15, 20, 30, 45pt):
\backslashis the one of the twelve with no extensible recipe — cmex"0F's chain ends at the largest discrete size"2D— which is why a very tall\left\backslashis the one that stays too small, in pdfTeX as here.End to end, with
vendor/math-layoutandvendor/compilerlocally swapped to this branch and its sibling (uncommitted, as the vendoring rules require), one paragraph per formula so each anchor's x is that formula's own width: all twelve agree within 0.004 bp, bare and as$\left\sym\frac{p}{q}\right\sym$.Two pre-existing findings the controls produced, both outside this lane:
\usepackage{amsmath}re-declares\textfont3. Without it a 12pt document has\fontname\textfont3=cmex10(omxcmex.fd's<->sfixed*cmex10); with it,cmex10 at 12.0pt.CmMathMetricshard-codesExtensionSizing::Fixed, so every family-3 glyph in a 12pt amsmath document is 1/6 too small:$a\int b$−1.32 bp,$a\lgroup b$−1.77 bp, every\left…\rightfence 2–3.5 bp.ExtensionSizing::Scaledalready exists for this case and nothing selects it. Measuring at 10pt removes the difference, which is why the numbers above are 10pt.MathFontsreadsMathVariants' horizontal assemblies (hassembly_parts) but not the vertical ones, so a recipe whoseTOP/BOTpieces are not on the chain from its start —\updownarrow("78/"79),\Updownarrow("7E/"7F),\lgroup/\rgroup/\lmoustache/\rmoustache("38/"39) — reportsmath_glyph_unmappedfor those pieces and draws nothing for them. The metrics are exactly TeX's (the anchors above prove it); only the joining ink is missing, and the same is already true of\left(on a very tall body. This is the natural follow-up.Gates
Base
main9abbf330. Font setup: the repo's ownapps/mac/FontswithFLASHTEX_FONT_DIRSand the three-directoryFLASHTEX_TFM_DIRS, which is sufficient on this box — measured, with notexmftree next to the binary and zero font diagnostics. (--font-dir apps/mac/Fontsalone is not:math_metrics_opentype+tfm_missing. That is the configuration the "the env is not enough on the kernel-math lane's box" note was measured in.)cargo testwas run with the fonts configured: a fontless run silently skips ~110lm_available()-guarded tests across 40 files and reports a hollow pass. The control is a checkout of9abbf330in the same worktree.9abbf330crates/math-layoutcrates/compilercrates/render-pipeline32-braces-narrow)The eight render-pipeline failures are the partial-font control tests, which
FontSet::newreads the global environment for, so configuring fonts is what fails them; they fail identically on the control. Novendor/*file is committed (git diff 9abbf330 -- crates/render-pipeline/vendor/is empty).Group 3:
latexsym/lasy— recommendationThe nine remaining commands are
\Box\Diamond\Join\leadsto\lhd\rhd\unlhd\unrhd\mho. Recommendation: do not bundlelasy. Three findings, in order of how decisive they are.1. There is no OpenType
lasyanywhere. TeX Live 2025 shipslasyonly as Metafont source (fonts/source/public/latex-fonts/lasy*.mf), Type 1 (fonts/type1/public/amsfonts/latxfont/lasy10.pfb) and Type 3 bitmaps (fonts/type3/mpfonts/lasy10.t3). A search of the wholefonts/opentypetree returns one unrelated Indic face. The renderer resolves every glyph as an OpenType glyph id from aLoadedFace(font-engineTrueTypeFace); there is no Type 1 or bare-CFF path. So this is not a packaging decision — bundlinglasy10.pfbwould need a new font backend first.2. The licence and provenance cannot be verified to the standard this bundle already documents.
SUPPLEMENTARY-FACES.jsonpins every face with a source archive and its SHA-256, a byte-for-byte cross-check against a named TeX Live tree, the licence by name with its own SHA, andmake-app.sh/bundle-texmf.pygates that refuse packaging on drift. ThelasyTFM comes from thelatex-fontspackage and the Type 1 outlines fromamsfonts; this box's TeX Live is a Nix store path with no font documentation or licence tree at all, so neither licence file can be read, let alone hashed. I am not asserting a licence I could not verify.3. Substituting a bundled face would be visibly wrong, not merely imprecise. All nine code points are in the already-bundled New Computer Modern Math (U+2127
\mho, U+2A1D\Join, U+25A1\Box, U+25C7\Diamond, U+2933\leadsto, U+22B2–U+22B5 for the four triangles), and six of the nine are in Latin Modern Math. But the metrics are notlasy's:\Box(lasy"32/ U+25A1)\Diamond("33/ U+25C7)\Join("31/ U+2A1D)\mho("30/ U+2127)A 2.3pt advance error on a symbol is a line-breaking difference, not a rendering nicety — it is larger than every tolerance in this repo's gates.
What to do instead, in the order I would do it. (a) Nothing:
latexsymis a legacy package, and every one of the nine has a modernamssymbequivalent (\square,\lozenge,\vartriangleleft/\vartriangleright/\trianglelefteq/\trianglerighteq,\mho,\rightsquigarrow) already fully supported from the bundled msam/msbm metrics, which is where a document written today gets them. (b) Iflatexsymdocuments must render: implement the eleven\DeclareMathSymbols againstlasy10.tfmmetrics — the slots are inlatexsym.styand are\mho"30\Join"31\Box"32\Diamond"33\leadsto"3B\sqsubset"3C\sqsupset"3D\lhd"01\unlhd"02\rhd"03\unrhd"04 — paint them from New Computer Modern Math, and report the substituted design, exactly as\mathcalalready does (newcm_math.rs's own module comment states the same limitation for cmsy10). That needs one small TFM intexmf/fonts/tfm/public/latex-fonts/, licence-verified on a machine that has the documentation tree, and no new font backend. (c) Only if pixel parity withlasyis ever required: a vertical-assembly-capable Type 1 path, which is a much larger piece of work than these nine symbols justify.One related finding while checking:
latexsym.styalso declares\sqsubset/\sqsupset, and so doesamsfonts.sty99-100 (AMSa "40/"41, msam — which is bundled).amssymb.sty111-112 has them commented out, and the compiler'samssymb.rsis generated byscripts/gen_amssymb.py, which reads onlyamssymb.sty. Teaching the generatoramsfonts.stycloses those two from metrics already in the bundle. It needs the TeX Live 2026 tree the committed table came from, so it is not in this pair.🤖 Generated with Claude Code
https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu