2

This question already has an answer here:

There are lots of theorems and lemmas in my thesis which are being numbered continuously from start to end. I want the numbering to be like Theorem <>.<>. Same for lemmas and corollaries. I am using amsthm and the environments are defined like

\newtheorem{definition}{Definition}
\newtheorem{lemma}{Lemma}

Is there any simple way to get chapter-wise numbering?

marked as duplicate by Charles Stewart, Martin Schröder, Jesse, Peter Jansson, Svend Tveskæg Jan 30 '14 at 8:42

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

2

Just to show another possibility in case.... (We like hard ways ;)...)

This can also be done with chngcntr package.

\documentclass{book}
\usepackage{amsthm}
\newtheorem{theorem}{Theorem}
\newtheorem{definition}{Definition}
\newtheorem{lemma}{Lemma}

\usepackage{chngcntr}
\counterwithin{theorem}{chapter}
\counterwithin{definition}{chapter}
\counterwithin{lemma}{chapter}
\begin{document}

\chapter{1st chapter}

\begin{theorem}
  A theorem
\end{theorem}

\begin{definition}
  A definition.
\end{definition}

\begin{lemma}
  A lemma.
\end{lemma}

\chapter{2nd chapter}

\begin{theorem}
  A theorem
\end{theorem}

\begin{definition}
  Another definition.
\end{definition}

\begin{lemma}
  Another lemma.
\end{lemma}

\end{document}

enter image description here

  • One should go Karl's way though :) – user11232 Jan 30 '14 at 8:19
  • Thanks a lot. It works fine for environments except theorem, which is an inbuilt environment. When I add \counterwithin{theorem}{chapter} to my preamble, I get error saying theorem is not a counter. – Della Jan 30 '14 at 9:25
  • @Barman It works for theorems too. See the edit. :) – user11232 Jan 30 '14 at 9:52
4

If I understand correctly, you want your theorem-like environments to be numbered within chapters.

To do this, you have to add the optional parameter chapter to your theorem definitions, for example:

\newtheorem{definition}{Definition}[chapter]
\newtheorem{lemma}{Lemma}[chapter]

In this way their number contains the chapter number and the numeration is reset at every chapter.

MWE:

\documentclass{book}
\usepackage{amsthm}

\newtheorem{definition}{Definition}[chapter]
\newtheorem{lemma}{Lemma}[chapter]

\begin{document}

\chapter{1st chapter}

\begin{definition}
  A definition.
\end{definition}

\begin{lemma}
  A lemma.
\end{lemma}

\chapter{2nd chapter}

\begin{definition}
  Another definition.
\end{definition}

\begin{lemma}
  Another lemma.
\end{lemma}

\end{document} 

Output:

enter image description here

  • Thanks, but I want it for theorem like environments and theorems as well. How do I do it for the theorem environment which is already defined? – Della Jan 30 '14 at 9:27
  • @Barman, something like \newtheorem{theorem}{Theorem}[chapter] – karlkoeller Jan 30 '14 at 9:29
  • \newtheorem{theorem}{Theorem} says the environment is already defined and gives error. The same problem with @Harish's answer as well. – Della Jan 30 '14 at 9:38
  • Can you please add a MWE in your question? – karlkoeller Jan 30 '14 at 9:41

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