Repository navigation
Conversation
…wn slot, the eight largesymbols operators and \neg/\lnot
`\colon` was diagnosed "not supported in math mode" and typeset literally.
`fontmath.ltx` 400 declares it `\DeclareMathSymbol{\colon}{\mathpunct}
{operators}{"3A}`: the same character as a bare `:` (declared `\mathrel` on
line 385), in the punctuation class. `command_atom` now forces `AtomClass::
Punct` on a ":" symbol atom, the same shape `\bot`/`\perp` already use, so
`f\colon A` sets 3mu after the colon instead of the relation's 5mu on both
sides. Measured against TeX Live 2025 pdflatex at 12pt: `f\colon A` is
21.14493pt, `f:A` 25.81152pt, `f{:}A` 19.14496pt — exactly the +3mu / +10mu
the new unit test asserts.
`\mathbb` already produced the blackboard capitals; what it got wrong was
everything else, where it raised "\mathbb supports only capital letters A-Z"
and typeset the argument as plain text. amsfonts.sty 114 declares `\mathbb`
a math *alphabet* (`\DeclareMathAlphabet{\mathbb}{U}{msb}{m}{n}`), so each
character keeps its own class and is set at its own slot of msbm10. Only
"41-"5A hold blackboard capitals; the rest hold unrelated AMSb symbols, and
pdfLaTeX sets them silently with no "Missing character". Verified with
pdflatex at 12pt: `\mathbb{1}` and `\nVdash` both box at 8.66669pt,
`\mathbb{x}` and `\curvearrowleft` both at 12.00003pt, and `a\mathbb{1}b`
(19.83043pt) matches `a{\nVdash}b`, not `a\nVdash b` (26.497pt) — the
alphabet keeps the character's Ord class. `\mathbb` now emits that msbm
symbol with the class forced back to Ord, with a warning naming the symbol
instead of an error. An empty argument is still an error.
The eight `largesymbols` operators of fontmath.ltx 420-431 that had no rows
(`\bigcup`, `\bigcap`, `\bigvee`, `\bigwedge`, `\bigodot`, `\bigoplus`,
`\bigotimes`, `\coprod`) and `\neg`/`\lnot` (372-373) join COMMAND_GLYPHS.
Adobe Symbol carries only the binary `union`/`intersection`/`logicalor`/
`logicaland` glyphs, so the eight n-ary ones are drawn from the pinned Latin
Modern Math resource like `\setminus`, with advances read from the exact
bundled font program (`tests/lm_math_binding.rs` re-reads it). math-layout's
`cm::symbol_slot` and `default_class` already carry all eight at their cmex10
slots with `\mathop` limits, so no math-layout change is needed. `\neg` is
Adobe Symbol's `logicalnot`, added to `export::SYMBOL_ENCODING` so the
base-14 PDF writer encodes it rather than reporting it unrepresentable.
`\bigsqcup` (cmex "46, U+2A06) and `\biguplus` (cmex "55, U+2A04) are the two
operators left out: they also need a `cm::symbol_slot`/`default_class` row in
crates/math-layout, which the render pipeline vendors, so they belong with
the pipeline change rather than here.
Gates (TeX Live 2025 on NixOS; the committed corpus refs were generated with
MacTeX, so their absolute scores are not reproducible here — these are
before/after comparisons against the same checkout):
- crates/compiler `cargo test --release`: 398 passed, 0 failed (was 395).
- amsmath corpus (crates/compiler/tests/amsmath_corpus/oracle.py check):
0/59 before and after, every fixture's aligned/within-tol/unaligned/
worst_bp/extension-column counts bit-identical.
- amssymb corpus (39 fixtures): 0/39 before and after, per-fixture identical.
- real-world corpus (tools/real-world-corpus/run.sh --no-oracle, 10 fixtures
x 2 producers): status, page counts, error/warning counts and the exact
diagnostic message sets identical before and after; hw1 3 pages and hw2
3 pages (render) with 0 errors and 0 overfull on both sides.
- crates/paragraph-layout `cargo test --test hyphenation_oracle`: 5 passed,
`thirty_paragraphs_break_like_pdflatex` (the HW1/HW2 line-break oracle) ok.
Implementation-Agent: kabir-claude (engine-engineer, linux-primary)
Commit-Executor: kabir-claude direct git (Cursor usage limit fallback)
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu
Co-authored-by: GoKubar <[email protected]>
…th-symbols-compiler
This was referenced Sep 13, 2026
Merged
GoKubar
added a commit
that referenced
this pull request
Sep 13, 2026
…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
GoKubar
added a commit
that referenced
this pull request
Sep 14, 2026
#472) * compiler: mathtools colon relations (eqqcolon, Coloneqq, Eqqcolon, vcentcolon, dblcolon) Adds the five sibling relation symbols to mathtools' existing colon family (\coloneqq already worked). \vcentcolon and \dblcolon are built from the same plain ":" glyph #180 uses for kernel \colon (Rel instead of Punct), not a separate Unicode lookalike; \Coloneqq/\Eqqcolon build compositionally from the same ":"/"=" glyphs, for font/kerning fidelity with what pdfLaTeX actually draws. All five are gated on \usepackage{mathtools} (mathtools.sty defines them; base LaTeX2e does not -- verified against TeX Live 2025 with \ifcsname). Regenerates crates/compiler/supported/supported-latex.json, docs/user/compiler.md and the byte-identical apps/mac bundled copy for the four new inventory entries. Implementation-Agent: muse-spark-1.3-contributor (Muse Code, lane mathtools-colons, slice 1) Commit-Executor: daniel-muse-lead (Claude Sonnet) Reviewed-by: daniel-muse-lead (Claude Sonnet) Muse-Lane-Head: fcffef63 Co-authored-by: muse-spark-1.3-contributor <[email protected]> * compiler: build mathtools colon relations with their real .sty kerns Fixes a real correctness bug in the earlier commit: \dblcolon, \Coloneqq, \Eqqcolon and \eqqcolon were built with no kern between their component glyphs, and \eqqcolon used a precomposed U+2255 lookalike instead of building from = and \vcentcolon. Real mathtools.sty (486-507, legacycolonsymbols) defines all four with explicit \mkern: \dblcolon = \vcentcolon \mathrel{\mkern-.9mu} \vcentcolon \Coloneqq = \dblcolon \mathrel{\mkern-1.2mu} = \Eqqcolon = = \mathrel{\mkern-1.2mu} \dblcolon \eqqcolon = = \mathrel{\mkern-1.2mu} \vcentcolon Adds a small `mkern(mu, span)` helper (mu/18 em, the same conversion the "colon" arm above already uses for amsmath's measured 6mu/2mu split) and rebuilds all four as Nucleus::Space kerns interspersed with the existing vcentcolon_atom()/plain "="/":" glyphs inside their relation groups. A Nucleus::Space atom lays out with zero items and no class, so it replaces (not adds to) the normal inter-atom spacing between the two glyphs it separates -- matching what a real \mkern atom does. Rewrites both tests that covered this family so their expected values are independent of the implementation: the width test now derives `own` from raw `width(":", SIZE)`/`width("=", SIZE)` glyph metrics plus the literal .sty mu values (not from calling into the atoms' own reported width), and the parse-structure test explicitly asserts each kern's exact em value. Independently cross-checked against real pdflatex + mathtools at 10pt (kpsewhich mathtools.sty for the source, then measuring \setbox0=\hbox{$a<cmd> b$} against a \hbox{$ab$} control for \vcentcolon/\dblcolon/\eqqcolon/\Coloneqq): the implementation's predicted widths match the real \wd measurements to within manual arithmetic rounding. Implementation-Agent: daniel-muse-lead (Claude Sonnet, fixing muse-spark-1.3-contributor's earlier commit per daniel-parent's review) Commit-Executor: daniel-muse-lead (Claude Sonnet) Reviewed-by: daniel-muse-lead (Claude Sonnet) * compiler: centre the mathtools vcentcolon ink on the math axis Fixes daniel-parent's re-review of #417: mathtools defines \vcentcolon as \mathrel{\mathop\ordinarycolon} -- the \mathop centres the colon's ink on the math axis, but the plain ":" glyph this compiler drew it with sits on the baseline like any other symbol, so \vcentcolon, \dblcolon, \Coloneqq, \Eqqcolon and \eqqcolon all came out too low. layout_nucleus now raises exactly the atoms vcentcolon_atom makes (a plain ":" with a forced Rel class -- kernel \colon is Punct, amsmath's is Ord, a literal ":" carries no override, so none of those move) by MATH_AXIS_EM * size minus half the text face's real x-height (the colon's dots span baseline..x-height, so half that height is the ink's own center above the glyph's baseline) -- the same axis-minus- visual-centre pattern already used for fence baselines, using the same real x_height_pt() metric layout_accent already relies on, not a guessed constant. The two mathtools compound relations nest these same atoms in their groups, so the fix propagates to them automatically. Also drops the now-dead ('\u{2255}', 906) row added in the prior commit: \eqqcolon now renders as "=" + kern + the centred colon, never that precomposed glyph. Verified independently by the reviewer on this exact commit: - `cargo test --lib math::`: 84 passed, 0 failed (80 in math.rs + 2 lm_math::tests + 2 newcm_math::tests -- a substring-matched filter, not pure math.rs count). - Mutation check: zeroing the raise fails vcentcolon_centres_the_colon_ink_on_the_math_axis; restoring passes. - Full `cargo test` in crates/compiler: 0 FAILED across all suites. Implementation-Agent: muse-spark-1.3-contributor (Muse Code, lane fix417, slice 1) Commit-Executor: daniel-muse-lead (Claude Sonnet) Reviewed-by: daniel-muse-lead (Claude Sonnet) Co-authored-by: muse-spark-1.3-contributor <[email protected]> --------- Co-authored-by: d-q222 <[email protected]> Co-authored-by: muse-spark-1.3-contributor <[email protected]>
This was referenced Sep 15, 2026
Contributor
Author
|
Closing as superseded — the work is already on Replacement: \colon arms are on main in crates/compiler/src/math.rs and typeset.rs 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.
Compiler half of the math-symbol lane. Pipeline half is the sibling PR on
agent/kabir-claude/math-symbols-pipeline(independent, both based onmain, no stacking).What changed
\colonwas diagnosed\colon is not supported in math modeand typeset literally.fontmath.ltx400 declares it\DeclareMathSymbol{\colon}{\mathpunct}{operators}{"3A}— the same character as a bare:(declared\mathrelon line 385), in the punctuation class.command_atomnow forcesAtomClass::Puncton a":"symbol atom, the shape\bot/\perpalready use.Measured with TeX Live 2025
pdflatexat 12pt:f{:}A\hbox{$f{:}A$}\hbox{$f\colon A$}\hbox{$f:A$}\mathbbalready produced the blackboard capitals — the premise that it is "dropped" is wrong on currentmain; measured against pdflatex,$\mathbb{Z} a$ … $\mathbb{W} f$lands within 0.013 bp. What it got wrong was everything outside A–Z, where it raised\mathbb supports only capital letters A-Zand set the argument as plain text.amsfonts.sty114 declares\mathbba math alphabet (\DeclareMathAlphabet{\mathbb}{U}{msb}{m}{n}), so each character keeps its own class and is set at its own slot of msbm10. Only"41–"5Ahold blackboard capitals; the rest hold unrelated AMSb symbols, which pdfLaTeX sets silently — no "Missing character". Verified at 12pt:\mathbb{1}≡\nVdash: both 8.66669pt\mathbb{x}≡\curvearrowleft: both 12.00003pta\mathbb{1}b= 19.83043pt =a{\nVdash}b, nota\nVdash b(26.497pt) — the alphabet keeps the character's Ord class, it does not take the symbol's Rel class.\mathbbnow emits that msbm symbol with the class forced back to Ord, with a warning naming the symbol rather than an error. An empty argument stays an error.Eight
largesymbolsoperators +\neg/\lnot.fontmath.ltx420–431 and 372–373.\bigcup,\bigcap,\bigvee,\bigwedge,\bigodot,\bigoplus,\bigotimes,\coprodand\neg/\lnothad no rows and were all diagnosed unsupported. Adobe Symbol carries only the binaryunion/intersection/logicalor/logicalandglyphs, never the n-ary ones, so the eight come from the pinned Latin Modern Math resource like\setminus, with advances read from the exact bundled font program (tests/lm_math_binding.rsre-reads it and fails on drift). math-layout'scm::symbol_slotanddefault_classalready carry all eight at their cmex10 slots with\mathoplimits, so no math-layout change was needed.\negis Adobe Symbol'slogicalnot, added toexport::SYMBOL_ENCODINGso the base-14 PDF writer encodes it instead of reporting it unrepresentable.Gates
crates/compilercargo test --releaseamsmath_corpus/oracle.py check)amssymb_corpus/oracle.py check)crates/paragraph-layoutcargo test --test hyphenation_oraclethirty_paragraphs_break_like_pdflatex32-braces-narrow(amssymb, brace extents, worst 1.012 bp) fails onmaintoo. The real-world corpus's 3ec_metrics_unavailable+ 3font_outline_substitutedare pre-existing and identical on both sides: the bundledFontsdir ships nolmmono*.otfand noectt*T1 typewriter metrics.New drift-gate artefacts regenerated (
crates/compiler/scripts/render_supported_latex.sh,apps/mac/scripts/sync-supported-latex.sh);supported_latex.rs::generated_artifacts_are_currentpasses.What the sweep found and this PR does not fix
I swept 509 math commands — every
\DeclareMathSymbol/\DeclareMathDelimiter/\mathchardefinfontmath.ltx,plain.tex,latexsym.sty,amssymb.sty, plus the common amsmath/mathtools macros — through the compiler and collected the diagnostics. 115 were unsupported. Notably, amssymb itself is essentially complete (the generatedamssymb.rscarries all 219 declarations; the 6 names it omits are commented out inamssymb.sty, so the kernel definitions apply). The real gap is the LaTeX kernel / plain TeX symbol set.After this PR, 105 remain. Tiered by what each needs:
Two operators that need one
crates/math-layoutrow each (acm::symbol_slot+default_classentry), which the render pipeline vendors, so they belong with a pipeline change rather than here:\bigsqcup"46\biguplus"55Forty-four more
\DeclareMathSymbols that need acm::symbol_slotrow plus aCOMMAND_GLYPHSrow, all mechanical now that the pattern is established (fontmath.ltxfamily/slot on the left, unicode-math code point on the right):\amalg(sym"71, U+2A3F),\asymp("10, U+224D),\clubsuit("7C, U+2663),\dagger("79, U+2020),\ddagger("7A, U+2021),\diamondsuit("7D, U+2662),\flat(letters"5B, U+266D),\frown("5F, U+2322),\heartsuit("7E, U+2661),\imath("7B, U+1D6A4),\jmath("7C, U+1D6A5),\leftharpoondown("29, U+21BD),\leftharpoonup("28, U+21BC),\mathdollar(ops"24),\mathparagraph("7B, U+00B6),\mathsection("78, U+00A7),\natural("5C, U+266E),\nearrow("25, U+2197),\nwarrow("2D, U+2196),\odot("0C, U+2299),\ominus("09, U+2296),\oslash("0B, U+2298),\prec("1E, U+227A),\preceq("16, U+2AAF),\rightharpoondown("2B, U+21C1),\rightharpoonup("2A, U+21C0),\searrow("26, U+2198),\sharp("5D, U+266F),\smile("5E, U+2323),\spadesuit("7F, U+2660),\sqcap("75, U+2293),\sqcup("74, U+2294),\sqsubseteq("76, U+2291),\sqsupseteq("77, U+2292),\star("3F, U+22C6),\succ("1F, U+227B),\succeq("17, U+2AB0),\swarrow("2E, U+2199),\triangleleft("2F, U+25C1),\triangleright("2E, U+25B7),\uplus("5D, U+228E),\wr("6F, U+2240).All 44 advances are present in the bundled
latinmodern-math.otf(measured with the repo's ownTrueTypeFace).Sixty-one that are macros, delimiters or package constructs, not plain symbols — each needs its own arm, not a table row:
\Vert/\vert/\backslash/\Updownarrow/\updownarrow/\lgroup/\rgroup/\lmoustache/\rmoustache/\arrowvert/\Arrowvert/\bracevert(delimiters);\Box/\Diamond/\Join/\leadsto/\lhd/\rhd/\unlhd/\unrhd/\mho(latexsym);\hookleftarrow,\longmapsto,\surd,\sqsubset,\sqsupset,\bullet,\diamond,\bigcirc,\varrho,\smallint,\intop,\ointop,\owns,\not,\lnot-family leftovers\ldotp/\cdotp/\lhook/\rhook/\mapstochar/\varbigtriangleup/\varbigtriangledown/\sqrtsign/\braceld/\bracelu/\bracerd/\braceru;\mathring,\dddot,\ddddot,\pmb,\mathscr,\iiiint,\idotsint,\nobreakdash,\pod,\injlim,\projlim,\varinjlim,\varprojlim.Known difference this PR deliberately does not close
amsmath redefines
\colon(amsmath.sty409–410):That is 2mu before and 6mu after, not the kernel's 0mu/3mu. Measured at 12pt:
\hbox{$f\colon A$}is 21.14493pt without amsmath and 24.47821pt with it — a 5mu difference. The compiler's math parser is package-agnostic (math::parse_tokenstakes no package context; the same is true of every amsmath construct it already implements unconditionally), so the kernel definition is what is implemented. Closing this needs package context threaded into the math parser — a separate change, worth doing since amsmath is loaded by most documents that use\colon.Resume notes
agent/kabir-claude/math-symbols-compiler, head00242508(8e286aa0+ a clean merge oforigin/main89e49fed, generated artefacts regenerated after the merge).agent/kabir-claude/math-symbols-pipeline, headab4dd82a.crates/render-pipeline --release --bin flashtex-render, then the threeoracle.py check/run.shcommands in the table, with--fontspointing at a symlink-free directory holding the repo'sapps/mac/Fonts/*.otfand every.tfmunderapps/mac/Fonts/texmf. Assert zerofont_unavailable/required_metrics_unavailablein the output before trusting any number.crates/compiler/src/{export,lm_math,math,supported,vocabulary}.rsovercrates/render-pipeline/vendor/compiler/src/(uncommitted; those five files are byte-identical tomainbefore this branch). Do not commit the vendor swap.🤖 Generated with Claude Code
https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu