Written and maintained by CASRAI Editorial Board
Last updated
In LaTeX, a theorem is set up with newtheorem, which defines an environment such as thm that prints a numbered heading (for example “Theorem 1.”). The amsthm package adds theoremstyle, unnumbered * versions and a proof environment. This guide is for researchers writing mathematics, statistics or theory-heavy papers who need theorems, lemmas, definitions and proofs to number and look the way a journal expects.
What theorem environments are used for in research
Papers in mathematics, statistics, computer science and theoretical physics state results as theorems, lemmas, corollaries and propositions, and give definitions and remarks separately. LaTeX does not provide these environments by default: you declare each one in the preamble, then use it in the text. The amsthm usage guide (version 2.20.3, September 2017) describes the package as providing an enhanced newtheorem that recognises theoremstyle, a * form for unnumbered environments, and a proof environment that adds a QED symbol. The AMS document classes already incorporate amsthm. For wider conventions on structuring such papers see mathematics paper writing conventions.
Install or access
amsthm is part of the AMS “required” LaTeX bundle (amscls) and is listed on CTAN at ctan.org/pkg/amsthm (package version 2.20.6, dated 2020-05-29, LPPL 1.3c, checked 2026-11-07). A plain newtheorem needs no package at all; for the extra features add usepackage{amsthm} to the preamble.
Step by step: define and use a theorem
- Load packages. If you also use
amsmath, loadamsthmafter it:usepackage{amsmath}thenusepackage{amsthm}. The amsthm guide states that amsthm must be loaded after amsmath, not before. - Declare the environments in the preamble, grouping each under the
theoremstyleit should use:theoremstyle{plain}newtheorem{thm}{Theorem}[section]newtheorem{lem}[thm]{Lemma}newtheorem{prop}[thm]{Proposition}newtheorem*{cor}{Corollary}theoremstyle{definition}newtheorem{defn}{Definition}[section]newtheorem{exmp}{Example}[section]theoremstyle{remark}newtheorem*{rem}{Remark}This is the example given in the amsthm documentation.
- Use an environment in the body:
begin{lem} ... end{lem}prints the heading “Lemma 1.” followed by the text. The heading text is exactly what you gave as the second argument ofnewtheorem. - Add an optional note to the heading, such as a name or citation:
begin{lem}[Alinhac-Lerner cite{a-l}] ... end{lem}. - Write the proof in the
proofenvironment:begin{proof} ... end{proof}. Pass a custom heading withbegin{proof}[Proof of the Main Theorem].
Theorem in LaTeX without amsthm
Overleaf’s documentation notes that newtheorem{theorem}{Theorem} works without any package, as do the counter forms newtheorem{theorem}{Theorem}[section], newtheorem{corollary}{Corollary}[theorem] and newtheorem{lemma}[theorem]{Lemma}. The starred (unnumbered) form, theoremstyle and the proof environment need usepackage{amsthm}.
Numbering schemes for theorems in LaTeX
The two optional arguments of newtheorem are mutually exclusive. The amsthm guide describes these outcomes:
| Goal | Declaration | Result |
|---|---|---|
| Each environment counted independently (default) | newtheorem{thm}{Theorem} and newtheorem{lem}{Lemma} |
Lemma 1, Lemma 2, Theorem 1, Lemma 3, Theorem 2 |
| Shared counter | newtheorem{thm}{Theorem}, newtheorem{lem}[thm]{Lemma} |
Lemma 1, Lemma 2, Theorem 3, Lemma 4 |
| Restart within a parent counter | newtheorem{prop}{Proposition}[section] |
Proposition 2.1 (section 2, first proposition) |
| Unnumbered, named | newtheorem*{KL}{Klein's Lemma} |
Klein’s Lemma. |
To put the number before the name (“1.4 Theorem”), place swapnumbers before the newtheorem list.
Which style for which statement
The amsthm guide defines three built-in styles: plain (italic text, extra space above and below; used if you set no style), definition (upright text, extra space) and remark (upright, no extra space). It lists typical contents for each:
| Style | Typical environments listed in the guide |
|---|---|
plain |
Theorem, Lemma, Corollary, Proposition, Conjecture, Criterion, Assertion |
definition |
Definition, Condition, Problem, Example, Exercise, Algorithm, Question, Axiom, Property, Assumption, Hypothesis |
remark |
Remark, Note, Notation, Claim, Summary, Acknowledgment, Case, Conclusion |
For remark-style details see remark in LaTeX. You can define your own style with newtheoremstyle; the guide gives examples in its section 4.3.
Output and how to read it
Compile twice if you use label and ref to cite theorem numbers (see LaTeX ref). A proof ends with a QED symbol added automatically. To change it, redefine qedsymbol, for example renewcommandqedsymbol{$blacksquare$} (Overleaf’s example, which needs amssymb). For proofs ending in a displayed equation or list, place qedhere inside it; see end-of-proof symbol in LaTeX. After the end of a theorem or proof, the next line starts a new, indented paragraph in AMS style.
Troubleshooting
- Load-order problems with amsmath. Load
amsthmafteramsmath. - Numbering carries over from the previous chapter in a book. If the first section-numbered element comes before the first section, numbering continues from the earlier chapter. Fix with
setcounter{thm}{0}. Thenumberwithincommand of amsmath does not work for theorem numbers. - No QED symbol appears. A blank line before
end{proof}disables it. - QED symbol misplaced after a display. Use
qedhereinside the equation; if it errors, usembox{qedhere}. It does not work witheqnarrayor$$. - Proof written outside the proof environment. Use
qedto add the symbol. - No period after a swapped number. With
swapnumberson a non-AMS class, no period follows the number.
Alternatives to amsthm
| Approach | What it gives you | Source |
|---|---|---|
Plain newtheorem (no package) |
Numbered environments, per-section and shared counters | Overleaf, Theorems and proofs |
amsthm |
Styles, unnumbered * form, proof and QED handling |
amsthm usage guide |
| AMS document classes | Incorporate amsthm already | amsthm usage guide |
For a starter document, see the LaTeX notes template.
FAQ
How do I write a theorem in LaTeX?
Declare it with newtheorem{thm}{Theorem} in the preamble, then write begin{thm} ... end{thm}. It prints as “Theorem 1.” and numbers automatically.
How do I make an unnumbered theorem?
Use the starred form from amsthm, for example newtheorem*{cor}{Corollary}.
Can lemmas and theorems share one counter?
Yes: declare newtheorem{lem}[thm]{Lemma} after the theorem so both use the thm counter.
How do I number theorems by section?
Add the parent counter in the last argument: newtheorem{thm}{Theorem}[section].
Sources
- amsthm usage guide, version 2.20.3, September 2017 (amsthdoc.pdf, American Mathematical Society, distributed on CTAN), read 2026-11-07.
- CTAN package page for amsthm: https://ctan.org/pkg/amsthm, read 2026-11-07.
- Overleaf, Theorems and proofs: https://www.overleaf.com/learn/latex/Theorems_and_proofs, read 2026-11-07.







