LaTeX is the undisputed king of mathematical typesetting. Beyond simple variables, you can handle multi-line derivations and complex structures with ease.
Level 1: Alignment & Multi-line
The align environment (from amsmath) allows you to align equations at the equals sign using &.
Source Code
Example OutputStatic
\begin{align}
(a+b)^2 &= a^2 + 2ab + b^2 \\
(a-b)^2 &= a^2 - 2ab + b^2
\end{align}
(a+b)²=a² + 2ab + b²
(a-b)²=a² - 2ab + b²
Level 2: Matrices & Cases
Represent data structures and piecewise functions using environments like pmatrix and cases.
Source Code
Example OutputStatic
% A Matrix
\[
A = \begin{pmatrix}
1 & 0 \\
0 & 1
\end{pmatrix}
\]
% A Piecewise Function
\[
|x| = \begin{cases}
x & \text{if } x \ge 0 \\
-x & \text{if } x < 0
\end{cases}
\]
A =
1001
|x| = {
x if x ≥ 0
-x if x < 0
Level 3: Theorems & Proofs
Load amsthm to define professional theorem environments.
Source Code
Example OutputStatic
\newtheorem{theorem}{Theorem}
\begin{theorem}[Pythagoras]
The square of the hypotenuse is equal to the sum of the squares of the legs.
\end{theorem}
\begin{proof}
By construction...
\end{proof}
Theorem 1 (Pythagoras).The square of the hypotenuse is equal to the sum of the squares of the legs.
Proof.By construction... □