Next: , Previous: , Up: Definitions   [Contents][Index]

### 12.9 \newtheorem

Synopses:

\newtheorem{name}{title}
\newtheorem{name}{title}[numbered_within]
\newtheorem{name}[numbered_like]{title}


Define a new theorem-like environment. You can specify one of numbered_within and numbered_like, or neither, but not both.

The first form, \newtheorem{name}{title}, creates an environment that will be labelled with title; see the first example below.

The second form, \newtheorem{name}{title}[numbered_within], creates an environment whose counter is subordinate to the existing counter numbered_within, so this counter will be reset when numbered_within is reset. See the second example below.

The third form \newtheorem{name}[numbered_like]{title}, with optional argument between the two required arguments, creates an environment whose counter will share the previously defined counter numbered_like. See the third example.

This command creates a counter named name. In addition, unless the optional argument numbered_like is used, inside of the theorem-like environment the current \ref value will be that of \thenumbered_within (see \ref).

This declaration is global. It is fragile (see \protect).

Arguments:

name

The name of the environment. It is a string of letters. It must not begin with a backslash, \. It must not be the name of an existing environment, and the command name \name must not already be defined.

title

The text to be printed at the beginning of the environment, before the number. For example, ‘Theorem’.

numbered_within

Optional; the name of an already defined counter, usually a sectional unit such as chapter or section. When the numbered_within counter is reset then the name environment’s counter will also be reset.

If this optional argument is not used then the command \thename is set to \arabic{name}.

numbered_like

Optional; the name of an already defined theorem-like environment. The new environment will be numbered in sequence with numbered_like.

Without any optional arguments the environments are numbered sequentially. The example below has a declaration in the preamble that results in ‘Definition 1’ and ‘Definition 2’ in the output.

\newtheorem{defn}{Definition}
\begin{document}
\section{...}
\begin{defn}
First def
\end{defn}

\section{...}
\begin{defn}
Second def
\end{defn}


This example has the same document body as the prior one. But here \newtheorem’s optional argument numbered_within is given as section, so the output is like ‘Definition 1.1’ and ‘Definition 2.1’.

\newtheorem{defn}{Definition}[section]
\begin{document}
\section{...}
\begin{defn}
First def
\end{defn}

\section{...}
\begin{defn}
Second def
\end{defn}


In the next example there are two declarations in the preamble, the second of which calls for the new thm environment to use the same counter as defn. It gives ‘Definition 1.1’, followed by ‘Theorem 2.1’ and ‘Definition 2.2’.

\newtheorem{defn}{Definition}[section]
\newtheorem{thm}[defn]{Theorem}
\begin{document}
\section{...}
\begin{defn}
First def
\end{defn}

\section{...}
\begin{thm}
First thm
\end{thm}

\begin{defn}
Second def
\end{defn}