Guide
Formulas
Formulas are written in LaTeX math and typeset by KaTeX, which follows TeX’s own layout rules and Computer Modern fonts — what you see while writing is what the compiled paper and the LaTeX export show.
The formula editor
Click any formula (or insert one) to open the formula editor. It has two modes, and you can switch at any time — your choice is remembered:
- Visual — edit the formula as it looks, without knowing LaTeX. Type
/for a fraction,^for a power,_for an index; type names such asalpha,sqrt,sum,intorinftyand they become symbols. Tab and the arrow keys move between the boxes of a fraction, root or matrix. On a tablet or phone an on-screen math keyboard appears; on a computer, the keyboard icon at the right of the field opens it. - Palette — buttons for everything you might not know the name of, grouped as Structures (fractions, roots, brackets, sums, integrals, limits, derivatives, accents), Matrices (matrices, vectors, determinants, cases), Greek, Operators, Relations, Sets & logic and Functions. A template fills in what you had selected and puts the cursor in the first empty box.
- LaTeX — the formula as LaTeX source, with a live preview, for when typing is faster.
In a display equation, + Line (or Shift + Enter) adds a line underneath; lines line up on their = signs. Enter or Done closes the editor. The visual editor is MathLive (MIT licence); like KaTeX it is part of this site, loaded the first time you open a formula.
Inline formulas
Type a formula between dollar signs; it is typeset when you type the closing $. Or press Ctrl/⌘ + M (or the Math button) and build it in the formula editor. Click any formula to change it.
A mass $m$ on a spring of stiffness $k$ oscillates at $\omega_0 = \sqrt{k/m}$, and the energy $E = \tfrac12 m\dot{x}^2 + \tfrac12 kx^2$ is conserved.To write a dollar sign in text, type it in the Write view (LabTeX stores it as \$), or write \$ in the source.
Display equations
Press the Equation button (∑) or Ctrl/⌘ + Shift + M, or type $$ and Enter on an empty line. Equations are numbered in order; untick Numbered for one without a number. Each new equation gets a label such as eq:3, which you can rename, so the text can refer to it with \eqref and the number stays right when equations move.
The motion obeys
\begin{equation}\label{eq:motion}
m\ddot{x} + c\dot{x} + kx = F_0 \cos(\omega t),
\end{equation}
and without forcing the solution of \eqref{eq:motion} decays:
\[
x(t) = A\, e^{-\zeta\omega_0 t}\cos(\omega_d t + \varphi).
\]Several lines
Inside an equation, \\ starts a new line and & marks the column the lines align on (usually just before the = sign). The block keeps one number, as with amsmath’s aligned. The align, gather and multline environments are understood too.
\begin{equation}\label{eq:amp}
\frac{Xk}{F_0} &= \frac{1}{\sqrt{(1-r^2)^2 + (2\zeta r)^2}}, \\
\tan\varphi &= \frac{2\zeta r}{1-r^2}, \qquad r = \frac{\omega}{\omega_0}.
\end{equation}\[
A = \begin{pmatrix} 0 & 1 \\ -\omega_0^2 & -2\zeta\omega_0 \end{pmatrix}, \qquad
|x| = \begin{cases} x & x \ge 0, \\ -x & x < 0. \end{cases}
\]Macros
Define your own commands under Document → Macros (or at the top of the source). They work in every formula and are copied into the LaTeX export.
\newcommand{\R}{\mathbb{R}}
\newcommand{\norm}[1]{\left\lVert #1 \right\rVert}
\DeclareMathOperator{\tr}{tr}
For $x \in \R^n$ and a matrix $A$: $\norm{Ax} \le \norm{A}\,\norm{x}$ and $\tr(A) = \sum_i a_{ii}$.Common notation
| What | Write |
|---|---|
| Fraction, root | \frac{a}{b} \sqrt{x} \sqrt[3]{x} |
| Sub- and superscripts | x_i x^2 x_{ij}^{(k)} |
| Greek | \alpha \beta \zeta \omega \Omega \varepsilon \varphi |
| Sums, integrals, limits | \sum_{i=1}^n \int_0^\infty \lim_{x\to 0} |
| Derivatives | \dot{x} \ddot{x} \partial \nabla \mathrm{d}x |
| Sets and number fields | \in \subset \cup \mathbb{R} \mathbb{C} |
| Relations and arrows | \le \ge \approx \equiv \to \Rightarrow |
| Vectors and accents | \vec{v} \hat{n} \bar{x} \mathbf{A} |
| Brackets that grow | \left( … \right) \left\lVert … \right\rVert |
| Text inside math | \text{ if } \quad \qquad |
KaTeX supports nearly all of LaTeX and amsmath; its list of supported functions has everything. A formula KaTeX cannot read is shown in red with the reason, both in the editor and on the pages.