# A problem with using a “basic” math example environment

I am writing a report with various chapters.

\usepackage{amsthm}
\newtheorem{example}[Example]

\begin{example}
contents of the example
\end{example}


The problem is with the auto numbering of the examples. I want the numbering of the examples to start all over again within every chapters. But this is giving a continuous numbering from top to bottom of the report. How can I do it?

• See section 3 "Theorem numbering" on page 5 of the documentation of amsthm (you get it with texdoc amsthm or search for amsthdoc.pdf). – Ulrike Fischer Oct 27 '17 at 7:11
• \newtheorem{example}{Example}[chapter] – egreg Oct 27 '17 at 7:29

From this amsthdoc.pdf (page 2, section 3):

To have a theorem environment numbered subordinately within a sectional unit— e.g., to get propositions numbered Proposition 2.1, Proposition 2.2, and so on in Section 2—put the name of the parent unit in square brackets in final position:

\newtheorem{prop}{Proposition}[section]

With the optional argument [section], the prop counter will be reset to 0 whenever the parent counter section is incremented.

Or, as egreg said:

\newtheorem{example}{Example}[chapter]


Acks: Thanks to Ulrike Fischer, too

• If you are just converting comments from other people into an answer, it would be nice if a) you would ask them first if they want to write an answer themselves b) mark such answers that are based on other peoples comments as "community wiki". Same for previous answers. – user36296 Oct 27 '17 at 19:15
• samcarter, a) is it OK if I ask them in the comments? Or how should I contact them? .. b) I didn't know about the "community wiki" checkbox. Thank you for the feedback! – evaristegd Oct 27 '17 at 20:01
• yes, comments are an appropriate way to ask - write an @ before the user name to notify the respective user. You can even mark already written answers as "community wiki" – user36296 Oct 27 '17 at 20:56
• @samcarter Wait, so adding @ before the username sends the proper notification? I am confused because this says the opposite is true – evaristegd Oct 27 '17 at 22:17
• yes, that's how it works, also described in meta.stackexchange.com/a/35914/237989 – user36296 Oct 27 '17 at 22:33