The amsthm package

Defines theorem environments in three styles with \theoremstyle and \newtheorem, and adds the proof environment with an end-of-proof mark.

Loading the package

\usepackage{amsthm}

The \newtheorem of plain LaTeX knows one layout, a bold heading with italic text, and has no environment for proofs. amsthm adds three styles: plain (bold heading, italic text) for theorems, definition (bold heading, upright text) and remark (italic heading, upright text).

\theoremstyle sets the style for every \newtheorem that follows it. An optional argument after the environment name shares a counter, an optional argument at the end numbers within a unit such as section. The proof environment starts with "Proof." and ends with the square \qedsymbol.

Main commands

\newtheorem{theorem}{Theorem}[section]Defines the environment theorem, numbered within each section (1.1, 1.2, 2.1).
\newtheorem{lemma}[theorem]{Lemma}Defines lemma so that it shares the counter of theorem.
\newtheorem*{remark}{Remark}Defines an environment without a number.
\theoremstyle{definition}Selects plain, definition or remark for the definitions that follow.
\begin{theorem}[Pythagoras] ... \end{theorem}The optional argument prints a name in parentheses after the number.
\begin{proof} ... \end{proof}Proof with the end mark; \begin{proof}[Proof of Theorem 1] changes the heading.
\qedherePlaces the end mark in the current line, for a proof that ends with a display formula or a list.

Complete example

\documentclass{article}
\usepackage{amsmath}
\usepackage{amsthm}
\newtheorem{theorem}{Theorem}[section]
\newtheorem{lemma}[theorem]{Lemma}
\theoremstyle{definition}
\newtheorem{definition}[theorem]{Definition}
\begin{document}
\section{Even numbers}
\begin{definition}
An integer $n$ is \emph{even} if $n = 2k$ for some integer $k$.
\end{definition}
\begin{theorem}[Sum of even numbers]
The sum of two even integers is even.
\end{theorem}
\begin{proof}
Let $m = 2k$ and $n = 2l$. Then
\[ m + n = 2k + 2l = 2(k + l). \qedhere \]
\end{proof}
\end{document}
Result
The compiled example

Open in the editor

Compiled with pdfLaTeX from TeX Live 2023.

Pitfalls

Related pages