LaTeX equations and matrices: a practical guide
Published by InstantToolDeck · Updated November 2026
LaTeX is the standard for typesetting maths. This guide covers the commands you will use most and how to preview them quickly with the LaTeX Equation Editor.
Inline and display math
- Inline:
$E = mc^2$sits inside a line of text. - Display:
\[ E = mc^2 \](or$$ … $$) is centred on its own line. - Numbered: the
equationenvironment adds an equation number.
Essential commands
| Result | LaTeX |
|---|---|
| Fraction | \frac{a}{b} |
| Power, subscript | x^{2}, x_{i} |
| Square root | \sqrt{x} |
| Sum | \sum_{i=1}^{n} i |
| Integral | \int_0^1 x^2\,dx |
| Limit | \lim_{x\to\infty} |
| Greek letters | \alpha, \beta, \pi |
Need a symbol? Use the symbols to LaTeX converter or the symbols cheat sheet.
Aligned multi-line equations
\begin{align}
a &= b + c \\
d &= e + f
\end{align}
The & marks where lines align, usually just before the equals sign. align needs the amsmath package.
Matrices
\begin{pmatrix}
1 & 2 \\
3 & 4
\end{pmatrix}
Use pmatrix for round brackets, bmatrix for square brackets and vmatrix for determinants. Build them from pasted numbers with the LaTeX Matrix Generator.
Common errors
- Missing brace: every
{needs a}. - Text in math mode: use
\text{...}for words so letters are not italic. - Undefined control sequence: a command needs a package, usually
amsmathoramssymb. - Forgotten backslashes before
\\line breaks inside environments.
Previewing without compiling
The editor uses KaTeX, which covers most everyday commands. It is not a full LaTeX engine, so custom macros and packages such as TikZ are not available in the preview.
Frequently asked questions
How do I write a fraction in LaTeX?
Use \frac{numerator}{denominator}, for example \frac{1}{2}.
What is the difference between $...$ and \[...\]?
Single dollars make inline math inside a sentence. \[...\] creates a centred display equation.
Which package do I need for matrices?
amsmath provides pmatrix, bmatrix, vmatrix and the align environment.
Why does my equation work here but not in my document?
Your document may be missing a package or use a command KaTeX handles differently. Check the compiler error message.