# Change the way theorems are numbered within a document

I'm working a document that has one (very large) chapter, in which theorems, lemmas, etc. are numbered with subsubsection, i.e. the start of the document has the command

\newtheorem{theorem}[subsubsection]{Theorem}


However, the document also has some short chapters, in which theorems etc. are numbered with subsection. At the moment, the only way I can do this is to also define a theorem_ at the beginning of the document:

\newtheorem{theorem_}[subsection]{Theorem}


and use theorem sometimes and theorem_ other times. This seems like an ugly hack, and I'd love it if there were some way I could use \begin{theorem}...\end{theorem} throughout the document, and use some command at the start of each chapter to determine whether theorems were numbered with subsection or subsubsection. Is this possible?

-

You could use

\renewcommand{\thetheorem}{\thesubsection.\arabic{theorem}}


immediately before the chapter you wish you change.

% arara: pdflatex
\documentclass{report}

\usepackage{lipsum}

\newtheorem{theorem}{Theorem}[subsubsection]

\setcounter{secnumdepth}{3}
\begin{document}

\chapter{one}
\section{sec}
\subsection{subsec}
\subsubsection{subsubsec}
\begin{theorem}
\lipsum[1]
\end{theorem}

\renewcommand{\thetheorem}{\thesubsection.\arabic{theorem}}
\chapter{two}
\section{sec}
\subsection{subsec}
\subsubsection{subsubsec}
\begin{theorem}\label{thm:test}
\lipsum[1]
\end{theorem}
\ref{thm:test}

\end{document}


Changing the numbering convention part way through a document could cause confusion to your reader. How many theorems do you have? Does the numbering need to go so deep? Just some thoughts :)

-
Otherwise you can use \counterwithin{theorem}{subsection} from the package chngcntr. –  karlkoeller Sep 5 '13 at 17:34
I'm well aware that changing the numbering convention could cause confusion - the problem is, I don't have control over the numbering. And the document is ~150 pages, so yes, the numbering does need to that deep. Thanks for this nice solution though! –  Daniel Miller Sep 5 '13 at 22:25
In the OP's intention, theorem shares the subsubsection counter, it's not subordinate to it. So there's no \thetheorem –  egreg Sep 5 '13 at 22:25
@egreg thanks for pointing that out. in which case karlkoeller's idea seems more appropriate –  cmhughes Sep 6 '13 at 0:55