Last modified on 26 February 2014, at 10:40

LaTeX/Theorems

LaTeX logo.svg

LaTeX

Getting Started
  1. Introduction
  2. Installation
  3. Installing Extra Packages
  4. Basics

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. Importing Graphics
  14. Floats, Figures and Captions
  15. Footnotes and Margin Notes
  16. Hyperlinks
  17. Labels and Cross-referencing

Mechanics

  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. Letters
  2. Presentations
  3. Teacher's Corner
  4. Curriculum Vitae

Creating Graphics

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

Programming

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

Miscellaneous

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

Help and Recommendations

  1. FAQ
  2. Tips and Tricks

Appendices

  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 theoremsEdit

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

\usepackage{amsthm}

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:

\newtheorem{mydef}{Definition}

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

\begin{mydef}
Here is a new definition
\end{mydef}

It will look like this:

Definition 3 Here is a new definition

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

Theorem countersEdit

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,

\newtheorem*{mydef}{Definition}

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

ProofsEdit

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

\begin{proof}
Here is my proof
\end{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
\end{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:

\begin{proof}
Here is my proof:
\[
a^2 + b^2 = c^2 \qedhere
\]
\end{proof}

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:

\renewcommand{\qedsymbol}{}

Theorem stylesEdit

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

\theoremstyle{stylename}

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 stylesEdit

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:

\begin{definition}[Topology]...

(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).

ConflictsEdit

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

% Fix latex
\def\smallskip{\vskip\smallskipamount}
\def\medskip{\vskip\medskipamount}
\def\bigskip{\vskip\bigskipamount}
 
% Hand made theorem
\newcounter{thm}[section]
\renewcommand{\thethm}{\thesection.\arabic{thm}}
\def\claim#1{\par\medskip\noindent\refstepcounter{thm}\hbox{\bf \arabic{chapter}.\arabic{section}.\arabic{thm}. #1.}
\it\ %\ignorespaces
}
\def\endclaim{
\par\medskip}
\newenvironment{thm}{\claim}{\endclaim}

In this case theorem looks like:

\begin{thm}{Claim}\label{lyt-prob} 
Let it be.
Then you know.
\end{thm}

NotesEdit

  1. a b c d Requires the amsthm package

External linksEdit


Previous: Advanced Mathematics Index Next: Chemical Graphics