KaTeX Math
Write mathematical equations using LaTeX syntax. Papersmith renders math via KaTeX — no installation or plugins required.
$...$ syntax in the preview. Upgrade to Pro to render equations.markdown-it-texmath plugin. If a formula contains an error, it renders in red with a description rather than breaking the document.Inline vs. Display Math#
Use dollar sign delimiters to write math. Single dollars for inline math (flows within text), double dollars for display math (centered on its own line).
| LaTeX | Rendered |
|---|---|
| $x^2 + y^2 = r^2$ | Inline — flows within the paragraph |
| $$\int_0^\infty e^{-x}\,dx = 1$$ | Display — centered on its own line |
| $E = mc^2$ | |
| $$\sum_{n=1}^{\infty} \frac{1}{n^2} = \frac{\pi^2}{6}$$ | Display mode — ideal for important equations |
$$...$$) for equations you want to stand out. Use inline mode ($...$) for variables and short expressions within a sentence.Greek Letters#
All standard Greek letters are supported. Use a backslash followed by the letter name.
Lowercase
Uppercase
Variants
Operators#
Binary operators for arithmetic, algebra, and set operations.
Relations & Arrows#
Relations
Arrows
Fractions & Roots#
| LaTeX | Rendered |
|---|---|
| \frac{a}{b} | Standard fraction — scales with context |
| \dfrac{a}{b} | Display-style fraction — always full size |
| \tfrac{a}{b} | Text-style fraction — always compact |
| \cfrac{a}{b} | Continued fraction style |
| \binom{n}{k} | Binomial coefficient "n choose k" |
| \sqrt{x} | Square root |
| \sqrt[3]{x} | Nth root (cube root shown) |
\dfrac inside inline math ($...$) when you want a full-size fraction that doesn't shrink. Use \tfrac inside display math to keep a fraction compact.Sums, Integrals & Limits#
Limits, subscripts, and superscripts on large operators are placed below/above in display mode and inline in text mode.
| LaTeX | Rendered |
|---|---|
| \sum_{i=0}^{n} i | |
| \prod_{i=1}^{n} i | |
| \int_a^b f(x)\,dx | |
| \iint_D f\,dA | |
| \oint_C F\,ds | |
| \lim_{x \to 0} f(x) | |
| \max_{x \in S} f(x) | |
| \inf_{n} a_n |
Logic & Set Theory#
Brackets & Delimiters#
Use \left and \right to make brackets automatically resize to match the height of their contents.
| LaTeX | Rendered |
|---|---|
| \left( \frac{a}{b} \right) | Auto-sizing parentheses |
| \left[ \frac{a}{b} \right] | Auto-sizing square brackets |
| \left\{ \frac{a}{b} \right\} | Auto-sizing curly braces |
| \langle x, y \rangle | Angle brackets |
| \lfloor x \rfloor | Floor function |
| \lceil x \rceil | Ceiling function |
| \left| x \right| | Absolute value |
| \left\| \vec{v} \right\| | Norm |
Accents & Decorators#
| LaTeX | Rendered |
|---|---|
| \hat{x} | Hat / caret |
| \bar{x} | Bar (mean) |
| \vec{x} | Vector arrow |
| \tilde{x} | Tilde |
| \dot{x} | Single dot (derivative) |
| \ddot{x} | Double dot (2nd derivative) |
| \acute{x} | Acute accent |
| \grave{x} | Grave accent |
| \breve{x} | Breve |
| \check{x} | Check / háček |
| \widehat{xy} | Wide hat (spans multiple chars) |
| \overline{AB} | Overline |
| \underline{AB} | Underline |
| \overbrace{a+b+c}^{n} | Overbrace with label |
| \underbrace{a+b}_{\text{sum}} | Underbrace with label |
Matrices & Arrays#
Matrix environments must be used inside math delimiters. The columns are separated by & and rows by \\.
| LaTeX | Rendered |
|---|---|
| \begin{pmatrix} a & b \\ c & d \end{pmatrix} | pmatrix — round parentheses |
| \begin{bmatrix} a & b \\ c & d \end{bmatrix} | bmatrix — square brackets |
| \begin{vmatrix} a & b \\ c & d \end{vmatrix} | vmatrix — vertical bars (determinant) |
| \begin{cases} x+y & \text{if } x > 0 \\ x-y & \text{otherwise} \end{cases} | cases — piecewise function |
Use these as the content inside $$...$$ delimiters for best results. For example:
$$
\begin{pmatrix}
a_{11} & a_{12} & a_{13} \\
a_{21} & a_{22} & a_{23} \\
a_{31} & a_{32} & a_{33}
\end{pmatrix}
$$Text & Font Styles#
| LaTeX | Rendered |
|---|---|
| \text{plain text} | Roman text inside math (use for labels) |
| \mathbb{R} | Blackboard bold — number sets (ℝ, ℂ, ℤ, ℕ, ℚ) |
| \mathcal{L} | Calligraphic — Lagrangian, transforms |
| \mathbf{x} | Bold (vectors and matrices) |
| \mathit{x} | Italic (default for variables) |
| \mathrm{d} | Roman (upright) — use for differential d |
| \mathsf{A} | Sans-serif |
| \mathtt{A} | Typewriter / monospace |
| \boldsymbol{\alpha} | Bold Greek letters |
\mathbb{R} for the set of real numbers, \mathbb{Z} for integers, \mathbb{C} for complex numbers, and \mathbb{N} for natural numbers.Multi-line Equations#
Use the aligned or align environment to typeset equations that span multiple lines, aligned on the = sign.
aligned environment#
Use aligned inside $$...$$. Align columns with & and break lines with \\.
$$
\begin{aligned}
f(x) &= x^2 + 2x + 1 \\
&= (x + 1)^2
\end{aligned}
$$Piecewise functions#
$$
f(x) = \begin{cases}
x^2 & \text{if } x \geq 0 \\
-x^2 & \text{if } x < 0
\end{cases}
$$Spacing in equations#
Control horizontal spacing between elements using these spacing commands:
| LaTeX | Rendered |
|---|---|
| a\,b | Thin space (3/18 em) |
| a\;b | Thick space (5/18 em) |
| a\quad b | 1 em space |
| a\qquad b | 2 em space |
| a\!b | Negative thin space (tighten) |
PDF Export Notes#
KaTeX renders to HTML/CSS (not images or SVG), so math renders with the same quality in the exported PDF as in the live preview.
- Errors render gracefully — invalid KaTeX shows in red with a description rather than crashing the export.
- Fonts are embedded — the KaTeX fonts are included in the PDF, so math looks correct on any device.
- Large matrices at narrow page widths — a wide matrix in a document with small margins may overflow. Use the
smallmatrixenvironment or increase margins in the toolbar. - Display math near page breaks — a large display equation that falls near the bottom of a page may be split. Add
<!-- pagebreak -->on its own line before it to force it onto the next page (Pro feature).