LaTeX Math in Markdown: Fractions, Roots, Greek Letters and Matrices

The most widely supported way to write math in Markdown is LaTeX syntax. Moread typesets equations with KaTeX, which is fast and sharp, making it a good fit for lecture notes, homework, paper drafts and technical documentation.

Inline and display math

Inline math goes between single dollar signs and flows with the text:

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

Display math goes between double dollar signs and is centered on its own line:

$$
E = mc^2
$$

You can also use \( ... \) for inline math, \[ ... \] for display math, or a code block with the language math.

Superscripts and subscripts

Result Syntax
x2x^2 x^2
aia_i a_i
x10x^{10} x^{10}
ai,ja_{i,j} a_{i,j}

Use braces {} when the exponent or index has more than one character.

Fractions and roots

$\frac{a}{b}$   $\sqrt{2}$   $\sqrt[3]{x}$

The quadratic formula:

x=−b±b2−4ac2ax = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}

Greek letters

Symbol Syntax Symbol Syntax
α\alpha \alpha β\beta \beta
γ\gamma \gamma Δ\Delta \Delta
θ\theta \theta λ\lambda \lambda
μ\mu \mu π\pi \pi
σ\sigma \sigma Ω\Omega \Omega

Capitalize the first letter of the command for uppercase, e.g. \Delta.

Sums, integrals and limits

$$\sum_{i=1}^{n} x_i \qquad \int_0^1 x^2\,dx \qquad \lim_{x \to 0} \frac{\sin x}{x}$$
xˉ=1n∑i=1nxi\bar{x} = \frac{1}{n}\sum_{i=1}^{n} x_i

Matrices and aligned equations

$$
\begin{bmatrix} 1 & 2 \\ 3 & 4 \end{bmatrix}
$$

& separates columns and \\ starts a new row. Use pmatrix for parentheses and vmatrix for determinant bars.

For multi-line derivations, use aligned and align on &:

(a+b)2=(a+b)(a+b)=a2+2ab+b2\begin{aligned} (a+b)^2 &= (a+b)(a+b) \\ &= a^2 + 2ab + b^2 \end{aligned}

Symbol cheat sheet

Symbol Syntax Symbol Syntax
×\times \times ÷\div \div
≤\leq \leq ≥\geq \geq
≠\neq \neq ≈\approx \approx
∞\infty \infty →\rightarrow \rightarrow
∈\in \in ⊆\subseteq \subseteq
∀\forall \forall ∃\exists \exists

Common problems

  • The formula isn't rendered: make sure your $ signs come in pairs and that the opening $ isn't followed by a space.
  • Prices turn into math: escape the dollar sign as \$100.
  • A formula shows an error: Moread marks it, keeps the source, and shows the reason when you hover over it.

When you're ready, drop your .md file into Moread to see the typeset equations, or save the document as a PDF.