LaTeX Math
Write beautiful mathematical formulas using LaTeX syntax, rendered with KaTeX.
Inline Math
Use single $ for inline formulas:
The famous equation $E = mc^2$ changed physics.
The famous equation changed physics.
More examples:
- Area of circle:
- Pythagorean theorem:
- Quadratic formula:
Block Math
Use double $$ for centered, block-level formulas:
$$
\int_0^\infty e^{-x^2} dx = \frac{\sqrt{\pi}}{2}
$$
Basic Syntax
Superscripts and Subscripts
| Syntax | Result |
|---|---|
x^2 | |
x_i | |
x_i^2 | |
x^{10} |
Fractions
$$
\frac{a}{b} \quad \frac{1}{2} \quad \frac{x+1}{y-1}
$$
Square Roots
$$
\sqrt{2} \quad \sqrt{x+y} \quad \sqrt[3]{8}
$$
Greek Letters
| Letter | Syntax | Letter | Syntax |
|---|---|---|---|
\alpha | \beta | ||
\gamma | \delta | ||
\pi | \sigma | ||
\theta | \lambda | ||
\Omega | \Sigma |
Operators
Sums and Products
$$
\sum_{i=1}^{n} x_i \quad \prod_{i=1}^{n} x_i
$$
Integrals
$$
\int_a^b f(x)dx \quad \iint_D f(x,y)dxdy \quad \oint_C f(z)dz
$$
Limits
$$
\lim_{x \to \infty} \frac{1}{x} = 0
$$
Matrices
$$
\begin{pmatrix}
a & b \\
c & d
\end{pmatrix}
\quad
\begin{bmatrix}
1 & 2 & 3 \\
4 & 5 & 6
\end{bmatrix}
$$
Equations
Aligned Equations
$$
\begin{aligned}
(a+b)^2 &= a^2 + 2ab + b^2 \\
(a-b)^2 &= a^2 - 2ab + b^2
\end{aligned}
$$
Cases
$$
f(x) = \begin{cases}
x^2 & \text{if } x \geq 0 \\
-x^2 & \text{if } x < 0
\end{cases}
$$
Common Formulas
Statistics
Standard deviation:
Calculus
Taylor series:
Physics
Maxwell’s equations:
Tips
Best Practices
- Use inline math for simple formulas in text
- Use block math for complex or important equations
- Add spacing with
\quadbetween elements - Test rendering - KaTeX doesn’t support all LaTeX
Reference
Full KaTeX syntax: katex.org/docs/supported.html
Next: Video Embedding for multimedia content.