0

I am using \documentclass{book} with the amsmath and amsthm packages. Each chapter is a standalone paper, so I want the theorems in each chapter to begin with 1. How do I do this?

Here's a MWE.

\documentclass[printer]{book}
\usepackage{amsmath}
\usepackage{amsthm}
\newtheorem{theorem}{Theorem}

\begin{document}
\chapter{Blahblah}
\begin{theorem}{This is Theorem 1 as it should be}
\end{theorem}

\begin{theorem}{This is Theorem 2 as should be}
\end{theorem}

\chapter{Blibli}

\begin{theorem}{I need this to be Theorem 1!}
\end{theorem}

\end{document}
5
  • 2
    Did you try \newtheorem{theorem}{Theorem}[chapter]
    – Tom
    Jun 6 at 17:53
  • 1
    Take a look at the chngcntr package which deals in general with this sort of thing. Jun 6 at 18:38
  • @Tom This adds the chapter number before the theorem number, to produce Theorem 1.1 and Theorem 1.2, and then Theorem 2.1. I want to suppress the chapter number. Jun 6 at 22:28
  • @Peter Wilson I took a look but I'm too much of a newbie to know what to do with it! Jun 6 at 22:30
  • OK, I think I found a simple solution. Writing \setcounter{theorem}{0} at the beginning of the new chapter seems to reset the theorem numbers! Jun 6 at 22:36

2 Answers 2

1

If don't want manually write \setcounter{theorem}{0} every time, you could do this:

\documentclass{book} 
\usepackage{amsmath} 
\usepackage{amsthm} 
\newtheorem{theorem}{Theorem}[chapter]
\renewcommand{\thetheorem}{\arabic{theorem}}

\begin{document} 
\chapter{Blahblah} 
\begin{theorem}
This is Theorem 1 as it should be
\end{theorem}
\begin{theorem}
This is Theorem 2 as should be
\end{theorem}

\chapter{Blibli}
\begin{theorem}
I need this to be Theorem 1! 
\end{theorem}
\end{document}
1

This does what you want using the chngcntr package. Please read the package manual again.

% thmcntrprob.tex  SE 646889

\documentclass[printer]{book}
\usepackage{amsmath}
\usepackage{amsthm}
\newtheorem{theorem}{Theorem}

\usepackage{chngcntr}
\counterwithin*{theorem}{chapter}

\begin{document}
\chapter{Blahblah}
\begin{theorem}{This is Theorem 1 as it should be} \end{theorem}

\begin{theorem}{This is Theorem 2 as should be} \end{theorem}

\chapter{Blibli}

\begin{theorem}{I need this to be Theorem 1!} \end{theorem}

\end{document}
3
  • 2
    chngcntr is no longer needed.
    – egreg
    Jun 8 at 17:14
  • @egreg Why is chngcntr no longer needed? Perhaps it is now part of basic LaTeX; if so how does anyone know about it? Jun 9 at 17:46
  • It's described in one of the ltnews
    – egreg
    Jun 9 at 19:35

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.