# blocks/math

> Equations — LaTeX compiled to MathML that the browser renders itself: no JS renderer, no fonts.

Equations (F-34) — LaTeX compiled to MathML that the browser renders itself: no JS renderer, no fonts. Block mode is a void block edited in a popover with live preview (click it, or Enter when selected); inline mode is a `math` mark whose text is the source, shown rendered until the caret enters it. Unsupported commands show a visible error. Markdown: `$$…$$` and `$…$`.

```js
import math from 'verbal-editor/blocks/math';
```

| JS gzip | CSS gzip |
| --- | --- |
| 4.83 KB | 0.62 KB |

See it live on [Math](#/examples/math) — every example page on the landing is editable.

## Contract

|  |  |
| --- | --- |
| Block type | `math` |
| Content | no text of its own |
| Props | `latex: string` |
| Slash menu | `∑ Equation` |
| Keywords | `math` `latex` `formula` `tex` |
| Keys | `⏎` |
| Typing rules | `^\$\$\s$` |
| Pastes from | `Markdown` |
| Copies as | `Markdown` `HTML` |
| Contains | `math` |

## Acceptance

| Feature | Acceptance | Budget |
| --- | --- | --- |
| F-34 · LaTeX / equations | ~150 documented commands; inline and block modes; unsupported commands raise a visible explicit error | ≤ 5KB |

## API

### `commands`

Every supported command name, for documentation.

`#` `$` `%` `&` `Delta` `Gamma` `Im` `Lambda` `Leftarrow` `Leftrightarrow` `Omega` `Phi` `Pi` `Pr` `Psi` `Re` `Rightarrow` `Sigma` `Theta` `Upsilon` `Vert` `Xi` `_` `aleph` `alpha` `angle` `approx` `arccos` `arcsin` `arctan` `arg` `ast` `bar` `because` `begin` `beta` `bigcap` `bigcup` `bigoplus` `bigotimes` `bigvee` `bigwedge` `binom` `bmod` `boldsymbol` `breve` `bullet` `cap` `cdot` `cdots` `check` `chi` `circ` `colon` `cong` `coprod` `cos` `cosh` `cot` `csc` `cup` `ddot` `ddots` `deg` `degree` `delta` `det` `dfrac` `dim` `div` `dot` `dots` `downarrow` `ell` `emptyset` `end` `epsilon` `equiv` `eta` `exists` `exp` `forall` `frac` `gamma` `gcd` `ge` `geq` `gets` `gg` `hat` `hbar` `hom` `iff` `iiint` `iint` `imath` `implies` `in` `inf` `infty` `int` `iota` `jmath` `kappa` `ker` `lambda` `land` `langle` `lceil` `ldots` `le` `left` `leftarrow` `leftrightarrow` `leq` `lfloor` `lg` `lim` `liminf` `limsup` `ll` `ln` `lnot` `log` `longrightarrow` `lor` `lvert` `mapsto` `mathbb` `mathbf` `mathcal` `mathfrak` `mathit` `mathrm` `mathsf` `mathtt` `max` `mid` `middle` `min` `mp` `mu` `nabla` `ne` `neg` `neq` `nexists` `ni` `not` `notin` `nu` `odot` `oint` `omega` `ominus` `operatorname` `oplus` `otimes` `overline` `overset` `parallel` `partial` `perp` `phi` `pi` `pm` `pmod` `prime` `prod` `propto` `psi` `qquad` `quad` `rangle` `rceil` `rfloor` `rho` `right` `rightarrow` `rvert` `sec` `setminus` `sigma` `sim` `simeq` `sin` `sinh` `sqrt` `stackrel` `star` `subset` `subseteq` `sum` `sup` `supset` `supseteq` `tan` `tanh` `tau` `text` `tfrac` `therefore` `theta` `tilde` `times` `to` `triangle` `underset` `uparrow` `upsilon` `varepsilon` `varnothing` `varphi` `varpi` `varrho` `varsigma` `vartheta` `vdots` `vec` `vee` `vert` `wedge` `widehat` `widetilde` `wp` `xi` `zeta` `{` `|` `}`

### `latex(src, display)`

Compiles LaTeX to MathML.

| Parameter | Type | Description |
| --- | --- | --- |
| `src` | `string` | LaTeX source |
| `display?` | `boolean` | block (display) rather than inline math |

Returns `{ mathml: string, errors: string[] }`.
