[Tex/LaTex] Numbering theorem-like environments

numberingtheorems

I would like all my theorem-like environments (theorem, example, etc.) to be numbered but such that the number appears before the environment's name, more or less like this:

1. Theorem

2. Example

How can I do this?

Best Answer

amsthm provides \swapnumbers which reverses the display of Theorem <num>. to <num> Theorem. Here's a minimal example:

enter image description here

\documentclass{article}
\usepackage{amsthm}% http://ctan.org/pkg/amsthm
\swapnumbers % Switch number/label style
\theoremstyle{plain}
\newtheorem{theorem}{Theorem}
\newtheorem{example}[theorem]{Example}
\begin{document}
\begin{theorem}
This is a theorem.
\end{theorem}
\begin{example}
This is an example.
\end{example}
\end{document}​

In the above example, the example environment shares the theorem counter. Moreover, both are defined with the plain style. There are others available, as shown in the amsthm package documentation.

Related Question