# How to stop LaTex numbering equations within section [duplicate]

\documentclass[]{phstyle}
\usepackage{latexsym,amsfonts,amssymb, undertilde}
\usepackage[fleqn]{amsmath}
\usepackage{makeidx}

%Preamble

\numberwithin{equation}{chapter}
%\renewcommand{\theequation}{\thesection.\arabic{equation}}

\begin{document}

%\include{chapI}   these 2 lines are because the chapters are different tex files

%\include{chap1}

\renewcommand{\thechapter}{\Roman{chapter}}

%\setcounter{chapter}{0}
%\renewcommand{\theequation}{\thechapter.\arabic{equation}}

\chapter{Introduction}

\section{Chap I Section1}

$$this is equation I.1$$

$$this is equation I.2$$

\section{Chap I Section2}

$$this is equation I.3$$

\chapter{Chapter 1}

\section{Chap 1 Section 1}

$$this is equation 1.1.1$$

$$this is equation 1.1.2$$

\end{document}


I have been typing Chapters 1-5 that contain sections and subsections and equations. The equations were numbered globally, i.e. if I had 3 equations in section 1 of Chap 1, they were numbered 1.1.1, 1.1.2, 1.1.3 and for Section 2, the equations were 1.2.4, 1.2.5, etc. Recently I had to change Chap 1 and everything in it to Chapter I (roman number) and Chap 2 were renumbered to Chap 1, etc.

My problem is that LaTeX started numbering the equations in Chap I (the other chapters did not have this problem) according to the sections and not globally anymore. That is, the 3 equations in Chap I were I.1, I.2, I.3, and the equations in the second section of Chap I became I.1, I.2, etc instead of I.4, I.5, etc

I needed the prefix to be the chapter and not the sections. I don't understand why there is a change. I have never used \numberwithin in my book

Here are some of my codes

\documentclass[]{phstyle}
\usepackage{latexsym,amsfonts,amssymb, undertilde}
\usepackage[fleqn]{amsmath}


for the equation numbering in Chap I

\renewcommand{\thechapter}{\Roman{chapter}}
\renewcommand{\theequation}{\thechapter.\arabic{equation}} **


Previously when Chap I was Chap 1, ** was

\renewcommand{\theequation}{\thesection.\arabic{equation}}


I have also tried the line below but it didn't work

\renewcommand{\theequation}{I.\arabic{equation}}


Thank you in advance

## marked as duplicate by yo', Mensch, Heiko Oberdiek, dustin, Claudio FiandrinoSep 13 '13 at 18:27

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.

• Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. – karlkoeller Sep 13 '13 at 13:37
• Instead of operating directly on \theequation, you could issue the command \numberwithin{equation}{chapter} in the preamble of your document, after the amsmath package has been loaded. (The amsmath package provides the command \numberwithin.) – Mico Sep 13 '13 at 13:45
• Also, perhaps this is your document class. – Ian Thompson Sep 13 '13 at 15:07
• Your MWE works fine if I substitute phstyle with report. There must be a problem with the document class. – karlkoeller Sep 13 '13 at 15:58

## 1 Answer

The problem you're describing seems to be caused by the fact that the phstyle class includes the instructions

\def\theequation{\thesection.\arabic{equation}}
\@addtoreset{equation}{section}


To override this behavior and have the equations numbered by chapter instead, insert the following instructions in the preamble:

\usepackage{chngcntr}
\counterwithout{equation}{section} % undo numbering system provided by phstyle.cls
\counterwithin{equation}{chapter}  % implement desired numbering system

• What a lifesaver! Thanks Mico! I clicked the check sign before I read about the vote up and vote down buttons. Now when I try to vote up, it tells me it needs 15 reputations before it can get upvoted. My upvote didn't get registered. Sorry Mico. – Anne Sep 14 '13 at 1:10
• sorry to once not comply with the comment standards, but you Sir, are awesome. – qrtLs May 30 '16 at 12:01
• @ItsmeJulian - You're most welcome! :-) – Mico May 30 '16 at 14:16