I am writing my thesis in book environment using Latex. The equation numbers for every chapter start with prefix "1" i.e. the equation numbers in chapter 1 are 1.1, 1.2 etc.; and for chapter 2 they again start by 1.1. 1.2.... My wish is to have the following

Chapter 1 1.1, 1.2,...

Chapter 2 2.1, 2.2,...

Chapter 3 3.1, 3.2,...

(regardless of the sections and subsections)

I have tried many solutions but couldn't get it in a correct way either by default setting of amsmath package or by using chngcntr and counterwithin{}{}. The sample code is also attached hereenter code here. I have wasted many days but to no avail, so would be very thankful if someone can provide with the solution.

\usepackage{amsmath,amsfonts,amssymb, amsthm}


\usepackage[font={it,small}]{caption}% Support for small, `sub' figures and tables
\usepackage{booktabs, makecell, rotating}% <-- added for tables



\theoremstyle{plain}% Theorem-like structures provided by amsthm.sty






\usepackage{subcaption} % Package to add a matrix like picture structure i.e. an mxn frame
\usetikzlibrary{calc} % Libraray for the figures related to instance reductions

\usepackage[acronym, nohypertypes={acronym}, nonumberlist]{glossaries}
\newglossaryentry{U}{name={$U$},description={the set of all things}} 
\newacronym{mci}{MCI}{Minimum Connectivity Inference}
\newacronym{mst}{MST}{Minimum Spanning Tree}


\chapter{First chapter}\label{ch:mci-formul}

\section{A section}\label{mst-formul}

\subsection{A subsection}
We give first set of equations:
\sum_{e\in E} x_e & = m-1, & \label{subeq211a}\\
\sum_{e\in E(S)}x_e & \leq |S|-1, 
&S\subset V, S \neq V, S \neq \emptyset. \label{subeq211b}

\chapter{Second chapter}\label{ch:mod-red}

\section{Section of ch 2}\label{simp-red}

\subsection{subsection of ch 2}

The first variant is as below:
\sum\limits_{a\in A_i^-(j)}f_a^i - \sum\limits_{a\in A_i^+(j)}f_a^i & =  -1,
&j\in V_i\setminus V^{\max}_i,\, j\neq r_i,  i\in I, \label{subeq411a}
f_{(j,k)}^i+f_{(k,j)}^i&\le(|V^R_i|-1)x_e, &\ e=\{j,k \} \in E(V_i)\setminus E(V^{\max}_i), i\in I, \label{subeq411b}\\
f^i_a & \geq 0, & a \in A(V_i)\setminus A(V^{\max}_i), i\in I. \label{subeq411c} 

  • add \numberwithin{equation}{chapter} in your document premable. – Zarko May 11 '19 at 14:03

Just remove this line (line 57 in the OP code)


and you see the equations numbered correctly

enter image description here


To include section number as well in the equation numbering, you just add this line in preamble:


to get numbering like this:

enter image description here

| improve this answer | |
  • Can you please tell that how can I add the section number to the equation as well e.g. the equations in chapter 2, section 3 are numbered as 2.3.1, 2.3.2, ..... Thanks. – Optimist Optimizer May 11 '19 at 14:04
  • I normally use \thechapter and \thesecdtion instead of \arabic{chapter} and \arabic{section}, or possibly just \thesection if it includes \thechapter. Obviously you still need to use \arabic{equation}. – John Kormylo May 11 '19 at 14:32
  • @OptimistOptimizer - I edited my answer to fulfill this requirement, please see the edited section. – AboAmmar May 11 '19 at 18:19
  • @AboAmmar thanks a lot. – Optimist Optimizer May 13 '19 at 8:11

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.