TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
How do you define your theorem and example environments at the moment - using a package or not? If you're using any package, please provide this information as well, since there are many packages available for defining theorem (or other) environments, each of which might require a specific solution. – Werner Feb 10 '12 at 17:58
@Werner: I don't really know much about packages (or latex, really), usually I just add a bunch of them until everything works. But I guess amsthm would be the one responsible for generating my Theorem environment. All my other environments are defined by \newtheorem{counter}{name}. Did I answer your question at all? – student Feb 10 '12 at 18:02
up vote 13 down vote accepted

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

enter image description here

\usepackage{amsthm}% http://ctan.org/pkg/amsthm
\swapnumbers % Switch number/label style
This is a theorem.
This is an example.

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.

share|improve this answer
Very elegant, this is the easiest one to use :) – cmhughes Feb 10 '12 at 18:11
@Werner: very helpful and complete; thanks! – student Feb 10 '12 at 21:28

amsthm has a command \swapnumbers that, when specified before the \theoremstyle or \newtheorem elenments for which numbers are to come first, will do what you want.

for details, see the amsthm user's guide, section 4.2 on "number swapping".

share|improve this answer
thanks! I wish I could choose your answer too! – student Feb 10 '12 at 21:33

There are few ways to create theorem like environments. Here's an option using ntheorem


The trick is to make a new theoremstyle using the arguments

  • ##1 which is the name of the theorem
  • ##2 which is the number of the theorem
  • ##3 which is the optional title of the theorem

Using the examples in the ntheorem documentation as a guide, you can tweak this to suit your needs.



{\item[\theorem@headerfont{##2\theorem@separator\hskip\labelsep ##1}]}%
{\item[\theorem@headerfont{##2\theorem@separator\hskip\labelsep ##1} (##3)]}%




\begin{mytheorem}[Optional title]

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.