amsmath
Extends LaTeX's mathematical typesetting capabilities with advanced environments, commands, and tools for formatting complex mathematical expressions.
Overview
Serves as the foundation for serious mathematical typesetting in LaTeX, providing comprehensive facilities for creating professional-quality mathematical documents. The package significantly enhances LaTeX's native math capabilities and is considered essential for academic and scientific writing.
- Offers sophisticated environments like
align
,gather
, andmultline
for precise equation alignment and multi-line mathematical expressions - Includes specialized tools for matrices, fractions, operator names, and bold mathematical symbols
- Automatically loads complementary packages for bold symbols, operator names, and text within mathematics
- Widely adopted in academic journals, research papers, mathematical textbooks, and scientific documentation
- Compatible with numerous extension packages that add specialized mathematical formatting features
Getting Started
To use amsmath
, include it in your document preamble:
\documentclass{article}
\usepackage{amsmath}
The package automatically loads amsbsy
, amsopn
, and amstext
packages, so you don't need to include them separately.
Examples
Using the align environment for multiple equations with alignment.
We can align multiple equations at the equals sign:
\begin{align}
x^2 + y^2 &= z^2 \\
x^3 + y^3 &= z^3 + 1 \\
x^4 + y^4 &= z^4 + 2
\end{align}
Creating a piecewise function with the cases environment.
The absolute value function can be defined as:
\[
|x| = \begin{cases}
x, & \text{if } x \geq 0 \\
-x, & \text{if } x < 0
\end{cases}
\]
Using matrices and equation numbering with tags.
The matrix multiplication is given by:
\begin{equation}\label{eq:matrix-mult}
\begin{pmatrix} a & b \\ c & d \end{pmatrix}
\begin{pmatrix} e & f \\ g & h \end{pmatrix} =
\begin{pmatrix} ae+bg & af+bh \\ ce+dg & cf+dh \end{pmatrix}
\end{equation}
We can also create a custom tag for an equation:
\begin{equation}\tag{Euler's Identity}
e^{i\pi} + 1 = 0
\end{equation}