[Tex/LaTex] How to customize the equation numbering in book document class

equations

As you may well know, the book class follows the structure bellow for numbering equations:

Chapter 1
First Equation 1.1
Second Equation 1.2
Chapter 2
First Equation 2.1
Second Equation 2.2
Third Equation 2.3

This numbering system is irrespective of the section at which the equation is placed. I want the custom numbering format described bellow:

Chapter 1
Section 1
First Equation 1.1
Second Equation 1.2
Section 2
First Equation 2.1
Second Equation 2.2
Chapter 2
Section 1
First Equation 1.1
Second Equation 1.2
Third Equation 1.3
Section 2
First equation 2.1
Second Equation 2.2

As you can see the chapter number is not shown in the equation tag, but the equations numbers are reset as a new chapter is introduced. In addition, the equations are counted within each section.

Please tell me how to perform this action in LaTeX?

Best Answer

You can use the chngcntr package:

\documentclass{book}

\usepackage{chngcntr}
\counterwithin*{equation}{section}
\renewcommand{\theequation}{\arabic{section}.\arabic{equation}}

\begin{document}

\mainmatter

\chapter{First chapter}

\section{First section}

Text
\begin{equation}
\mbox{First equation}
\end{equation}
text
\begin{equation}
\mbox{Second equation}
\end{equation}

\section{Second section}

Text
\begin{equation}
\mbox{First equation}
\end{equation}
text
\begin{equation}
\mbox{Second equation}
\end{equation}

\chapter{Second chapter}

\section{First section}

Text
\begin{equation}
\mbox{First equation}
\end{equation}
text
\begin{equation}
\mbox{Second equation}
\end{equation}

\section{Second section}

Text
\begin{equation}
\mbox{First equation}
\end{equation}
text
\begin{equation}
\mbox{Second equation}
\end{equation}

\end{document}

enter image description here

Related Question