Skip to content

parse: add corpus-census math symbols (\mathbbm, \intercal, \Coloneqq) - #1

Merged
tannevaled merged 1 commit into
mainfrom
math-corpus-symbols
Aug 18, 2026
Merged

parse: add corpus-census math symbols (\mathbbm, \intercal, \Coloneqq)#1
tannevaled merged 1 commit into
mainfrom
math-corpus-symbols

Conversation

@tannevaled

Copy link
Copy Markdown
Contributor

What

Add standard math symbols and double-struck alphabets that an arXiv corpus census found the math layer was dropping — an unknown command inside a formula drops the whole equation, so these were silent losses on real papers:

command papers using it mapping
\mathbbm 1045 blackboard block (bbm indicator \mathbbm{1} → 𝟙)
\SI/\num (deferred — siunitx needs argument parsing)
\intercal 225 ⊺ (binary op)
\dotplus 18 ∔ (binary op)
\Coloneqq/\Coloneq 40 ⩴ (relation)
\mathbbmss/\mathbbb 10/17 blackboard block

\mathbbm/\mathbbmss (bbm) and \mathbbb (bbold) are all double-struck fonts; we approximate each with the Unicode blackboard block already used for \mathbb/\mathds, so \mathbbm{1} renders the indicator 𝟙 rather than refusing the equation.

Tests

  • TestCorpusCensusSymbols renders each new symbol/alphabet (red-without: unknown command \intercal; green-with).
  • TestAlphabets extended to assert the rune mapping (\mathbbm{1}=𝟙 = U+1D7D9, \mathbbm{R}=U+211D).
  • Full suite green under -race; 100% coverage; gofmt/go vet clean.

🤖 Generated with Claude Code

An arXiv corpus census of equations the math layer dropped whole (an unknown
command inside a formula takes the entire equation with it) surfaced several
standard symbols and double-struck alphabets we lacked:

  - \mathbbm (1045 papers) / \mathbbmss / \mathbbb — the bbm/bbold double-struck
    fonts; approximated with the Unicode blackboard block like \mathbb/\mathds,
    so the ubiquitous \mathbbm{1} indicator renders 𝟙 instead of dropping.
  - \intercal (225 papers) → ⊺, \dotplus → ∔ (binary operators).
  - \Coloneqq / \Coloneq (mathtools) → ⩴ (relation).

Red-without/green-with tests: TestCorpusCensusSymbols renders each, and
TestAlphabets asserts the \mathbbm{1}=𝟙 rune mapping. 100% coverage.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@tannevaled
tannevaled merged commit f4eb7fb into main Aug 18, 2026
11 checks passed
@tannevaled
tannevaled deleted the math-corpus-symbols branch August 18, 2026 11:25
tannevaled added a commit that referenced this pull request Sep 1, 2026
…la (#10)

A \def written inside a formula — a paper's own inline shorthand reaching the
math layer, \def\R{\mathbb{R}}\R or \def\abs#1{\lvert#1\rvert}\abs{x} — was an
unknown command that dropped the whole equation. Macros defined in the preamble
are already substituted upstream by go-tex/engine; the ones that live inside the
formula were not handled, and \def is a top math-drop cause across the arXiv
corpus.

Add a TeX "mouth" pass (macro.go) that runs before the parser: it records each
\def and expands every use — arguments spliced into #1…#n of the body, the
result re-processed so nested and chained macros resolve — with a budget that
stops a self- or mutually-recursive macro from spinning. It handles undelimited
parameters (the inline form that occurs); a \def it cannot read (delimited
parameters, no body) or a use with too few arguments is left verbatim for the
parser to report, never guessed at. The pass is transparent to a def-free
stream.

Verified: parameterless and parameterised macros, chained and nested macros,
expansion inside \frac arguments, single-token vs {group} arguments, and every
rejecting path (bad name, delimited params, missing/unbalanced body, too few
args, self-recursion) all covered; full suite, race, go vet, gofmt clean at 100%.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant