From Wikibooks, open books for an open world
Jump to: navigation, search
LaTeX logo.svg


Getting Started
  1. Introduction
  2. Installation
  3. Installing Extra Packages
  4. Basics
  5. How to get help

Common Elements

  1. Document Structure
  2. Text Formatting
  3. Paragraph Formatting
  4. Colors
  5. Fonts
  6. List Structures
  7. Special Characters
  8. Internationalization
  9. Rotations
  10. Tables
  11. Title creation
  12. Page Layout
  13. Customizing Page Headers and Footers‎
  14. Importing Graphics
  15. Floats, Figures and Captions
  16. Footnotes and Margin Notes
  17. Hyperlinks
  18. Labels and Cross-referencing


  1. Errors and Warnings
  2. Lengths
  3. Counters
  4. Boxes
  5. Rules and Struts

Technical Texts

  1. Mathematics
  2. Advanced Mathematics
  3. Theorems
  4. Chemical Graphics
  5. Algorithms
  6. Source Code Listings
  7. Linguistics

Special Pages

  1. Indexing
  2. Glossary
  3. Bibliography Management
  4. More Bibliographies

Special Documents

  1. Scientific Reports (Bachelor Report, Master Thesis, Dissertation)
  2. Letters
  3. Presentations
  4. Teacher's Corner
  5. Curriculum Vitae

Creating Graphics

  1. Introducing Procedural Graphics
  2. MetaPost
  3. Picture
  4. PGF/TikZ
  5. PSTricks
  6. Xy-pic
  7. Creating 3D graphics


  1. Macros
  2. Plain TeX
  3. Creating Packages
  4. Themes


  1. Modular Documents
  2. Collaborative Writing of LaTeX Documents
  3. Export To Other Formats

Help and Recommendations

  1. FAQ
  2. Tips and Tricks


  1. Authors
  2. Links
  3. Package Reference
  4. Sample LaTeX documents
  5. Index
  6. Command Glossary

edit this boxedit the TOC

With "theorem" we can mean any kind of labelled enunciation that we want to look separated from the rest of the text and with sequential numbers next to it. This approach is commonly used for theorems in mathematics, but can be used for anything. LaTeX provides a command that will let you easily define any theorem-like enunciation.

Basic theorems[edit]

First of all, make sure you have the amsthm package enabled:


The easiest is the following:

\newtheorem{name}{Printed output}

put it in the preamble. The first argument is the name you will use to reference it, the second argument is the output LaTeX will print whenever you use it. For example:


will define the mydef environment; if you use it like this:

Here is a new definition

It will look like this:

Definition 3 Here is a new definition

with line breaks separating it from the rest of the text.

Theorem counters[edit]

Often the counters are determined by section, for example "Theorem 2.3" refers to the 3rd theorem in the 2nd section of a document. In this case, specify the theorem as follows:

\newtheorem{name}{Printed output}[numberby]

where numberby is the name of the section level (section/subsection/etc.) at which the numbering is to take place.

By default, each theorem uses its own counter. However it is common for similar types of theorems (e.g. Theorems, Lemmas and Corollaries) to share a counter. In this case, define subsequent theorems as:

\newtheorem{name}[counter]{Printed output}

where counter is the name of the counter to be used. Usually this will be the name of the master theorem.

The \newtheorem command may have at most one optional argument.

You can also create a theorem environment that is not numbered by using the newtheorem* command[1]. For instance,


defines the mydef environment, which will generate definitions without numbering. This requires amsthm package.


The proof environment[1] can be used for adding the proof of a theorem. The basic usage is:

Here is my proof

It just adds Proof in italics at the beginning of the text given as argument and a white square (Q.E.D. symbol, also known as a tombstone) at the end of it. If you are writing in another language than English, just use babel with the right argument and the word Proof printed in the output will be translated accordingly; anyway, in the source the name of the environment remains proof.

If you would like to manually name the proof, include the name in square brackets:

\begin{proof}[Proof of important theorem]
Here is my important proof

If the last line of the proof is displayed math then the Q.E.D. symbol will appear on a subsequent empty line. To put the Q.E.D. symbol at the end of the last line, use the \qedhere command:

Here is my proof:
a^2 + b^2 = c^2 \qedhere

The method above does not work with the deprecated environment eqnarray*. Use align* instead.

To use a custom Q.E.D. symbol, redefine the \qedsymbol command. To hide the Q.E.D. symbol altogether, redefine it to be blank:


Theorem styles[edit]

It adds the possibility to change the output of the environments defined by \newtheorem using the \theoremstyle command[1] in the header:


the argument is the style you want to use. All subsequently defined theorems will use this style. Here is a list of the possible pre-defined styles:

stylename Description Appearance
plain Used for theorems, lemmas, propositions, etc. (default) Theorem 1. Theorem text.
definition Used for definitions and examples Definition 2. Definition text.
remark Used for remarks and notes Remark 3. Remark text.

Custom styles[edit]

To define your own style, use the \newtheoremstyle command[1]:

\newtheoremstyle{stylename}% name of the style to be used
  {spaceabove}% measure of space to leave above the theorem. E.g.: 3pt
  {spacebelow}% measure of space to leave below the theorem. E.g.: 3pt
  {bodyfont}% name of font to use in the body of the theorem
  {indent}% measure of space to indent
  {headfont}% name of head font
  {headpunctuation}% punctuation between head and body
  {headspace}% space after theorem head; " " = normal interword space
  {headspec}% Manually specify head

(Any arguments that are left blank will assume their default value). Here is an example headspec:

\thmname{#1}\thmnumber{ #2}:\thmnote{ #3}

which would look something like:
Definition 2: Topology
for the following:


(The note argument, which in this case is Topology, is always optional, but will not appear by default unless you specify it as above in the head spec).


The theorem environment conflicts with other environments, for example wrapfigure. A work around is to redefine theorem, for example the following way:

% Fix latex

% Hand made theorem
\def\claim#1{\par\medskip\noindent\refstepcounter{thm}\hbox{\bf \arabic{chapter}.\arabic{section}.\arabic{thm}. #1.}
\it\ %\ignorespaces

In this case theorem looks like:

Let it be.
Then you know.


  1. a b c d Requires the amsthm package

External links[edit]

Previous: Advanced Mathematics Index Next: Chemical Graphics