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

This might be a simple question but it's weird that I couldn't find the answer anywhere on the internet.

If I set as


then I get the numbering as Theorem [section.subsection.thm number], so I always need to specify the chapter, but the problem is that the chaptering is likely to change until the final stage. Otherwise, if I were to set as


then I only get Theorem [chapter.thm number] so that sectional structure is lost and the numbering becomes very unclear and inefficient.

At first, this seems very simple but it's funny that I could not find the answer. Is there any way of doing this only with AMSthm package? If it is not, it's still okay, and any solution on this would be very much appreciated.

share|improve this question
Hi annoyed, welcome to TeX.sx. I've put your code into code blocks. This is done with four spaces to indent, or there is also the {} button in the editor. In addition, I've removed the thanks. This is just the style here, and thanks is best expressed as up votes for answers that help you. – qubyte Feb 22 '12 at 1:17

The amsmath package provides the command numberwithin- it can be used as demonstrated in the MWE below.

Note that the numberwithin command can be used on pretty much any environment that has a number (tables, figures, etc).



\usepackage{amsmath} % provides numberwithin (and lots more)
\usepackage{lipsum}  % for sample text

\numberwithin{mytheorem}{subsection} % important bit


\chapter{My theorems}


share|improve this answer
It may be worth adding that the \numberwithin command can operate not only on theorem-like environments, but also on just about any environment that's normally numbered incrementally, including figure and table floating environments. – Mico Feb 22 '12 at 1:29
@Mico good idea, thanks, done :) – cmhughes Feb 22 '12 at 1:35
@cmhughes @Mico This works with \documentclass{report} but not with \documentclass{amsbook}. With report class, I can't use something like \swapnumbers and \newtheoremstyle. How can I fix this? – HBS Feb 22 '12 at 1:53
@hbshim: On p. 11 of the AMS-issued manual "Instructions for Preparation of Papers and Monographs," it says that "The amsbook document class resets figure and table numbers automatically [at the beginning of each chapter], but does not include the chapter number in the printed caption. To add the chapter number [to the caption], place these lines in the preamble of the driver file: \numberwithin{figure}{chapter} and \numberwithin{table}{chapter}." – Mico Feb 22 '12 at 2:12
@hbshim: Further to your comments that you can't seem to use \swapnumbers and \newtheoremstyle with the report doc class: Did you remember to load either the amsthm or the ntheorem package, as well as the amsmath package, prior to executing these commands? – Mico Feb 22 '12 at 2:17

Alternatively, you can do

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.