Skip to main content
v2026.11,858 entries · CC-BY 4.0
LAC HealthMedical Supply Distributor100,000+ medical supplies. 48-hour critical dispatch.Ships from 8 regional U.S. hubs. Net-30 terms for verified institutional accounts.Shop lac.us CodeCASRAIlac.us

LaTeX Theorem: newtheorem, amsthm Styles, Numbering

How to define theorem, lemma and definition environments in LaTeX with newtheorem and amsthm, including numbering schemes and proof troubleshooting.

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

  1. Load packages. If you also use amsmath, load amsthm after it: usepackage{amsmath} then usepackage{amsthm}. The amsthm guide states that amsthm must be loaded after amsmath, not before.
  2. Declare the environments in the preamble, grouping each under the theoremstyle it 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.

  3. 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 of newtheorem.
  4. Add an optional note to the heading, such as a name or citation: begin{lem}[Alinhac-Lerner cite{a-l}] ... end{lem}.
  5. Write the proof in the proof environment: begin{proof} ... end{proof}. Pass a custom heading with begin{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 amsthm after amsmath.
  • 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}. The numberwithin command 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 qedhere inside the equation; if it errors, use mbox{qedhere}. It does not work with eqnarray or $$.
  • Proof written outside the proof environment. Use qed to add the symbol.
  • No period after a swapped number. With swapnumbers on 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.

Follow CASRAI

Research-administration guidance, standards updates and independent tool reviews.

Ask CASRAI · free to try

Ask about LaTeX Theorem: newtheorem, amsthm Styles, Numbering

Ask your first 2 questions free below. Subscribers get 150 a day for $29 a month.

An AI assistant specialized in research administration. It cites the sources behind every answer, labels web answers and says when it can't answer.

Answers draw on CASRAI's guides and dictionary plus the federal and funder documents we index: Federal Register, Grants.gov, Regulations.gov and UKRI.

Works on this site and inside Claude, Cursor and the AI tools you already use.

Everything CASRAI publishes — this page, the dictionary, the guides and the news — stays free to read, with no account and no card.

Referenced across the research world

University of Cambridge logoColumbia University logoCrossref logoUniversity of Edinburgh logoHarvard University logoUniversity of Oxford logoPrinceton University logoStanford School of Medicine logoUniversity College London logoORCID logoUniversity of Cambridge logoColumbia University logoCrossref logoUniversity of Edinburgh logoHarvard University logoUniversity of Oxford logoPrinceton University logoStanford School of Medicine logoUniversity College London logoORCID logo
  • University of Cambridge logo
  • Columbia University logo
  • Crossref logo
  • University of Edinburgh logo
  • Harvard University logo
  • University of Oxford logo
  • Princeton University logo
  • Stanford School of Medicine logo
  • University College London logo
  • ORCID logo

View CASRAI adoption →