[Tex/LaTex] Resetting counters for every new chapter

chapterscounters

I would like to reset the counters for everything, figures, tables, algorithms, lemmas, definitions, equations and others. So that they start at one again, for every chapter.
Is it possible or do I have to do it separately for each?

PS: I use \documentclass[11pt]{book}.

Best Answer

Basically you need to do it for each. The numbering system is based on counters, and each number has its own counter. Resetting all counters would include things you don't want to reset, like page numbers. As said in the comments, different document classes treat the counters different. In book for example, things like section, subsection, equation, table and figure are automatically reset at each chapters start. But for example theorem and lemma, and other things you define by your self, you need define it such that it the counter reset at chapter start. For example:

\documentclass{book}
\usepackage{graphicx}
\newtheorem{theorem}{Theorem}[chapter] %%% Reset theorem counter at chapter start
\begin{document}

\chapter{First chapter}
\section{First section}
\begin{theorem}
  As can be see in Figure~\ref{fig:Test1}...
\end{theorem}
\begin{figure}[htb]
  \centering
  \includegraphics[width=0.3\linewidth]{example-image-a}
  \caption{Test figure.}
  \label{fig:Test1}
\end{figure}

\section{Second section}
\begin{theorem}
  Test
\end{theorem}

\chapter{Second chapter}
\section{First section}
\begin{theorem}
  Euler's identity
  \begin{equation}
    e^{i\pi}+1=0
  \end{equation}
\end{theorem}
\begin{figure}[htb]
  \centering
  \includegraphics[width=0.3\linewidth]{example-image-a}
  \caption{Test figure.}
  \label{fig:Test2}
\end{figure}

\section{Second section}
\begin{theorem}
  Test
\end{theorem}

\end{document}

First chapter: enter image description here

Second chapter: enter image description here

Related Question