Repository navigation
mathra 1.11.0
·
109 commits
to main
since this release
MathML and PNG out, lines that break, a fallback font, and the commands physics and chemistry papers use, measured against 174,525 formulas of real LaTeX.
What changed
- New outputs. MathML Core next to the SVG, with
intentwhere the tree knows more than the drawing (pt-BRsenissine), read back by mathra to the same tree; what MathML cannot draw (chemfig, diagrams,\divchave) keeps its source in an annotation (#112). PNG from the terminal and Python, with--dpi,--backgroundand--color; the npm package leaves rasterizing to the browser (#113). - Long equations break into lines with
--max-width,{ maxWidth }ormax_width=: after a relation first, then after+and−, never inside a fraction or a root; the continuation starts under the right-hand side (#111). - A fallback font for what the math font lacks: emoji from Noto Emoji (in the terminal and Python), CJK or anything else from a font you give (#125).
- Reading. Content MathML from CAS and assessment tools (#114); words in mhchem as words,
\ce{sodium chloride -> sodium + chlorine}(#115);\eqref,\refand\citewith numbers you pass in,(??)and[?]without them, as LaTeX's first run (#126, #127). - Physics.
\slashedfor the Feynman slash, physics' matrices (\mqty,\pmqty,\paulimatrix…), spaced text (\qq,\qand…), the starred forms (\abs*,\dv*) and\sin[2](x); a bold\nablaunder\bm; 𝟙 for\mathds{1}; the rest of esint (\ointclockwise) and upgreek (#157–#159, #165–#168). - Packages. The rest of mathtools (
\splitfrac,\adjustlimits,psmallmatrix…), siunitx 3 (\complexqty,\DeclareSIUnit,\sisetup, constant units),\definecolorand xcolor mixes, MathJax's\bbox,\encloseand\class/\style,\vvand the accents packages, unicode-math's alphabets, textcomp, KaTeX's texvc aliases (\R,\Rarr), stmaryrd and mathabx (the symbols Unicode lacks are drawn from the font's own pieces),\vdotswithin,\stackbin,\overgroup,\shoveleft,\tablenum,\root…\of, the corner delimiters (#116–#124, #169–#177). - Chemistry and diagrams. chemfig's start options, distant bonds,
\charge,-U>,\chemleft, offset double bonds; xymatrix paths through entries,\holeand 2-cells (#210, #214, #215). - Real LaTeX. Measured on 174,525 formulas (the Stacks Project, 95 arXiv papers, the mhchem and chemfig manuals): a line break or tab is whitespace,
\before a line break is a control space, a line break in\textis a space, a measure mathra cannot read is a warning instead of a refusal, and the one crash, in a chemfig ring, is gone. Against 1.10.1, 535 more formulas convert with no warning and none is drawn worse (#206, #208–#213, #216). - mhchem. The bonds
\bond{~}(a dashed line, as mhchem draws it; it was ∼),\bond{~-},\bond{~=},\bond{-~-}and\bond{....}are drawn as mhchem draws them and read as what they are; an arrow label between braces is text (->[{text above}]);$…$in a subscript is math;&and\\inside\cego to the alignment around it (#267–#270). - Fixes. A chemfig label like
Nuis kept whole, no longer read as N (#271);%starts a comment in strict mode;^²reads as^2; braces have a minimum width;\upvarrhois ϱ;\mathbf{1}is bold;\unicode{8918}is decimal;\notover a long arrow is a short slash (#128–#132, #160–#164, #202–#205, #207). - What may change for you. An unknown command is drawn whole in red; it is no longer cut into a known one (
\vertAwas\vert A) (#209). A stray$,&ory__know warns, and strict mode refuses it (#129, #130).\color[rgb]{1,0,0}is red; it came out nearly black (#122). In Rust, the tree andOptionshave new variants and fields: code that matches them all or lists every field needs a new arm or..Default::default().
Equations, drawn live on the project's evolution: \mathcal{L} = -\frac{1}{4} F_{\mu\nu} F^{\mu\nu} + i \bar{\psi} \slashed{D} \psi + \left| D_\mu \phi \right|^2 - V(\phi) \sigma_x = \pmqty{0 & 1 \\ 1 & 0} \ce{Hydrogen + Oxygen -> Water} \llceil x \rrceil + \mathbf{1} \otimes \mathds{1}
Pull requests
Features
- feat: the enhancements of 2026-11-08 (#111–#125) by @matheusmota-dev-br in #151
- feat(mathml): read content MathML by @matheusmota-dev-br in #140
- feat(chem): mhchem text mode by @matheusmota-dev-br in #141
- feat(latex): \bbox and \enclose by @matheusmota-dev-br in #142
- feat(latex): \class, \style, \cssId and KaTeX's \html* attributes by @matheusmota-dev-br in #143
- feat(latex): \overgroup and \undergroup by @matheusmota-dev-br in #144
- feat(latex): \shoveleft and \shoveright in multline by @matheusmota-dev-br in #145
- feat(latex): \stackbin by @matheusmota-dev-br in #146
- feat(latex): \definecolor, \colorlet and xcolor mixes by @matheusmota-dev-br in #147
- feat(siunitx): \tablenum by @matheusmota-dev-br in #148
- feat(latex): \lightning, \Lightning, \mathbold and stmaryrd symbols by @matheusmota-dev-br in #149
- feat(latex): \vdotswithin and \shortvdotswithin by @matheusmota-dev-br in #150
- feat(core): PNG output by @matheusmota-dev-br in #152
- feat(core): automatic line breaking by @matheusmota-dev-br in #153
- feat(core): fallback fonts for characters the math font lacks by @matheusmota-dev-br in #154
- feat(core): MathML output by @matheusmota-dev-br in #155
- feat: the second round of enhancements of 2026-11-08 (#165–#177) by @matheusmota-dev-br in #200
- feat(latex): \slashed, the Feynman slash notation by @matheusmota-dev-br in #187
- feat(latex): physics' matrices, spaced text and remaining aliases by @matheusmota-dev-br in #188
- feat(latex): the rest of esint (\ointclockwise, \varointctrclockwise, \dotsint) by @matheusmota-dev-br in #189
- feat(latex): upgreek's uppercase and var letters by @matheusmota-dev-br in #190
- feat(latex): the remaining mathtools commands and environments by @matheusmota-dev-br in #191
- feat(latex): \root…\of, \leftroot, \atopwithdelims and corner delimiters by @matheusmota-dev-br in #192
- feat(latex): \vv, \accentset, \underaccent and mathabx accents by @matheusmota-dev-br in #193
- feat(latex): KaTeX's texvc aliases (\R, \N, \Rarr, \hearts…) by @matheusmota-dev-br in #194
- feat(latex): unicode-math alphabets (\mathbfcal, \symcal…) by @matheusmota-dev-br in #195
- feat(latex): textcomp and gensymb symbols (\perthousand, \textcelsius…) by @matheusmota-dev-br in #196
- feat(siunitx): \complexnum, \complexqty, constant units, \DeclareSIUnit and \sisetup by @matheusmota-dev-br in #197
- feat(latex): the rest of stmaryrd and mathabx that Unicode has by @matheusmota-dev-br in #198
- feat(latex): smaller missing commands (\Ketbra, archaic Greek, colortbl…) by @matheusmota-dev-br in #199
- feat(latex): stmaryrd and mathabx symbols drawn by composition by @matheusmota-dev-br in #201
- feat: chemfig, xymatrix and plain TeX found by measuring real LaTeX (#214–#216) by @matheusmota-dev-br in #228
- feat(chem): chemfig defaults, \charge, -U>, \chemleft and kin by @matheusmota-dev-br in #225
- feat(latex): xymatrix paths through entries, \hole and 2-cells by @matheusmota-dev-br in #226
- feat(latex): \sevenrm, the size environments in math, \yng out of scope by @matheusmota-dev-br in #227
- feat(site): the playground and gallery show what main gained (#237–#241) by @matheusmota-dev-br in #247
- feat(site): a MathML tab in the playground by @matheusmota-dev-br in #242
- feat(site): a max width control in the playground by @matheusmota-dev-br in #243
- feat(site): Download PNG in the playground by @matheusmota-dev-br in #244
- feat(site): Noto Emoji on demand in the playground by @matheusmota-dev-br in #245
- feat(site): gallery examples for what main gained since 1.10.1 by @matheusmota-dev-br in #246
- feat(site): many more gallery examples, and rows that carry options by @matheusmota-dev-br in #249
- feat(latex): xymatrix \ar@(d1,d2) curves and loops by @matheusmota-dev-br in #265
- feat(chem): chemfig \merge, named compounds and branching arrows by @matheusmota-dev-br in #266
Bug fixes
- fix: the six bugs of 2026-11-08 (#126, #128–#132) by @matheusmota-dev-br in #139
- fix(latex): % starts a comment in strict mode by @matheusmota-dev-br in #133
- fix(latex): warn on a stray $ and on y__k, refuse them in strict mode by @matheusmota-dev-br in #134
- fix(latex): & outside an alignment and extra array cells are E-REC-9 by @matheusmota-dev-br in #135
- fix(latex): read a Unicode script character after ^ or _ as plain by @matheusmota-dev-br in #136
- fix(latex): \eqref, \ref and \cite show numbers, not keys by @matheusmota-dev-br in #137
- fix(layout): braces and brackets have a minimum width by @matheusmota-dev-br in #138
- fix(cli): a test that writes stdin to a command that exits first by @matheusmota-dev-br in #156
- fix: the second round of bugs of 2026-11-08 (#157–#164) by @matheusmota-dev-br in #186
- fix(latex): physics' starred and optional forms (\abs*, \dv*, \sin[2]) by @matheusmota-dev-br in #178
- fix(latex): \bm and \boldsymbol make ∇ bold by @matheusmota-dev-br in #179
- fix(latex): \mathds{1}, \mathbbm{1} and \mathbb{1} draw the double-struck one 𝟙 by @matheusmota-dev-br in #180
- fix(latex): cases* reads its second column as text; smallmatrix* takes its [r] by @matheusmota-dev-br in #181
- fix(siunitx): \raiseto raises the next unit; an uncertainty is a number by @matheusmota-dev-br in #182
- fix(chem): \pu{… // …} draws a fraction by @matheusmota-dev-br in #183
- fix(latex): the E-REC-2 JSON rule no longer fires on unknown commands starting with n, r or t by @matheusmota-dev-br in #184
- fix(latex): text dashes, \cfrac[l], \unicode[font] and the \centernot slash by @matheusmota-dev-br in #185
- fix: the third round of 2026-11-08 (#202–#207) by @matheusmota-dev-br in #224
- fix(latex): \upvarrho and \upvarsigma draw ϱ and ς by @matheusmota-dev-br in #217
- fix(latex): bold, sans-serif and typewriter digits take their alphabet by @matheusmota-dev-br in #218
- fix(latex): \unicode reads a bare number as decimal, as MathJax by @matheusmota-dev-br in #219
- fix(layout): \not before a long arrow slashes its start by @matheusmota-dev-br in #220
- fix(latex): \thinmuskip, \medmuskip and \thickmuskip are measures by @matheusmota-dev-br in #221
- fix(core): the tree's JSON names composite symbols by their command by @matheusmota-dev-br in #222
- fix: regressions and gaps found by measuring real LaTeX (#208–#213) by @matheusmota-dev-br in #235
- fix(latex): a real line break or tab is whitespace, not a lost JSON backslash by @matheusmota-dev-br in #229
- fix(latex): an unknown command is drawn whole, never cut into a known one by @matheusmota-dev-br in #230
- fix(chem): chemfig's offset double bonds, and no panic on a stray ')' by @matheusmota-dev-br in #231
- fix(latex): a backslash before a line break or a tab is a control space by @matheusmota-dev-br in #232
- fix(latex): a line break or a tab inside text is a space by @matheusmota-dev-br in #233
- fix(latex): text accents on letters in math, and box dimensions as measures by @matheusmota-dev-br in #234
- fix: six fixes from the gallery and the second coverage report (#250–#255) by @matheusmota-dev-br in #264
- fix(latex): \implies, \impliedby and \iff are amsmath's spaced long arrows by @matheusmota-dev-br in #258
- fix(layout): a relation after an \Aboxed box gets its thick space by @matheusmota-dev-br in #259
- fix(chem): read the commands in an mhchem isotope superscript by @matheusmota-dev-br in #260
- fix(latex): a line break is read as a lost JSON backslash only with another sign of JSON by @matheusmota-dev-br in #261
- fix(latex): a control space at the end of the formula is a space by @matheusmota-dev-br in #262
- fix(latex): read \nobreak and \allowbreak with no warning by @matheusmota-dev-br in #263
- fix(chem): mhchem bonds, braced arrow labels,
$…$ in scripts, & and \ in \ce (#267–#270) by @matheusmota-dev-br in #272
Documentation
- docs(braille): list the symbols written as the full cell for a transcriber by @matheusmota-dev-br in #223
- docs(changelog): what main has since 1.10.1, as the Unreleased section by @matheusmota-dev-br in #236
Install
| Package | Command | |
|---|---|---|
| Rust | mathra |
cargo add mathra@1.11.0 |
| CLI | mathra-cli |
cargo install mathra-cli@1.11.0 |
| npm | @mathlabs/mathra |
npm install @mathlabs/mathra@1.11.0 |
| Python | mathra |
pip install mathra==1.11.0 |
Full changelog: v1.10.1...v1.11.0