Introduction
LaTeX’s mathematical typesetting capabilities are unmatched, making it the standard for academic and scientific documents. From simple inline equations to complex multi-line displays with automated numbering, LaTeX handles mathematical notation with typographic excellence.
This guide covers everything needed to typeset professional mathematical documents, from basic equation syntax to advanced theorem environments.
Inline and Display Equations
Inline Mathematics
The equation $E = mc^2$ defines mass-energy equivalence.
For small values, use $\epsilon \approx 0$.
The sum $\sum_{i=1}^{n} i = n(n+1)/2$ is well-known.
Display Equations
% Centered, unnumbered
\[
\int_0^\infty e^{-x^2} dx = \frac{\sqrt{\pi}}{2}
\]
% Numbered equation
\begin{equation}
f(x) = \lim_{h \to 0} \frac{f(x+h) - f(x)}{h}
\end{equation}
% Equation with tag
\begin{equation*}
\lim_{x \to \infty} \frac{1}{x} = 0
\end{equation*}
Basic Mathematical Structures
Fractions
% Inline fraction
$\frac{a}{b}$
% Display fraction
\[\frac{a}{b}\]
% Nested fractions
\[\frac{\frac{a}{b}}{\frac{c}{d}} = \frac{ad}{bc}\]
% Continued fraction
\[
x = a_0 + \cfrac{1}{a_1 + \cfrac{1}{a_2 + \cfrac{1}{a_3}}}
\]
Roots
$\sqrt{x}$
$\sqrt[3]{x}$
$\sqrt{x^2 + y^2}$
$\sqrt{1 + \sqrt{2}}$
Superscripts and Subscripts
$x^2$
$x^{n+1}$
$x_i$
$x_{i,j}$
${x_i}^n$ vs $x_i^n$ % Different placement
Multi-line Equations
align Environment
\usepackage{amsmath}
\begin{align}
x + y &= 5 \\
2x + y &= 7
\end{align}
% With numbering
\begin{align}
x + y &= 5 \\
2x + y &= 7
\end{align}
% No numbering
\begin{align*}
x + y &= 5 \\
2x + y &= 7
\end{align*}
gather for Multiple Equations
\begin{gather}
f(x) = x^2 \\
g(x) = \sin(x) \\
h(x) = e^x
\end{gather}
Split for Sub-numbering
\begin{equation}
\begin{split}
(a+b)^2 &= a^2 + 2ab + b^2 \\
&= a^2 + b^2 + 2ab
\end{split}
\end{equation}
Cases
\[
f(x) =
\begin{cases}
x^2 & \text{if } x \geq 0 \\
-x^2 & \text{if } x < 0
\end{cases}
\]
Mathematical Symbols
Greek Letters
% Lowercase
\alpha, \beta, \gamma, \delta, \epsilon, \varepsilon
\zeta, \eta, \theta, \vartheta, \iota, \kappa
\lambda, \mu, \nu, \xi, \pi, \varpi
\rho, \varrho, \sigma, \varsigma, \tau, \upsilon
\phi, \varphi, \chi, \psi, \omega
% Uppercase
\Gamma, \Delta, \Theta, \Lambda, \Xi, \Pi
\Sigma, \Upsilon, \Phi, \Psi, \Omega
Operators
\pm, \mp, \times, \div, \cdot
\cap, \cup, \subset, \supset, \in, \notin
\wedge, \vee, \neg, \forall, \exists
\leq, \geq, \neq, \approx, \equiv, \sim
\sum, \prod, \int, \oint, \partial
\nabla, \infty, \aleph, \beth
Relations
\rightarrow, \leftarrow, \Rightarrow, \Leftarrow
\leftrightarrow, \Leftrightarrow
\mapsto, \hookleftarrow
\subset, \supset, \subseteq, \supseteq
\neq, \approx, \equiv, \cong
Delimiters
( ), [ ], \{ \}, | |
\left( \right)
\left[ \right]
\left\{ \right\}
\left| \right|
\left\langle \right\rangle
Matrices
Basic Matrix
\[
\begin{matrix}
a & b \\
c & d
\end{matrix}
\]
% With brackets
\begin{bmatrix}
a & b \\
c & d
\end{bmatrix}
\begin{pmatrix}
a & b \\
c & d
\end{pmatrix}
\begin{vmatrix}
a & b \\
c & d
\end{vmatrix}
Matrix Variations
% Small matrix (inline)
$\begin{smallmatrix}
a & b \\
c & d
\end{smallmatrix}$
% With dots
\begin{bmatrix}
a_{11} & a_{12} & \cdots & a_{1n} \\
a_{21} & a_{22} & \cdots & a_{2n} \\
\vdots & \vdots & \ddots & \vdots \\
a_{m1} & a_{m2} & \cdots & a_{mn}
\end{bmatrix}
Theorem Environments
Setting Up Theorems
\usepackage{amsthm}
\newtheoremstyle{mystyle}
{\topsep} % Space above
{\topsep} % Space below
{\normalfont} % Body font
{0pt} % Indentation
{\bfseries} % Head font
{.} % Punctuation
{5pt plus 1pt minus 1pt} % Space after head
{}
\theoremstyle{mystyle}
\newtheoremtheorem}{theorem}{Theorem}
\newtheoremlemma}[theorem]{Lemma}
\newtheoremdefinition}{definition}{Definition}
\newtheoremproposition}{proposition}{Proposition}
\newtheoremcorollary}[theorem]{Corollary}
Using Theorems
\begin theorem}
If $f$ is continuous on $[a,b]$, then $f$ attains its maximum value.
\end theorem}
\begin lemma}
For any $\epsilon > 0$, there exists $\delta > 0$ such that...
\end lemma}
\begin definition}
A \textbf{group} is a set $G$ with a binary operation $\cdot$ satisfying...
\end definition}
Proof Environment
\begin proof}
We prove by induction on $n$. For $n=1$, the statement is trivial.
Assume true for $n=k$. Then for $n=k+1$...
Thus the theorem holds.
\end proof}
Numbering Equations
Section-based Numbering
\numberwithin{equation}{section}
\numberwithin{equation}{subsection}
Sub-numbering
\begin{equation}
a^2 + b^2 = c^2 \tag{Pythagoras}
\end{equation}
\begin{equation}
e^{i\pi} + 1 = 0 \tag{Euler's Identity}
\end{equation}
Custom Labels
\tag{ref:myequation}
\ref{eq:myequation}
\eqref{eq:myequation}
Spacing in Math Mode
Thin and Thick Spaces
\! % Negative thin space
\, % Thin space (3/18 quad)
\: % Medium space (4/18 quad)
\; % Thick space (5/18 quad)
\quad % 1 quad (1 em)
\qquad % 2 quads
% Examples
\int_a^b f(x)\,dx % Proper spacing
\, vs \, % Nested integrals
x\,y % Product vs xy
Text in Math
\text{text}
\mathrm{text} % Roman (upright)
\mathbf{text} % Bold
\mathsf{text} % Sans-serif
\ittext % Italic
\[
\text{Let } x \in \mathbb{R} \text{ be arbitrary}
\]
Advanced Examples
Brackets with Size
\left(
\begin{array}{cc}
a & b \\
c & d
\end{array}
\right)
Aligned Equations with Text
\begin{align*}
\sqrt{1 + x} &= 1 + \frac{x}{2} - \frac{x^2}{8} + \frac{x^3}{16} - \cdots \\
&= \sum_{n=0}^{\infty} \frac{(-1)^n (2n)!}{(1-2n)2^{2n} (n!)^2} x^n
\end{align*}
Commutative Diagrams
\usepackage{amscd}
\[
\begin{CD}
A @>>> B @>>> C \\
@VVV @. @VVV \\
D @>>> E @>>> F
\end{CD}
\]
Best Practices
Code Readability
Use spaces and line breaks:
% Hard to read
$$\int_0^\infty e^{-x^2}dx = \frac{\sqrt{\pi}}{2}$$
% Easier to read
\[
\int_0^\infty e^{-x^2} \, dx = \frac{\sqrt{\pi}}{2}
\]
Consistency
Choose one approach and stick with it:
- Display vs inline equations
- Numbering style
- Theorem formatting
Conclusion
LaTeX provides comprehensive mathematical typesetting capabilities. The amsmath and amsthm packages form the foundation for professional mathematical documents, handling everything from simple equations to complex theorem-proof structures.
Master these tools and your mathematical documents will meet the highest typographic standards.
Comments