4

I want to number theorems in the form "Theorem 1.4.26", such that the first two numbers are the chapter and section numbers and the last one is the number of the theorem in the whole book. That is, the counter for the last one does not reset through sections and chapters.

  • 1
    Welcome to TeX.SE. Which document class do you use? Do you use a theorem-styling package such as amsthm or ntheorem? Which numbering system is being employed currently? – Mico Mar 16 '16 at 6:26
4

Assuming no package concerning theorem-like environments is loaded, the counter associated with a theorem environment is incremented monotonically unless a final optional argument of the \newtheorem command is provided. I.e.,

\newtheorem{mytheorem}{Theorem}

defines a theorem environment and an associated counter, both named mytheorem. In contrast,

\newtheorem{mytheorem}{Theorem}[chapter]

would define the same environment, but with the mytheorem counter being reset every time the counter named chapter is changed.

The final thing to solve is the way the counter variable associated with the theorem environment is displayed. Your formatting objective may be acheived by issuing the instruction \renewcommand{\themytheorem}{\thesection.\arabic{mytheorem}} in the preamble.

\documentclass{book}

\newtheorem{mytheorem}{Theorem}
\renewcommand{\themytheorem}{\thesection.\arabic{mytheorem}}

\begin{document}

\chapter{First}
\section{First}
\begin{mytheorem}
Foo
\end{mytheorem}


\chapter{Second}
\section{First in Second}
\begin{mytheorem}
Foobar
\end{mytheorem}

\end{document}
  • @egreg: True, I confused the additions of amsthm with the standard environment. Removed the reference to amsthm. Thanks – user31729 Mar 16 '16 at 7:21
  • +1. I've taken the liberty of editing your posting a bit. – Mico Mar 16 '16 at 8:41
  • @Mico: Hm, was it really necessary? – user31729 Mar 16 '16 at 17:37
  • I may have gotten carried away a bit. :-( Sorry. Feel free to revert. – Mico Mar 16 '16 at 18:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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