Skip to content

mathra 1.12.0

Latest

Choose a tag to compare

@matheusmota-dev-br matheusmota-dev-br released this 10 Nov 16:31
· 30 commits to main since this release
48a3696

Where each marked piece is drawn, chemistry included: what a visual editor needs. And what the measured formulas still asked for: commands inside real formulas, and chemfig as its manual writes it.

What changed

  • Inside real formulas. \setlength{\arraycolsep}{…} spaces the columns of the arrays and matrices after it; \lefteqn overlaps to the right in display style, as in eqnarray; \linebreak[n] is a break hint, as \allowbreak, and amsthm's \qedhere draws nothing, since an equation converted alone is not a proof. Measured on the 174,525 formulas: 39 more convert with no warning (the Stacks Project's \linebreak[0], arXiv's \qedhere and \arraycolsep), and none is drawn worse.
  • chemfig as its manual writes it. A branch may start with defaults of its own, B([:60]-D-E), ([::-30,1.5]-X-Y), valid in all of it; -#(d1,d2) (or \#, \CFhash) sets the space a bond leaves before the letters; **[30,330]5(…) draws the aromatic circle as an arc, dashed when its TikZ options say so. 17 more examples of the chemfig manual convert with no warning, and none is drawn worse.
  • Mechanisms and submolecules. A curved arrow of \chemmove can point at a bond, -[@{db,0.5}::30], and is read as the bond between its atoms; \definesubmol (with arguments and the dual [code1]{code2}) and !{name}; \arrow(--name[yshift=5mm]) moves the compound it brings. An unknown !{name} is drawn as written, as before, now with a warning that its definition is missing.
  • The rest of the measured formulas. \noalign{\vspace{…}} and \vspace inside a formula are read as the [length] of \\ is, and \noalign{\hrule} is a rule; a \chemname breaks into lines at \\; \chemleft{[} takes its delimiter between braces; an arrow can leave a \subscheme's box; a \+ right after an arrow is drawn (it was left out); a \chemmove point may carry its own move, ([yshift=7pt]b1.180). What the 174,505 measured formulas still flag, 202 of them, is listed with the reason for each in tools/coverage/REMAINING.md.
  • Marks inside chemistry. In \ce, a mark around a piece (a species, its coefficient, formula or state, an arrow with its conditions) is read through: the piece is read as chemistry and the mark goes around it. In \chemfig, a mark around an atom's label is kept on the atom (bonds still reach the same letter), and a mark on a vertex without a label gives its point. Either way the drawing is the one without the marks, and boxes says where each piece is: what lets an editor edit reactions and structures piece by piece. In a scheme, a mark around an arrow's label keeps its text as text.
  • Where a structure's atoms and bonds are written. In the tree, each chemfig atom and bond has a span: the characters of the structure's code it is written in (none after a submolecule rewrote the code). An editor changes one atom or bond in place with it.
  • Where each marked piece sits. render returns boxes: for each group marked with \htmlData, \htmlId or \class, the box its content was set in, in the SVG's coordinates (left, top, width, height, baseline and nesting level). What a visual editor needs to place its cursor and read clicks over the SVG; marking draws exactly what the bare formula draws, as long as a marked operator keeps its class with \mathrel{…}, \mathbin{…} (a group alone is an ordinary atom, as in TeX). In Rust, Output::boxes and Item::Group's bounds, a change to the public API.
  • & in a one-column environment. \begin{gather}a&b\end{gather}, and the same in gather*, gathered, multline and multline*, is refused in strict mode, as amsmath stops on it ("Misplaced alignment tab character &"); tolerant mode warns (E-REC-9) and joins the cells into the line, which multline then aligns as any other (#288). None of the 174,505 measured formulas changes.
  • Nemeth braille. A numeric subscript of a unit's letter takes no subscript indicator, as of any letter (§14.6): \si{m}_1 is ⠍⠂, as m_1; it was ⠍⠰⠂ (#287).
  • Nemeth braille. \overleftarrow, \overleftrightarrow and their \under… forms are written as modified expressions with the arrow's full sign, ⠐⠭⠣⠫⠪⠒⠒⠻ (§22); they were the letter and ⠿ (#286).
  • CMU braille. An expression already in ( ), [ ] or { } written with plain signs no longer takes the auxiliary parentheses ⠢…⠔ as a radicand, numerator, denominator, exponent or index: \sqrt{(a+b)} is ⠫⠱⠣⠁⠖⠃⠜, as \left(…\right) already was (§1.3); \sqrt{(a)+(b)}, two terms, keeps them (#285).
  • Fixes. A tikz-cd arrow with from= starts at that cell and ends at the current one, unless to= or a direction names the end, which count from the current cell as in tikz-cd: A & B \arrow[from=1-1] and \arrow[from=1-1, to=1-2] are an arrow from A to B (they were left out, as an arrow without a direction or to itself) (#284).
  • MathML. An mlabeledtr whose only cell is its label keeps the label, alone in its row; it was dropped, leaving an empty row (#283).
  • Fixes. In AsciiMath, a closing bracket where an argument or a script is expected (sqrt), x^), frac(a))) leaves it empty, with a warning (E-REC-7, as a missing argument in LaTeX), and strict mode refuses it; it made the reader panic (#282).

Equations, drawn live on the project's evolution: \setlength{\arraycolsep}{2pt} \left[ \begin{array}{c|ccc} 0 & 1 & 1 & 2 \\ \hline 1 & 0 & 2 & 1 \end{array} \right] \chemfig{A-B([1]-X([4]-Z)-Y)(-[7]D)-C} \quad \chemfig{**[30,330]5(-----)} \htmlData{m=1}{x} \mathrel{\htmlData{m=2}{=}} \htmlData{m=3}{\frac{\htmlData{m=4}{a}}{\htmlData{m=5}{b}}}

Pull requests

Features

  • feat(chem): chemfig branches with their own defaults, #(d1,d2) bond spacing and aromatic arcs by @matheusmota-dev-br in #276
  • feat(chem): mechanism arrows to bonds, \definesubmol and compounds moved by their style by @matheusmota-dev-br in #277
  • feat(tools): the coverage pipeline over real LaTeX, and an extraction that takes formulas only by @matheusmota-dev-br in #278
  • feat(editor): @mathlabs/mathra-editor, a formula editor drawn by mathra by @matheusmota-dev-br in #280
  • feat(editor): typing as on a calculator, matrices sized on a grid, chemistry written as math by @matheusmota-dev-br in #298

Bug fixes

Documentation

  • docs: the reference, the docs page and the README with what 1.11.0 brought, and text_kerning by @matheusmota-dev-br in #274
  • docs: accessibility statement, issue templates and a pull request template by @matheusmota-dev-br in #297

Maintenance

Install

Package Command
Rust mathra cargo add mathra@1.12.0
CLI mathra-cli cargo install mathra-cli@1.12.0
npm @mathlabs/mathra npm install @mathlabs/mathra@1.12.0
Python mathra pip install mathra==1.12.0

Full changelog: v1.11.0...v1.12.0