2

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?

1 Answer 1

2

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 :)

4
  • 1
    Otherwise you can use \counterwithin{theorem}{subsection} from the package chngcntr. Commented Sep 5, 2013 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! Commented Sep 5, 2013 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
    Commented Sep 5, 2013 at 22:25
  • @egreg thanks for pointing that out. in which case karlkoeller's idea seems more appropriate
    – cmhughes
    Commented Sep 6, 2013 at 0:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .