Skip to content

mathra 1.11.0

Choose a tag to compare

@matheusmota-dev-br matheusmota-dev-br released this 08 Nov 23:14
· 109 commits to main since this release
3c7dcd8

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 intent where the tree knows more than the drawing (pt-BR sen is sine), 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, --background and --color; the npm package leaves rasterizing to the browser (#113).
  • Long equations break into lines with --max-width, { maxWidth } or max_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, \ref and \cite with numbers you pass in, (??) and [?] without them, as LaTeX's first run (#126, #127).
  • Physics. \slashed for the Feynman slash, physics' matrices (\mqty, \pmqty, \paulimatrix…), spaced text (\qq, \qand…), the starred forms (\abs*, \dv*) and \sin[2](x); a bold \nabla under \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), \definecolor and xcolor mixes, MathJax's \bbox, \enclose and \class/\style, \vv and 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, \hole and 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 \text is 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 \ce go to the alignment around it (#267–#270).
  • Fixes. A chemfig label like Nu is kept whole, no longer read as N (#271); % starts a comment in strict mode; ^² reads as ^2; braces have a minimum width; \upvarrho is ϱ; \mathbf{1} is bold; \unicode{8918} is decimal; \not over 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 (\vertA was \vert A) (#209). A stray $, & or y__k now 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 and Options have 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

Bug fixes

Documentation

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