Different packages of Latex provide nice and easy-to-use environments for theorems, lemmas, proofs, etc. The following post will show you the mostly used layouts and how to change numbering.
Theorem styles: For theorems, corollaries and lemmas, you need the following package:
\usepackage{amsthm}
which allows you to define new environments using either:
\newtheorem{env_name}{caption}[within]
or
\newtheorem{env_name}[numbered_like]{caption}
where
env_name
: Environment namecaption
: Text printed before the number, e.g. Theorem, Lemma, etc.within
: The name of a defined counternumberered_like
: Name of a defined theorem-like environment
Note: The command may at most have one optional argument. Let me give an example: First we define a new theorem “Theorem”, which takes the numbering of the section plus a consecutive number:
\newtheorem{thm}{Theorem}[section]
For your theorems you can now use the defined environment:
\begin{thm}...\end{thm}
For lemmas which have the same numbering as the previous thm-environment, we need to define a new theorem type:
\newtheorem{lem}[thm]{Lemma}
Note: Environments different from thm, lem or cor need to be defined previously, having a different counter which starts from zero:
\theoremstyle{remark} \newtheorem{rem}{Remark} \begin{rem}This is a remark.\end{rem}
Note: To omit the numbering, you can use the star as for chapters, sections, etc.:
\newtheorem*{lem}[thm]{Lemma}
Proof: A proof usually comes without a numbering as it follows a numbered theorem, corollary, etc. For a proof, you need the following package:
\usepackage{amsthm}
and then you can directly use the proof-environment:
\begin{proof}...\end{proof}
The closing statement automatically prints a qed-sign (square box) on an empty line after the last statement, terminating the proof.Note: If you want to place the qed-sign on the last line, i.e. if your proof ends with an equation, you can use the command:
\qedhere
inside the equation-environment (before the \end{equation}
).