Plugin · Learn

Math

Write TeX in a slide; get a sharp equation in the deck's colors.

Type $\pi r^2$ in a sentence, or a $$…$$ block on its own line, and Lattice typesets it with KaTeX the moment the deck renders. The PDF, the HTML export and the Studio all draw the same equation, in the slide's text color — and "$400M" in a revenue bullet stays plain text.

You write
$…$, $$…$$ or a ```math fence
Draws with
KaTeX 0.16 (MIT), bundled
Surfaces
Every one — drawn at render time
Loaded
By default

The problem

Equations in most slide tools are pictures: pasted from another app, blurry in the PDF, the wrong color on a dark slide, and impossible to edit without going back to wherever they came from.

A quant presenting a scoring model wants \hat\beta = (X^\top X)^{-1} X^\top y set properly, in the deck’s own colors, and editable in the same text as the bullets beside it. A teacher wants the same for a quadratic. Both want a currency figure in the next bullet left alone.

The idea

You write TeX, the notation mathematicians, scientists and engineers already use, and Lattice draws it.

  • Single dollars for inline math. $\pi r^2$ sits inside a sentence.
  • Double dollars for display math. A $$ … $$ block gets its own centered line. A ```math fence means the same thing — it’s the spelling GitHub and GitLab use, so math from a README or a notebook pastes in unchanged.
  • Money stays money. An opening $ can’t be followed by a space, and a closing $ can’t come after a space or right before a digit. So “Revenue hit $400M, ahead by $18M” stays plain text, and \$5 is always a literal dollar.
  • It draws as the deck renders. There’s no waiting for a browser script: every surface — the PDF, the HTML export, the Studio, the Playground — typesets the same equation from the same call.
  • The color is the slide’s. Equations take the slide’s text color, so they recolor with the theme, light or dark.

How to use it

Math is on in every deck, so you can write it straight away. Inline:

The area of a circle is $\pi r^2$.

On its own line:

$$
E = mc^2
$$

To make an equation the subject of a slide, use the math slide, which frames the equation and explains its terms:

<!-- _class: math -->

## The energy-mass equivalence.

$$
E = mc^2
$$

- `E` — energy (joules)
- `m` — mass (kilograms)
- `c` — the speed of light (m/s)

The math slide also has variants for a derivation, a theorem, two equations compared, a matrix, and an equation beside its plot (with the Function plots plugin).

If you get a formula wrong, you’ll see it: KaTeX shows the source in the theme’s warning color, and the rest of the deck renders normally.

Where else it fits

TeX is the shared language of math, physics, machine learning, statistics and finance. KaTeX, the library this plugin uses, is a fast TeX renderer used across documentation sites and note-taking tools. So the plugin suits anything that explains with formulas: research talks, lectures, model reviews, pricing logic, engineering design reviews.

How Lattice uses it

The math slide is designed around this plugin and loads it automatically. The syntax itself works on any slide: $$…$$ on an ordinary slide typesets exactly as it does on a math slide. HTML exports carry the KaTeX stylesheet and fonts inside the file, so a copy opened on another machine still typesets — and a deck with no math carries none of it.

What it doesn’t do

  • No \(…\) or \[…\] delimiters. Use $…$ and $$…$$.
  • KaTeX’s TeX, not all of LaTeX. You can’t load arbitrary LaTeX packages; KaTeX’s list of supported functions is linked below.
  • A typo ships visibly. A broken formula never breaks the deck, which also means you need to look before you present.
  • PowerPoint gets a picture. The PowerPoint export is an image per slide, so equations come through as pixels.