Repository navigation
Conversation
…h math commands Compiler half of the LaTeX kernel math gap #180's sweep found. #185/#186 closed 50 of the 115; 55 were left, in three groups. This closes the twelve delimiters and 18 of the ~34 macros, accents and operators. The twelve delimiters (`fontmath.ltx` 457-505). Each is a *pair* of font slots, so the character has to be the one `cm::delimiter_slot` keys that pair by, not a look-alike: `\Vert` U+2016, `\vert` U+2223, `\backslash` U+2216, `\updownarrow` U+2195, `\Updownarrow` U+21D5, `\lgroup` U+27EE, `\rgroup` U+27EF, `\lmoustache` U+23B0, `\rmoustache` U+23B1, `\arrowvert` U+23D0, `\Arrowvert` `math::ARROWVERT_DOUBLE`, `\bracevert` U+23AA. Three of them set a glyph another command already owns, in a different class, which is the `\bot`/`\perp` shape: `\vert` is `\mid`'s cmsy "6A as an ordinary, `\backslash` is `\setminus`'s "6E, and `\Vert` is `\parallel`'s "6B (though U+2016 is a character of its own, with its own growth chain, so it keeps a row). `\Vert` was not merely missing. `\left\Vert` was spelled as two `\mid` bars, because the base-14 Symbol face has no U+2016 — two atoms, the wrong box, and no growth chain. `\lVert`/`\rVert` had the same spelling and `\lvert`/`\rvert` were relations where mathtools makes them fences. All five now set the one real double bar from the pinned Latin Modern Math resource, with the class forced at the command. Eighteen more: `\hookleftarrow` `\longmapsto` `\smallint` `\intop` `\ointop` `\varbigtriangleup` `\varbigtriangledown` `\ldotp` `\cdotp` `\sqrtsign` `\not` `\mathring` `\injlim` `\projlim` `\varinjlim` `\varprojlim` `\iiiint` `\idotsint` `\pod` `\nobreakdash` `\pmb`. `\not` (334) is the zero-width negation slash the *following* relation is overprinted with, which is what `\neq` is; emitting it as its own atom generalises to any relation where a precomposed table cannot, and is exactly how render-pipeline already decomposes `\neq`/`\notin`. `\smallint` (263) is cmsy "73, a different glyph from `\int`'s cmex "52, so it carries cmsy's own advance the way `\varnothing` carries msbm's. `\injlim`/`\projlim` are `\operatorname*{inj\,lim}`/`{proj\,lim}` built through the existing operator nucleus, so they are byte-for-byte what writing the macro out gives. `\pmb` is the one deliberate approximation and says so: the advance is the argument's own (pdfTeX measures `\pmb{x}` as exactly `$x$`, since the three overprinted copies cancel), but this compiler has no overprint primitive, so the emboldening is reported rather than faked with a bold face, which would be a different and wider design. Export. Nine new glyphs bind to the pinned Latin Modern Math resource with advances read from the exact bundled font program (`tests/lm_math_binding.rs` re-reads it). `\vert`, `\backslash`, `\intop` and `\ointop` are deliberately absent from that table: they resolve to characters `\mid`, `\setminus`, `\int` and `\oint` already bind, and a second row would be a duplicate. `\lmoustache`/`\rmoustache` are the only two non-`\mathcal` characters bound to New Computer Modern Math, because Latin Modern Math has no glyph at either code point; the export reason names them rather than inheriting the alphabet's wording, which keeps the real-world corpus byte-identical. `\Arrowvert` has its own decided reason: no font carries it as a character. No new binding is a WinAnsi text character, so none can take a prose glyph over the way `\imath` on U+0131 did in #185 (`export::map_char` consults `lm_math::advance` before WinAnsi). Measured against TeX Live 2025 pdfTeX at 10pt through the repo's own oracle machinery, one paragraph per formula so each anchor's x is that formula's own width: all twelve delimiters agree within 0.004 bp bare *and* as a `\left...\right` fence around a fraction, as do `\intop` `\ointop` `\varbigtriangleup` `\varbigtriangledown` `\ldotp` `\cdotp` `\smallint` `\not` `\mathring` `\sqrtsign` `\pod` `\pmb` `\lvert` `\lVert` `\varinjlim` `\varprojlim`. Six do not, and each reproduces the error its already-supported sibling shows on main: `\hookleftarrow` -1.14 bp against `\hookrightarrow`'s -6.67, `\longmapsto` -1.67 against `\longrightarrow`'s -1.47, `\iiiint`/`\idotsint` against `\iint`'s -1.66 (no `\intkern@` model), and `\injlim`/`\projlim` -5.42, which is to the fifth decimal what `\operatorname*{lim}_{n}` already measures. `tests/kernel_delimiters_and_macros.rs` measures each command's class through this compiler the way `\showthe\wd0` measures it in pdfTeX, with the glyph width cancelled by a `\mathord` control, against a command of the declared class the compiler already carried — plus a control proving two different classes do not measure the same. Gates on this box against a control checkout of origin/main, fonts configured: compiler 444 -> 449 passed, 0 failed; amsmath 59/59 and 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
…n atoms
Two spacing bugs the algorithm-floats lane measured in ordinary prose, both
of which the `\ldotp`/`\cdotp` rows this branch already adds make
straightforward to fix properly.
`\ldots` and `\cdots` are `\mathinner{\ldotp\ldotp\ldotp}` and
`{\cdotp\cdotp\cdotp}` (`fontmath.ltx` 400-402): three *punctuation* atoms,
so TeX puts 3mu between each pair. Setting them as one three-character text
run loses both gaps — 1.66 bp each at 10pt. pdfTeX's `\hbox{$\ldots$}` is
11.66661pt where three bare `\ldotp`s side by side would be 8.33337pt.
They are now the group of three punctuation atoms the kernel defines, as an
Inner atom.
`\bmod` is amsopn's `\nonscript\mskip-\medmuskip\mkern5mu\mathbin
{\operator@font mod}\penalty900\mkern5mu\nonscript\mskip-\medmuskip`. The
`-\medmuskip` exactly cancels the binary's own inter-atom glue, so what is
left is 5mu on each side whatever the neighbours are — and `\mkern`, unlike
`\mskip`, is not suppressed in script styles. Classifying the word `mod` as
a binary gets 4mu in text style and 0 in scripts; worse, the render pipeline
does not read the compiler's atom class for a *text* nucleus at all, so it
got neither, which is the 2.77 bp missing on each side of `$a \bmod b$`.
The two kerns are now explicit, so both producers and every style agree.
`\mod` keeps its own arm rather than sharing `\bmod`'s: amsmath's `\mod`
takes an argument and has different kerns, and this compiler does not model
it yet.
Measured at 10pt against TeX Live 2025 pdfTeX, through the same harness as
the rest of this branch (one paragraph per formula), with both halves
vendored:
$r \gets a \bmod b$ -0.0009 bp (was -5.55, 2.77 each side)
$a \bmod b$ -0.0037 bp
$x^{a \bmod b}$ +0.0004 bp script style, where \mkern still applies
$1, 2, \dots, n$ +0.0027 bp (was -3.33, 1.66 per gap)
$a \dots b$ -0.0008 bp
$a \cdots b$ -0.0008 bp
$x^{a \dots b}$ -0.0004 bp script style, where the 3mu is suppressed
$\ldots$ -0.0036 bp
A bare `$\dots$`/`$\cdots$` with amsmath loaded still measures 1.66 bp
narrow, and that one is not a bug in this change: amsmath makes `\dots`
context-sensitive, and with nothing following it expands to `\dotso`, which
appends a thin space (pdfTeX, amsmath loaded: `\dots` 13.33324pt, `\ldots`
11.66661pt; without amsmath both are 11.66661pt). This compiler's math
parser is package-agnostic, so it implements the kernel definition — the
same known difference #180 recorded for `\colon`. Every in-context shape,
which is what a document actually contains, is exact.
Gates unchanged from the first commit: compiler 449 passed, 0 failed;
amsmath 59/59 and amssymb 38/39 per-fixture identical to the control;
HW1/HW2 3 pages, 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
|
Stale-docs note (found while sweeping docs for drift, PR #254): the "eight render-pipeline failures are the partial-font control tests" line in this PR's gate table is no longer accurate. #202 (render-pipeline tests: partial-font controls stop reading the environment) and #203 (ci: run the whole suite) landed after this PR and fixed that set — Leaving this as a comment rather than editing the PR body, since it's a historical record of this PR's own gate at merge time. Anywhere this "8 expected failures" figure had been copied forward into other docs/test comments has been checked and none currently repeats it. |
docs: fix stale claims that misled engineers (VENDORING, #200 note, font gate, \today, fonts, completion, coverage)
|
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) |
Compiler half of the LaTeX kernel math gap #180's sweep found. Layout half is #201 (
agent/kabir-claude/kernel-delimiters-layout) (independent, both based onmain9abbf330, no stacking, no file in common). Neither touches #180/#181/#185/#186's branches.#185/#186 closed 50 of the 115 unsupported kernel commands, leaving 55 in three groups. This pair closes 33 of the 55: all 12 delimiters and 21 of the ~34 macros/accents/operators (counted by compiling all 55 and collecting the
is not supported in math modediagnostics: 55 before, 21 after). The 9 latexsym symbols are a recommendation, not a change — see the bottom.Group 1 — the twelve delimiters
fontmath.ltx457-505. Each is a pair of font slots, a small variant and alargesymbolsgrowth chain, so the character has to be the onecm::delimiter_slotkeys that pair by, not a look-alike:\Vert"6B"0D\vert"6A"0C\backslash"6E"0F\updownarrow"6C"3F\Updownarrow"6D"77\lgroup/\rgroup"3A/"3B\lmoustache/\rmoustache"7A/"7B"40/"41\arrowvert"6A"3C\Arrowvertmath::ARROWVERT_DOUBLE"6B"3D\bracevert"3EThree set a glyph another command already owns in a different class — the
\bot/\perpshape:\vertis\mid's cmsy"6Aas an ordinary,\backslashis\setminus's"6E,\Vertis\parallel's"6B.\arrowvertand\Arrowvertset the same two cmsy bars as\vertand\Vertbut grow through cmex's extension recipes"3C/"3Drather than the delimiter recipes"0C/"0D, so they cannot share those characters. Unicode names the single vertical extension (U+23D0) but not the double one, so\Arrowverttravels as a BMP private-use code point — the convention render-pipeline already uses for\varnothing— and is painted from U+2016.\Vertwas not merely missing.\left\Vertwas spelled as two\midbars, because the base-14 Symbol face has no U+2016: two atoms, the wrong box, and no growth chain at all.\lVert/\rVerthad the same spelling and\lvert/\rvertwere relations where mathtools makes them fences. All five now set the one real double bar, class forced at the command.Group 2 — twenty-one macros, accents and operators
\hookleftarrow\longmapsto\smallint\intop\ointop\varbigtriangleup\varbigtriangledown\ldotp\cdotp\sqrtsign\not\mathring\injlim\projlim\varinjlim\varprojlim\iiiint\idotsint\pod\nobreakdash\pmb.\not(334) is the zero-width negation slash the following relation is overprinted with, which is what\neqis. Emitting it as its own atom generalises to any relation where a precomposed table cannot, and is exactly how render-pipeline already decomposes\neq/\notin(mathtex::NOT_SLASH).\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 carries cmsy's own advance the way\varnothingcarries msbm's.\injlim/\projlimare built through the existing operator nucleus, so they are byte-for-byte what writing\operatorname*{inj\,lim}gives — which the measurement below confirms to the fifth decimal.\pmbis the one deliberate approximation and says so. pdfTeX measures\pmb{x}as exactly$x$(the three overprinted copies cancel), so the advance is right; this compiler has no overprint primitive, so the emboldening is reported rather than faked with a bold face, which would be a different and wider design.Measured against pdfTeX, not assumed
TeX Live 2025 pdfTeX 3.141592653-2.6-1.40.27 at 10pt, through the repo's own oracle machinery (
tools/visual-oracle/pdftext.py, the amsmath corpus oracle'sref_pages/cand_pages), withvendor/compilerandvendor/math-layoutlocally 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 and no difference is inherited from a line break.'not supported' diagnostics: 0(was 30). Of 65 anchors, 54 agree within 0.5 bp. Everything in this PR is either exact or reproduces the error its already-supported sibling shows onmain:$a\sym b$and$\left\sym\frac{p}{q}\right\sym$\intop\ointop\varbigtriangleup\varbigtriangledown\ldotp\cdotp\smallint\not\mathring\sqrtsign\pod\pmb\lvert\lVert\varinjlim\varprojlimmain\hookleftarrow\hookrightarrow−6.67 bp\leftarrow\joinrel\rhook, as\hookrightarrowalready is\longmapsto\longrightarrow−1.47 bp\iiiint\iint−1.66 bp∫with no\intkern@model, as\iint/\iiintalready are\idotsint\iint−1.66 bp\intdots@\injlim\operatorname*{lim}_{n}−5.4204 bp\operatorname*-with-limits path\projlimTwo findings the controls produced, both pre-existing and 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. math-layout hard-codesExtensionSizing::Fixed, so every family-3 glyph in a 12pt amsmath document is 1/6 too small —$a\int b$is −1.32 bp,$a\lgroup b$−1.77 bp. Measuring at 10pt removes the difference, which is why the table above is 10pt.ExtensionSizing::Scaledalready exists for this case; nothing selects it.\operatorname*-with-limits path is −5.42 bp onmain.Export
Nine new glyphs bind to the pinned Latin Modern Math resource with advances read from the exact bundled font program (
tests/lm_math_binding.rsre-reads it and fails on drift).\vert,\backslash,\intopand\ointopare deliberately absent from that table: they resolve to characters\mid,\setminus,\intand\ointalready bind, so a second row would be a duplicate, not a new binding.Two further decided outcomes, both about a glyph the base-14 writer genuinely cannot draw:
\lmoustache/\rmoustacheare the only two non-\mathcalcharacters bound to New Computer Modern Math — Latin Modern Math has no glyph at U+23B0 or U+23B1 at all (checked against the bundledlatinmodern-math.otf). The export reason names them rather than inheriting the\mathcalalphabet's wording; that precision is what keeps the real-world corpus byte-identical.\Arrowvertreports that no font carries it as a character.export's "every math symbol has a decided outcome" test covers both.No new binding is a WinAnsi text character, so none can take a prose glyph over the way
\imathon U+0131 did in #185 (export::map_charconsultslm_math::advancebefore WinAnsi). The two nearest misses were checked: U+2016 and U+2223 are not WinAnsi, and|is deliberately not bound.Also in this PR: two spacing bugs in ordinary prose
Reported by the algorithm-floats lane, both measured and fixed in the second commit — see its message for the numbers.
$a \bmod b$was missing amsopn's\mkern5muon each side (2.77 bp each), and$1, 2, \dots, n$was missing the 3mu between each pair of dots (1.66 bp per gap), because\ldots/\cdotswere one text run instead of the three punctuation atoms\mathinner{\ldotp\ldotp\ldotp}defines. Both are exact now, in text and script style. The\ldotp/\cdotpthis PR adds are what made the second one a two-line fix.A bare
$\dots$with amsmath loaded is still 1.66 bp narrow, and that one is not a bug: amsmath makes\dotscontext-sensitive and expands it to\dotsowhen nothing follows, which appends a thin space (pdfTeX with amsmath:\dots13.33324pt,\ldots11.66661pt; without it, both 11.66661pt). This compiler's math parser is package-agnostic, so it implements the kernel definition — the known difference #180 recorded for\colon. Every in-context shape is exact.Not taken, deliberately: #194's
\triangleright/\triangleleft3.56 bp residual. That residual is exactly what acm::symbol_slotrow fixes —fontmath.ltx264-265 puts both in thelettersfamily (cmmi"2E/"2F, 0.5 em), where the OpenType fallback is Latin Modern Math's 0.858 em — so'\u{25B7}' => (Italic, 0x2E)and'\u{25C1}' => (Italic, 0x2F)in the sibling layout PR would close it. I have not added them: they would silently move #194's measured numbers, and #2 asked for that lane to be coordinated first. Worth checking at the same time whether #194 and #185 both added those two commands to the compiler.Gates
Base
main9abbf330. Font setup: the repo's ownapps/mac/FontswithFLASHTEX_FONT_DIRSand the three-directoryFLASHTEX_TFM_DIRS. Every number was taken only after asserting zerofont_unavailable/required_metrics_unavailable/tfm_missing/ec_metrics_unavailable/math_metrics_opentype/math_glyph_unmapped.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/compilercrates/math-layoutcrates/render-pipeline32-braces-narrow)The eight render-pipeline failures are the partial-font control tests (
missing_required_metrics_are_a_blocking_diagnostic_not_a_silent_fallback, the\mathbb/\mathcal/\varnothingsecondary-face pair,page_frame_against_pdflatex, …), whichFontSet::newreads the global environment for, so configuring fonts is what fails them. They fail identically on the control.Generated artefacts regenerated (
crates/compiler/scripts/render_supported_latex.sh,apps/mac/scripts/sync-supported-latex.sh);supported_latex.rs's three drift gates pass. Nocrates/render-pipeline/vendor/*file is committed (git diff 9abbf330 -- crates/render-pipeline/vendor/is empty).Resume notes
agent/kabir-claude/kernel-delimiters-compiler, head74ed78f0, based onmain9abbf330. Two commits.agent/kabir-claude/kernel-delimiters-layout, head10ba0e85. Disjoint file sets; either can merge first.crates/compiler/src/{export,lm_math,math,newcm_math,supported,vocabulary}.rsovercrates/render-pipeline/vendor/compiler/src/andcrates/math-layout/src/{cm,mathlist}.rsfrom the sibling overcrates/render-pipeline/vendor/math-layout/src/(all eight are byte-identical to9abbf330before these branches — verified), rebuildflashtex-render, and set the font environment above. Do not commit the vendor swap.{amsmath,amssymb}_corpus/oracle.py) still spell the font environment asFLASHTEX_FONT_DIRS=<fonts> FLASHTEX_TFM_DIRS=<fonts>and override the caller's — the bug oracle harnesses: stop discarding the caller's font environment; a fontless cargo test is no longer silently green #193 fixed elsewhere. A plain font directory cannot satisfy the rooted required-metrics reader, so both corpora score 0/59 and 0/39 onmainas well until--fontsis a directory whose own path ends infonts/tfm/public/lmand containsGUST-FONT-LICENSE.TXT(the flat route refuses a directory without it). That is how the 59/59 above was obtained;run.pyalready takes--font-dirs apps/mac/Fontsand derives the rest.What this pair does not close
21 of the 55 remain, and none of them is a table row:
lasy.\lhook\rhook\mapstochar\braceld\bracelu\bracerd\braceru. Unicode names none of them and no bundled face carries one; they exist only to build\hookrightarrow,\mapstoand\downbracefill/\upbracefill, which are already supported as wholes. Closing them needs a private-use sentinel each and a painted outline that does not exist.\sqsubset/\sqsupset— not kernel at all:amssymb.sty111-112 has them commented out andamsfonts.sty99-100 declares them (AMSa "40/"41). The compiler'samssymb.rsis generated byscripts/gen_amssymb.py, which reads onlyamssymb.sty. The fix is to teach the generatoramsfonts.stytoo, and regenerate — which needs the TeX Live 2026 tree the committed table came from, not this box's 2025.\dddot/\ddddot— measured, and not an accent. amsmath 744-750 builds them as\mathop{x}\limits^{\vbox to-1.4\ex@{\hbox{\,\normalfont...}}}, so the dots are text-size roman periods and the box is as wide as they are:\dddot{a}is 10.00038pt at 10pt whereais 5.28589pt. Setting them as a combining accent would give the right ink and a 4.7pt-too-narrow box; they need a raised text-size hbox over an operator, which this compiler has no nucleus for.\mathscr— not a kernel command. It comes frommathrsfs(rsfs) oreuscript'smathscroption (eusm), neither of which is bundled, and both are package alphabets rather than kernel symbols.\varliminf/\varlimsupand the remaining amsmath odds and ends listed in compiler: \colon as math punctuation, \mathbb as a real msbm alphabet, the largesymbols operators and \neg #180.🤖 Generated with Claude Code
https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu