Math
Math
Tachyonn renders LaTeX with KaTeX, bundled into the app. No internet, no
LaTeX installation, no build step — formulas appear as fast as the rest of the
slide.
The +[…] operator
One operator covers both cases. By default it's inline; a <b> modifier
promotes it to a display (block) formula on its own line.
| Form | Syntax | LaTeX equivalent |
|---|---|---|
| Inline (default) | +[x^2 + y^2] | $x^2 + y^2$ |
| Display / block | +[<b> \int_0^1 f(x)\,dx] | $$\int_0^1 f(x)\,dx$$ |
<block> is a synonym for <b>.
## Gaussian integral
The integrand +[e^{-x^2}] has no elementary antiderivative, yet:
+[<b> \int_{-\infty}^{\infty} e^{-x^2}\,dx = \sqrt{\pi}]Brackets inside the formula
The content between +[ and ] is literal TeX — no escaping, no
Markdown interference. Brackets are matched as pairs, so TeX that contains its
own […] works unchanged:
+[\sqrt[3]{x}]
+[\binom{n}{k} = \frac{n!}{k!\,(n-k)!}]Because the content is literal, a backslash is a backslash and an underscore is
an underscore — +[a_1 + a_2] is a formula, not italics.
Global macros: texMacro:
Retyping \mathbb{R} forty times is how notation errors get in. Define the
shorthand once in the frontmatter and use it everywhere in the deck:
===
title: Linear algebra
texMacro: \newcommand{\R}{\mathbb{R}}
texMacro: \newcommand{\vv}[1]{\mathbf{#1}}
texMacro: \norm \left\lVert #1 \right\rVert
===
Every +[\vv{x} \in \R^n] has a norm +[\norm{\vv{x}}].The key is repeatable — one macro per line, as many lines as you need. These
forms are accepted:
| Form | Example |
|---|---|
\newcommand | \newcommand{\R}{\mathbb{R}} |
\newcommand with arity | \newcommand{\vv}[1]{\mathbf{#1}} |
\def | \def\R{\mathbb{R}} |
| Short form | \half \frac{1}{2} |
The [n] arity is optional — KaTeX infers it from the highest #n in the body.
If a macro references #2 without ever using #1, Tachyonn prints a friendly
warning at compile time rather than leaving you with a silently broken formula.
Macros from a theme
texMacro: also works inside a .tt theme file,
so a notation pack can travel with a visual identity. The built-in physics
theme ships one (\ket, \bra, \pdv, \R, \norm, …):
===
title: Quantum mechanics I
theme: physics
===
The state +[\ket{\psi}] evolves under +[\ii\hbar\,\pdv{\ket{\psi}}{t}].It covers the usual suspects: number sets (\R, \C, \Z…), vectors and
operators (\vb, \uv, \op), vector calculus (\grad, \divg, \curl,\lap), Dirac notation (\ket, \bra, \braket, \expval), derivatives
(\dv, \pdv, \dd), and units (\unit, \qty, \kB).
A deck's own texMacro: wins over the theme's when the two define the same
name — so you can adopt a pack and still override one symbol you disagree with.
Where math can go
Anywhere text goes: paragraphs, list items, table cells, callout bodies, slide
titles, the cover body, and the footer. A formula in a heading inherits the
heading's colour and size.
Keep display math for the punchline
Inline math keeps the sentence readable; display math says look at this one.
A slide with six display formulas has no punchline. If you need six, they
probably want to be one derivation revealed with
clicks.