mathjax-go is a native Go port of the MathJax 3.2.2 TeX-to-SVG pipeline used
by D2. Its production packages do not embed,
load, or execute JavaScript.
The compatibility target is D2's frozen custom component, not current MathJax.
That component enables the base, mathtools, ams, amscd, braket,
cancel, cases, color, gensymb, mhchem, and physics TeX packages and
uses SVG output with fontCache: 'none'.
svg, err := mathjax.Render(`\frac{1}{2}`)
width, height, err := mathjax.Measure(`\frac{1}{2}`)Render uses the same conversion settings as D2: display mode, a 16-pixel em,
an 8-pixel ex, and inline SVG glyph paths. RenderWithOptions exposes those
settings explicitly. Both functions return the bare <svg> element that D2
previously obtained from the inner HTML of MathJax's <mjx-container>.
Measure preserves D2's pixel sizing contract by rounding the SVG's ex-based
dimensions up with the configured default of 8 pixels per ex.
As in MathJax, malformed or unsupported TeX is normally rendered as an
merror SVG. A Go error instead indicates invalid conversion options or an
internal pipeline failure.
The regular suite is pure Go:
go test ./...
go test -race ./...
go vet ./...An optional test-only differential runner compares the port with D2's cryptographically pinned MathJax bundle. Node.js and the JavaScript assets are used only by this oracle and are not linked into the Go library:
MATHJAX_GO_ORACLE_DIR=/absolute/path/to/d2renderers/d2latex \
MATHJAX_GO_ORACLE_FULL=1 \
go test ./...The directory must contain mathjax.js, polyfills.js, and setup.js with
the exact SHA-256 values recorded in PROVENANCE.md.
\ce{A <--> B} uses the original Mhchem reversible-arrow macro and its
three-dimensional \Rule spacer. \Rule and \Space read width, height and
depth with the existing TeX dimension parser; rules preserve the original
lexical color, including array and internal-math resets. The 120-case frozen
SVG corpus and regeneration instructions are documented in
testdata/reversible_reaction_README.md.
\middle and \right capture their lexical color before closing pending
styles, fractions, and positioning commands. \middle restores the environment
at \left entry, while retaining the preceding nodes for a later fraction.
For example, \left(\color{red}x\middle|y\right) keeps the middle bar red
and restores the following y and closing parenthesis to the surrounding color.
The retained corpus compares 846 complete original SVGs and 423 display
measurements. It covers delimiter color, repeated middle delimiters, fonts,
style and size declarations, fractions on either side, pending operators and
positioning, nested parser scopes, macro overrides, and error precedence.
Regenerate it with node testdata/generate_delimiter_color.cjs PINNED_ASSETS
and node testdata/generate_middle_scope.cjs PINNED_ASSETS.
\moveleft and \moveright read a TeX dimension and position the next
completed math item without changing its total advance. They use the original
PositionItem behavior: emit a leading space, the item, and a compensating
space. An enclosing positioning command consumes the first of these final
items, so mixed horizontal and vertical nesting follows the original stack.
The fixed corpus compares 748 complete original SVGs and 374 display
measurements, including signed and comma dimensions, all pairs and triples of
positioning commands, pending functions/operators, styles, scripts, scopes,
macro overrides, missing boxes, and delimiter/error precedence. Regenerate
it with node testdata/generate_horizontal_position.cjs PINNED_ASSETS.
Apache License 2.0, with identified MIT-derived portions. See LICENSE, LICENSES, NOTICE, and PROVENANCE.md.
The TeX parser converts valid, fully extracted mu values with the pinned
ParseUtil.muReplace/Em precision before creating MathML. The existing dimension
scanner and direct MathML length conversion are separate and unchanged.
The dimension corpus keeps 86 full SVG/explicit/own-tree records: 68 raw-primary results (including eight direct-MathML controls), 12 unchanged grammar boundaries, two CD-height renderer boundaries with exact primary trees, and four raise/lower consumer controls. The last four retain inherited structure and sign handling; only their three dimension strings change. Their SVG hashes are candidate regression captures, not claims of primary renderer parity. The untouched primary records are retained beside every qualification.
Registered parser fixtures also bind 44 full-token conversion controls, three
large-number formatting cases, and 38 accepted extraction/cursor/error controls.
The extraction records explicitly preserve scanner differences rather than
claiming complete GetDimen grammar compatibility. Regenerate the primary files
with testdata/generate_tex_mu_dimensions.cjs and
internal/tex/testdata/generate_mu_dimension.cjs, passing the pinned asset
directory and output directory/file respectively.
The supported text, text-font, hbox and mbox commands parse embedded
$...$ and \(...\) math with MathJax's empty inner lexical environment and
shared macro/tag configuration. Literal chunks preserve internal whitespace
and tilde; only the source's four literal escapes and edge whitespace rules
apply. hbox and mbox retain their level-zero wrapper, including empty input.
TestInternalTextPinnedReferences checks 80 complete unmodified-primary SVGs
and explicit/own-property trees, plus 10 unchanged shared-caller controls.
textup uses the same normal-font HBox mapping as textrm; textsl retains
the pinned undefined-command behavior. AMS tag text uses its wrapped fresh-parser caller. The 28 actual-method
references also bind delimiter errors, cardinality, child ownership, font and
macro-counter isolation. Two private pre-postfilter script nodes retain the
existing Go msub versus primary two-child msubsup representation; public
compiler trees have no such normalization.
Regenerate the references with the pinned D2 MathJax3.2.2 assets:
node testdata/generate_internal_text.cjs PINNED_ASSETS [EVIDENCE_DIRECTORY]
node internal/tex/testdata/generate_internal_text_method.cjs PINNED_ASSETS
fbox, colorbox and fcolorbox use the same internal text/math parser. Content
is parsed before resolving the outer background or frame color, so a color
created by embedded math is available to its box. The existing notation,
5px padding and 2px border are unchanged. A content error prevents the outer
box from being returned; an earlier shared color definition is not rolled back.
TestFramedInternalTextPinnedReferences binds 64 complete primary SVGs and
explicit/own-property trees across both modes, including twelve required error
outputs and unchanged boxed controls. The two macro-inside cases retain
the fixed package set's unsupported def error; successful registered macros
are exercised by the direct handler records instead. Twelve direct primary handler records
also bind argument consumption, node ownership, font/macro lifetime and color
lookup timing. Six private inner mi(x) nodes carry exactly three true Go
scope markers before compiler cleanup; the direct test checks that exact
triple and count, then compares every remaining explicit attribute and own
property. Public trees are compared without this qualification. Complete raw
map-layer snapshots remain diagnostic evidence, not a claim that the internal
attribute-storage representations are identical.
Regenerate the framed caller references with:
node testdata/generate_framed_internal_text.cjs PINNED_ASSETS [EVIDENCE_DIRECTORY]
node internal/tex/testdata/generate_framed_text_method.cjs PINNED_ASSETS
pod and pmod use the original one-argument macro definitions, including
style-dependent spacing, fixed parentheses, and forwarding through a registered
pod override. The 64-case public corpus checks complete original SVGs,
explicit attributes, own properties, and display dimensions for all 52 targeted
cases and 12 surrounding controls, including the four bmod cases.
Twenty registered-macro cases cover forwarding, argument counts, missing
arguments and fresh parser state. All twenty match the primary, including its
original recursive-macro diagnostic wording.
Regenerate the primary references with:
node testdata/generate_pod_commands.cjs PINNED_ASSETS [EVIDENCE_DIRECTORY]
node testdata/generate_pod_macros.cjs PINNED_ASSETS [EVIDENCE_DIRECTORY]
The pinned Superscript/Subscript handlers call GetNext once, then insert a space
following an immediate ASCII digit before checking the existing script slot.
Thus x^12 scripts 1 and leaves 2; a macro, font declaration, or comment
encountered first retains the ordinary number scanner. The same initial handler
rule applies after a pending prime and before a nested-marker error. This
script-local lookahead uses the primary JavaScript whitespace set, without
changing ordinary row parsing or number tokenization.
The dedicated 120-case matrix binds complete SVG and explicit/own-property
MathML, including 12 registered macro cases. It has 116 raw primary cases and four
exact-SVG prime cases retaining the precise inherited pseudoscript metadata
boundary. The ordinary/Unicode scanner and comma-tail cases now use their
unchanged primary references. Another 48 actual registered-handler records and 108 delegated
parser traces bind source insertion, cursor/error order and base ownership.
Four BOM cases match primary; four NEL cases preserve accepted Go outputs while
the pinned primary throws an internal exception, so they are not parity claims.
The two earlier D066 digit-tail whole-output qualifications now compare to
their unchanged primary references. Macro-boundary handling also promotes the
registered font-macro pair and the six retained-prefix cursor records; the
remaining D066 whole-output and precise prime-property boundaries stay intact.
Ordinary numeric tokens use the pinned ASCII scanner: 1,234 has a comma
operator, while 1{,}234 forms one number. Decimal and source-cursor behavior
follows that same pattern. Supported non-ASCII decimal digits use the pinned
range token kind and variant individually, without changing script lookahead.
The dedicated corpus covers 80 public expressions and 15 parser observations;
92 SVGs are primary, with four precise inherited metadata boundaries and
three explicitly unsupported-primary inputs retained as accepted Go controls.
See testdata/ordinary_number_README.md for provenance and regeneration.
Registered definitions of over, atop, above, choose, brace and brack
use normal macro dispatch before the built-in fraction handler. For example,
\DeclareMathOperator{\choose}{pick}x\choose y renders the declared operator.
An empty registered macro also retains the existing pending-prime behavior.
The 82-case fixture covers all six names, public declarations, argument errors, empty definitions, grouping and aliases that expand into genuine infix commands. All 82 complete SVGs match pinned MathJax, including the joined infix aliases. Seventy-four ordered full attribute/property trees match primary. The other eight retain their exact existing atop string-zero or plain-prime metadata records. The fourteen declared-operator property-order qualifications are removed using the unchanged primary references. No fields are omitted from these comparisons.
Regenerate the unmodified primary references with:
node testdata/generate_infix_macro_priority.cjs PINNED_ASSETS [EVIDENCE_DIRECTORY]
The default mod macro consumes one argument and uses the original mathchoice
spacing for display, text and both script styles. The44-case pinned corpus
covers unbraced, grouped, nested and missing arguments, script placement, and a
user-defined override. All 44 cases, including the two bmod controls, check
complete original SVGs, explicit attributes, own properties, and display dimensions.
node testdata/generate_mod_command.cjs PINNED_ASSETS [EVIDENCE_DIRECTORY]
The default bmod macro creates the original mo token with explicit
thickmathspace on both sides. The adjacent-relation filter supplies the
neighboring zero-side spacing when relations surround it. The 52-case corpus
checks complete original SVGs, explicit attributes, own properties, and display
dimensions, including relation neighbors, script styles, registered overrides,
and the original duplicate-superscript error. Historical boundary fixtures
remain as provenance; their pre-fix Go outputs are no longer expected results.
node testdata/generate_bmod_command.cjs PINNED_ASSETS [EVIDENCE_DIRECTORY]
A second supported infix fraction command in the same logical row reports the
incoming command's AmbiguousUseOf error. Denominator, style, size, font and
color continuations retain that row; braces, left/right groups, script arguments
and separate math parsers start independent rows. Incoming above dimensions
are read before ambiguity is checked, and registered macro dispatch stays first.
The 108-case pinned corpus has 107 complete primary SVG, ordered explicit/own-tree and structured-error matches. One active accepted-output boundary retains an inline nested fraction. The four pre-fix nested-style and explicit-delimiter records remain historical evidence; their tests now assert the untouched primary outputs. No changed output is qualified. Six parser re-entry/error-unwind controls check independent subsequent rows and restored font state.
Only the unchanged inline nested-fraction control separate-args-inline permits
two exact whole-SVG states, captured from accepted code on ARM64 and AMD64.
Its complete raw tree, structured error and parser state remain fixed; no other
case gains an alternative SVG and no numerical tolerance is used.
node testdata/generate_infix_scope.cjs PINNED_ASSETS EVIDENCE_DIRECTORY
The two earlier dimension-parser repeated-above cases and six registered-infix
ambiguity cases now use their untouched primary references; all other inherited
qualifications remain unchanged.
The SVG renderer gives each nonempty text child a positionable group when its parent has multiple children. This preserves each child and its measured advance instead of painting successive children at the same origin. Single children, empty text and the separate explicit-font path retain their source behavior.
Thirty-two constructed-token cases compare complete SVG and all explicit
attributes and own properties before and after rendering, while checking
original text-node identity. They cover mo, mi, mn, mtext, ms quotes,
empty children, multiple advances, a bold variant and explicit fonts in both
modes, including repeated rendering. This is an internal
renderer contract prerequisite for the separate adjacent-relation filter;
it is not a claim that accepted TeX parsing already produces every input.
Regenerate the unmodified primary references with:
node testdata/generate_multi_text_renderer.cjs PINNED_ASSETS [EVIDENCE_DIRECTORY]
An unfinished literal group reports ExtraOpenMissingClose ("Extra open brace
or missing close brace"). Argument readers retain their separate
MissingCloseBrace diagnostic. The 64-case pinned corpus covers ordinary,
nested, fractional, script, font, style, color and size groups, earlier errors,
and valid controls in both modes. Twenty-four parsed-group errors now match
complete primary SVGs, ordered explicit/own trees, errors and source cursors.
Four missing-right controls now match the primary ExtraLeftMissingRight
identity and "Extra \left or missing \right" message, complete SVG and ordered
explicit/own tree. All 40 historical controls keep the same source/cursor state;
two hash diagnostic controls now also match their complete primary outputs,
including the quoted diagnostic. The other 34 complete accepted outputs stay
unchanged. Eight argument-reader and two hash cursor differences remain bound.
The untouched primary and historical accepted references are preserved.
No general error or cursor normalization is used.
node testdata/generate_group_eof.cjs PINNED_ASSETS EVIDENCE_DIRECTORY
Macro substitution preserves a control word at each literal/argument/tail join, uses the original escaped-hash rules, and counts UTF-16 code units against the 5120-unit expansion buffer. It installs only expansion plus unparsed input and resets the cursor before checking the macro count. Argument, substitution and buffer errors retain the original precedence. The same rule covers the existing parameter-template macro route; environments and paired delimiters retain their separate implementations. Operator-name arguments use a complete child parser, preserving the caller source/cursor and shared command definitions while isolating expansion counts.
The 85 complete-output references comprise the original 72 cases and 13 bounded default-buffer/UTF-16/prime/style/font controls. All 40 changed SVGs match primary; 83 SVGs and 77 full attribute/own-property trees match without qualifications. The four hash-diagnostic outputs now use their untouched primary outputs; their historical accepted records remain in the fixture. Two supplemental newcommand-environment outputs remain exact accepted boundaries. Two vector and four prime records have raw primary SVGs with precisely retained own-property differences; the prime boundary is independently present in the direct accepted-before control. Registered handlers bind 22 actual entry/return/error source, cursor and count receipts; 28 actual helper references cover separators, escaping, UTF-16 and error order. Custom primary maxBuffer observations are not presented as a configurable Go API.
Fourteen additional operator-name records now match complete primary SVGs and all ordered attribute and own-property maps. The fixture retains the historical accepted outputs and property arrays, but the tests no longer accept them. The child-error control also requires the caller source, cursor and shared state to remain intact.
Operator-name identifiers start with ordinary classification, allowing the renderer to apply the primary automatic class for multi-letter names. Only the returned operator receives explicit OP; singular identifiers and wrapped TeXAtoms preserve their distinct primary property insertion order. Twenty-six additional whole-output references and eight actual-handler cases check this behavior, retained node identity, font/vector provenance, cursor/error state and classification before and after rendering.
Operator-name arguments retain one full child parser for groups, scripts, primes and deferred derivative arguments. The copied identifier pattern, operator-letter dispatch, font state and automatic-class suppression remain independent. Eight retained public references assert complete original SVGs, with four display measurements, covering grouped names, derivative operands, scripted derivatives and Unicode primes.
The two inherited Unicode-prime operator-name cases now use their original SVGs, explicit trees and display measurements. Their own-property comparison retains one precise pre-existing inheritance difference: the original stores pseudoscript=false on the prime. Tests remove only that field from a comparison copy at the recorded path. Historical fixture bytes, the other eight non-prime boundaries and the 86 existing prime-metadata boundaries remain unchanged; this does not claim full own-property parity or original private whitespace cursors. The two retained prime-only operator-name examples also use their original SVGs and trees with the same precise metadata qualification. Original traces require the caller macro count to remain unchanged across these genuine children; historical shared-counter fixture fields remain preserved.
The original fixed-D2 package corpus remains distinct from the official-3.2.2 newcommand augmented observations. Generate raw unchanged-primary captures with:
node testdata/generate_macro_boundary.cjs PINNED_ASSETS NEWCOMMAND_3_2_2_JS NEW_EVIDENCE_DIRECTORY
Responsive display math now applies the final minimum width of the last eligible
constructed top table. Six labelled-equation cases with surrounding material
match complete pinned-primary SVGs. Constructor identity, reverse measurement,
zero-width/inline behavior and the private math alignment policy have focused
controls; existing table layout consumers are unchanged. The fixture notes in
testdata/responsive_minwidth_README.md distinguish complete primary outputs
from unchanged accepted controls and unresolved equation/table composites.
Raw math ~ follows the pinned Tilde handler: one token-factory mtext
containing a nonbreaking space, without ordinary-character font or stretch
policy. The 40 public and eight actual-handler reference inputs retain complete
primary SVGs and ordered explicit/own trees. The two unchanged accent controls
retain their exact earlier own-class metadata; three exact named prime records
retain only the recorded missing false pseudoscript property. The two escaped
\~ controls use their original primary SVGs, structured errors, and ordered
trees. Literal text, actual NBSP,
relation/accent commands, fonts, vector token creation, scripts and registered
macro source/cursor state remain separately checked. No primary output is
regenerated or candidate output used as a new whole-reference expectation.
Tag cells invoke the registered text command through MathJax's wrapped fresh
parser contract. The lexical environment and expansion counter are fresh while
configuration, labels, colors and macros remain shared. ID and label writes
precede content errors; errors prevent the outer cell/table from being returned.
The final cell reads the live tag ID. Reference construction is unchanged.
The focused corpus has 62 complete primary SVG/ordered explicit-own-tree cases and 18 actual tag-method/lifetime cases. Four rich tag/reference composites and the root-width interaction are complete primary matches. Two public composites remain separately captured diagnostics: the existing alignment anchor-scroll differences. Their full outputs are retained, not accepted through alternate expected snapshots.
Private checks retain exact constructor provenance at 25 named node paths and assert shared identities, early labels, counter/font isolation and errors. Both registered text override controls compare their complete method trees, including nonbreaking-space tokens, with those finite provenance pairs. Existing equation error teardown and alignment allocation/anchor behavior remain separately documented limits.
\flatfrac is registered as the primary Physics macro, so its two arguments use the existing macro expansion and override rules. Regression coverage compares 32 complete primary SVG outputs and checks eight private Macro scenarios, including argument errors, source installation, count limits, forwarding, and overrides. The corpus includes the original tall middle-delimiter cases and the two derivative continuations with registered fraction results. The inherited unclosed-argument cursor difference remains an explicit boundary; matching SVG does not assert complete internal-tree equality.
\genfrac validates each raw delimiter argument before reading later arguments and preserves the distinction between an absent fence and .. Its fixed fences use the registered \mathchoice and size commands with fresh child-parser counters and shared configuration.
The regression corpus retains 48 complete primary SVGs, 45 raw delimiter-reader contracts and five fence identity/property cases. Fourteen Go-only seeded guards protect the observed palette parser lifetimes. Prefix-style parsing (D120) and Physics StarMacro's own expansion charge (D121) remain separate; the tests do not assert full raw-model parity or the known-wrong StarMacro total count.
Eight inherited Genfrac controls also compare the original primary explicit-attribute and own-property trees. Their resolved fence-property qualifications are removed; the two prime and two atop qualifications remain unchanged.
The va/vectorarrow and vu/vectorunit aliases charge their own expansion after argument and buffer validation, before descendant parsing. Their genuine accent-argument and VectorBold children use independent expansion counters. Fourteen retained primary references cover ordinary aliases, the public 1000/1001 boundary, registered overrides, error precedence and the existing Genfrac lifetimes. Two additional Go guards protect the observed child-counter boundaries. The existing synthetic expansion still has a separate source/cursor and cannot consume a registered vec argument from the caller's suffix; this change does not claim complete StarMacro rewrite-state or raw-model equivalence.
Command-symbol lookup skips source maps that have no parser, so data-only negation and character-remapping tables do not create TeX commands. Existing registered Macro overrides and executable symbol/delimiter fallback retain their precedence; the data tables and their ordinary consumers are unchanged.
The bounded regression corpus compares 128 public and four privately registered Macro cases with complete retained primary SVGs. Public error messages are checked through the exported renderer's merror SVG; their actual error IDs were verified in the retained parser observations. The private forwarding case additionally checks the real parse error ID and message at the compiler initialization seam. These private fixtures do not add a public macro-registration API.
Delimiter fallback accepts only explicitly backslash-prefixed command entries; raw delimiter keys remain available to their delimiter consumers. Fourteen additional public references compare complete unchanged primary SVGs for escaped raw-key errors and greater-than spacing. Two escaped less-than cases separately require XML-valid Go output with the exact decoded primary error message and text. Their fixture retains the untouched primary SVG: its error attribute contains a literal <, whereas Go retains XML-safe <. These two cases are explicitly not whole-primary-SVG matches.
Bare \laplacian constructs a normal-variant mi nabla as the base of its square. Two additional public references compare its complete primary SVG in inline and display modes. This coverage is limited to the bare command; D106 operand and child-parser lifetime behavior remains outside this symbol-construction change.
The ordinary backtick glyph and escaped-pipe Braket dispatch were excluded from this corpus; the separate Braket correction below now covers escaped-pipe dispatch. Matching SVG does not claim full raw-model equality.
\not waits for the next parsed item, applies the primary token remap or combining mark when eligible, and otherwise emits the zero-width slash fallback. Groups, argument-taking commands, nested negation, end-of-input and registered overrides retain their own parsing behavior. A base identifier with combining marks keeps its automatic italic variant.
Twenty public references compare complete original MathJax SVGs in inline and display modes, including the two unchanged override controls. These tests cover rendered output; they do not claim complete internal-model or general operator-name parser equivalence.
The argument-free \qty and \quantity handlers leave an unsupported * for ordinary parsing after an explicit empty fenced row. The star and following material are preserved. Argument-taking quantity aliases and the existing nonstar path keep their behavior.
Four public \qty references compare whole primary SVGs in both modes, and two existing tail-preservation cases now compare their original primary SVGs, errors, and ordered explicit/own trees. All primary and accepted reference fields remain unchanged. The \quantity alias shares the pinned handler mapping; it has no separate runtime reference in this bounded corpus. Other unsupported-token paths and full raw-model equality remain outside this change.
\middle sets the primary stretchy attribute without forcing fence or symmetric attributes. A slash between scripted operands therefore keeps the primary glyph size and baseline. Four public references compare complete primary SVGs in inline and display modes: two scripted \flatfrac cases and two unchanged basic controls.
The eight derivative aliases reparse the primary Physics fraction expansion. Optional orders attach after the raw denominator variable; mixed partials count their variables and ignore the optional order. Starred forms use the registered \flatfrac command. Generated children share configuration but copy the font environment and keep independent expansion counters at genuine parser boundaries. Registered fraction results are delivered before trailing AutoOpen processing, including empty and multiple-node results.
The finite public corpus preserves 88 original references: all 88 complete SVG assertions cover ordinary and starred derivatives, aliases, variable grouping, orders, fonts, errors and following parentheses, including the four former Differential/variation diagnostics. The existing AutoOpen fixture now checks 103 primary SVG/ordered-tree cases, including its two historical Differential controls, while its three prime-property diagnostics remain separate. Seven registered-result cases, empty-result pending-prime rejection, and two independent/shared macro-budget cases guard the observed child and delivery contracts. This does not assert universal internal-tree equality or general pending-script delivery for multiple-node overrides.
Adjacent relation operators use the per-parse operator creation list after MathML cleanup. Compatible neighbors retain their original text-child identities when combined; incompatible explicit attributes receive the source-defined missing-side spacing. Ancestor semantic flags refresh after sibling removal so decorated relation bases keep their spacing.
The public corpus retains 68 original references and checks all 68 complete primary SVGs, including four decoration cases, four derivative relation cases, two Commutator cases and four SideSet cases. The internal method corpus checks 58 complete before/after graphs and ordered lists. Creation coverage uses the same 68 requests plus three existing direct-method copy controls; the two dots cases now cover successful construction, both initial ellipsis registrations and the unused token’s removal from the live list. This does not claim universal internal-model equality or Studio adoption.
The existing ordinary-arrow controls also use their original combined-token SVGs, dimensions, and math-accent markers. Their earlier Go-output exceptions are removed; the historical fixture retains both original and pre-fix outputs for provenance.
The dots command chooses the original baseline or centered ellipsis when the
following stack item is delivered. It preserves groups, font changes, scripts,
and function/negation ordering. The 48-case public fixture checks complete
original SVGs and display dimensions, including the original script-argument
error. The two retained adjacent-relation examples now use their original SVGs;
creation coverage checks both ellipsis tokens in the original order.
Commutator, anticommutator and Poisson-bracket aliases parse the original combined argument expression in a child parser. This preserves punctuation spacing, font scope and shared configuration, while honoring the original delimiter mapping, star/size modifiers and argument requirements.
The finite public corpus checks 48 unchanged original SVGs and 24 display measurements, including six rendered-error controls. The two retained adjacent-relation examples now assert their original SVGs. Existing creation and derivative regressions remain in force; this does not claim universal internal-model equality or Studio adoption.
SideSet preserves non-script material before and after the operator, splits only the original leading-script cases, and constructs phantom bases and multiscripts in the original order. Its three argument parsers share command definitions while preserving each argument’s font scope. A fixed 48-case public corpus checks complete original MathJax SVGs and 24 display measurements, including ordinary scripts, mixed content, explicit groups, primes, and a missing-argument error.
Style, size and color declarations close before an incoming infix fraction, so they affect the numerator rather than wrapping the whole fraction. Real groups and left/right bodies retain their own boundaries. A fixed 48-case public corpus compares complete original SVGs and 24 display measurements, including font continuation, pending-item boundaries and six rendered-error controls.
Explicit-delimiter infix commands (overwithdelims, atopwithdelims and abovewithdelims) read both delimiters before thickness and ambiguity checks. Fraction thickness is independent of fence presence, including one-sided and empty fences. A fixed 48-case public corpus checks complete original SVGs and 24 display measurements, including 20 rendered-error controls; existing registration, style, group and fixed-fence regressions remain in force.
Declared paired delimiters use source-safe argument substitution and continue in the caller after joining the remaining input. Explicit sizes retain their supplied command, and one macro expansion is charged after installing the joined source. Five retained examples assert complete original SVGs, with two display measurements across the corpus and three original source/cursor/count traces. Two additional slash examples retain their original SVGs but separately assert exact unchanged baseline output: the missing ORD wrapper belongs to the later cleanStretchy filter and is not fixed here. Existing XPP and macro-limit controls remain in force.
Script scaling reads the effective scriptsizemultiplier and scriptminsize attributes, including the original exact default multiplier. A retained constructed-MathML reference checks the exact subscript bounding box and unchanged complete multiscript SVG. Eighteen focused controls cover attribute precedence, the minimum-size floor, script-level cap, mathsize, and relative or inferred-row scaling.
Equation environments preserve the original per-parser nesting guard, including across captured table bodies and source continuations. Genuine child parsers have independent nesting state. Eight retained public references compare complete original SVGs, with four measurable nesting-error outputs; percentage-width single-equation controls are not asserted to have fixed pixel dimensions. The two historical inline sequential-equation controls now select their original error SVGs.
Constructed bevelled MathML fractions retain a generated stretchy slash wrapper for measurement and painting. Its actual glyph width determines denominator placement; it inherits display/script level, effective mathsize and prime state without copying authored IDs. One saved complete original SVG checks the demonstrated discrepancy, with source-contract tests for sizing, ownership, repeated measurements and ordinary-fraction controls. A reachable authored Studio TeX example has not been established.
gather and gather* keep explicit tags and labels local to each row, clear them before the next row, and restore the enclosing tag state when the table ends, including the Mathtools special-row route. Their centered tables retain the equation-nesting guard and repair initial relations in every column after the first. A fixed 67-case corpus compares complete original SVGs in inline and display modes, covering tag suppression/replacement, labels and references, duplicate errors, nesting, three-column rows, and tags before, on, and after special rows. Special commands that end a row preserve the following row and omit an empty final row. Eight state-lifetime guards cover success and error exits from the intercepted route. The two retained responsive-width gather examples now select their unchanged original SVGs.
Physics StarMacro aliases preserve their caller source and suffix, install the joined program before charging the expansion, and continue in the existing row. A retained registered-vec witness compares its complete original SVG and final source/cursor/count; public continuation controls and the fourteen existing StarMacro references preserve alias, font, error and limit behavior. The actual vec/hat argument and VectorBold child parsers retain independent counters without leaking temporary context into the caller suffix. The registered-macro witness is an engine boundary case, not evidence of ordinary original Studio reachability.
The three Mhchem equilibrium helpers are registered with their original TeX
macro definitions. \ce{A <=> B}, \ce{A <=>> B} and \ce{A <<=> B}
therefore render equilibrium arrows instead of undefined-command errors.
A fixed 56-case inline/display corpus compares complete original SVGs and 28
display measurements across the three arrows, top labels, sequences, scripts,
fonts, color, declared overrides and unchanged chemistry controls. Regenerate
it with node testdata/generate_mhchem_equilibrium.cjs PINNED_ASSETS.
The reversible double-arrow and partial-bond helpers are covered separately.
Mhchem's tripledash helper uses its original TeX macro definition, so all
five partial-bond forms (~, ~-, ~=, ~--, and -~-) render through
\ce{C\bond{~-}O} and the same spacing and positioning commands as the
original. Direct \tripledash use and declared macro overrides also work.
A fixed 304-case inline/display corpus compares complete original SVGs and
152 display measurements. It covers every partial-bond form in scripts,
fractions, size declarations, fonts, color, matrices, roots, and labeled
reversible reactions, plus direct macro use, argument boundaries, and
ordinary chemistry controls. Regenerate it with
node testdata/generate_mhchem_partial_bonds.cjs PINNED_ASSETS.
The ordinary \| command follows Braket's U+2225 handler before delimiter-symbol lookup, while explicit delimiter readers retain their own U+2016 aliases. Braket and Set retain caller-local separator ownership, group, script and left/right barriers, Set's one-stretchy-separator limit, and single-item completion. Fixed \set separators do not advance the limit. The capital Bra/Ket commands retain the original registered macro expansions, and user-defined macros retain precedence. The SVG output preserves the original braketbar attribute.
A finite 18-case inline/display corpus checks complete SVGs against D2's pinned MathJax 3.2.2: two retained ordinary-pipe outputs and sixteen newly captured Braket, Set, nesting, macro/Physics, literal-bar, explicit-delimiter and single-item controls. Twenty-one additional source-derived guards check caller argument consumption, owner masking/restoration, macro precedence, the retained ordinary token's compiled attributes, and single-item operator construction order. These tests do not claim general Braket or private-model conformance.
dd, differential, var and variation parse their operator, optional power
and raw operand together in the original child-parser scope. Registered
diffd/delta operators are honored, leading operand scripts attach to that
operator, and parenthesized operands use the existing deferred AutoOpen path.
Empty braced operands retain the original operator wrapper.
A fixed 72-case inline/display corpus compares complete original SVGs and 36
display measurements across aliases, orders, scripts, declared operators, fonts,
empty and unbraced operands, parentheses, and rendered errors. Six retained
Differential references now assert their untouched primary results. Regenerate
the new corpus with node testdata/generate_differential_construction.cjs PINNED_ASSETS.
Mathtools over/underbracket thickness uses the original length conversion for
physical, font-relative and percentage units. Complete original SVG cases and
reproduction instructions are in testdata/bracket_thickness_README.md.