\usepackage{amsthm} (after amsmath when you use both) to define theorem, lemma, and definition environments with \newtheorem and write proofs with \begin{proof}...\end{proof}. Use \theoremstyle (plain, definition, or remark) to control heading and body formatting, and use babel or an optional heading such as \begin{proof}[Beweis] to print labels in another language.
Defining theorems, lemmas, and definitions with \newtheorem
amsthm supports four \newtheorem forms:
The two optional arguments are mutually exclusive: put
[shared] before the printed title to share an existing counter, or [section] after the printed title to number within a parent division.
theorems-basic.tex
Ready to use this syntax? Continue in the browser editor when you want to adapt the example in a real project.Open LaTeX Cloud Studio
Pass an optional note in square brackets when opening an environment—such as \begin{definition}[Even integer] or \begin{theorem}[Sum of two even squares]—to print a title in parentheses after the number.
Built-in theorem styles (\theoremstyle)
\theoremstyle{...} sets the appearance of every \newtheorem declared after it until the next \theoremstyle command. amsthm defines three built-in styles:
The proof environment and \qedhere
amsthm defines the proof environment with an italic Proof. heading and a flush-right open square (\qedsymbol) at the end. Pass an optional argument such as \begin{proof}[Proof of Lemma~\ref{lem:sum-odd}] to replace the heading for one proof.
When a proof ends with a displayed equation (\[...\] or align*) or a list (enumerate), the QED symbol drops onto an empty line below the display by default. Place \qedhere at the end of the final display line to keep the symbol aligned on that line. Load \usepackage{amsmath} before \usepackage{amsthm} so amsthm enables amsmath-aware \qedhere placement inside align* and gather*.
proof-qedhere.tex
Changing theorem and proof labels to another language
The second braced argument of\newtheorem controls the printed environment title in any language (for example, \newtheorem{satz}{Satz} or \newtheorem{lemma}{Lemma}).
For the proof heading, loading \usepackage[ngerman]{babel} automatically translates \proofname from Proof to Beweis (and similarly for other babel languages). Without babel, you can redefine \renewcommand{\proofname}{Beweis} in the preamble or override a single proof with \begin{proof}[Beweis].
theorems-german.tex
Common mistakes
- Loading
amsthmbeforeamsmath:amsthmchecks whetheramsmathis already loaded to patch\qedhereforalign*andgather*. Load\usepackage{amsmath}before\usepackage{amsthm}whenever you use both. - Using both optional brackets on one
\newtheorem: Writing\newtheorem{lemma}[theorem]{Lemma}[section]stops withMissing \begin{document}, because TeX reads the trailing[section]as text in the preamble; set[section]on the primary counter (theorem) and only[theorem]on environments that share it. - Forgetting
\qedhereafter display math: Without\qedhere, the QED square appears on its own blank line beneath the final equation.
Try it in the editor
amsmath, amsthm, and babel are installed in LaTeX Cloud Studio’s TeX Live 2026 environment. Start from the Basic Article template in LaTeX Cloud Studio and replace main.tex with the complete example.
