1

There's probably a simple fix for this, but I need the equation numbering to not reset at each section after I call an appendix in revtex4-1. How can I do this?

Here's a minimal (not?) working example:

\documentclass[aps,twocolumn,showpacs,amsmath,amssymb,nofootinbib]{revtex4-1}


\begin{document}

\title{I don't want the equation numbers to change by section after the appendix}

\maketitle

\section{Before appendix}

Here is an equation
\begin{equation}
1+1=2
\end{equation}

And another
\begin{equation}
F=ma
\end{equation}

\section{Just before appendix}

Next...
\begin{equation}
E=mc^2
\end{equation}

\begin{appendix}

\section{An appendix}

La la la...everything is normal here
\begin{equation}
\underset{x\rightarrow0}\lim x=0
\end{equation}

\end{appendix}


\section{After appendix}

Here is an equation
\begin{equation}
1+1=2
\end{equation}

And another
\begin{equation}
F=ma
\end{equation}

\section{I wanted (3)!}

Next...
\begin{equation}
E=mc^2
\end{equation}

\end{document}
Thomas
  • 13
  • 1
    Welcome to tex.sx. Off topic: it's not necessary to use \underset with \lim. This should work: \lim_{x\to 0}. (Similar to \sum, lower limits are input as subscripts, but set underneath in a display environment.) – barbara beeton Nov 03 '19 at 02:09

1 Answers1

1

Welcome! The problem is that in the appendix the equation counter gets reset at the start of a new section. According to this answer one way to go is to load chngcntr and then add

\counterwithout{equation}{section}
\addtocounter{equation}{-1}

after \end{appendix}.

\documentclass[aps,twocolumn,showpacs,amsmath,amssymb,nofootinbib]{revtex4-1}
\usepackage{chngcntr}

\begin{document}

\title{I don't want the equation numbers to change by section after the appendix}

\maketitle

\section{Before appendix}

Here is an equation
\begin{equation}
1+1=2
\end{equation}

And another
\begin{equation}
F=ma
\end{equation}

\section{Just before appendix}

Next...
\begin{equation}
E=mc^2
\end{equation}

\begin{appendix}

\section{An appendix}

La la la...everything is normal here
\begin{equation}
\underset{x\rightarrow0}\lim x=0
\end{equation}

\end{appendix}
\counterwithout{equation}{section}
\addtocounter{equation}{-1}

\section{After appendix}

Here is an equation
\begin{equation}
1+1=2
\end{equation}

And another
\begin{equation}
F=ma
\end{equation}

\section{I wanted (3)!}

Next...
\begin{equation}
E=mc^2
\end{equation}

\end{document}

enter image description here

Of course, you will still have the issue that equation numbers are not unique. So you may perhaps prefer something like this:

\documentclass[aps,twocolumn,showpacs,amsmath,amssymb,nofootinbib]{revtex4-1}
\usepackage{chngcntr}
\newcounter{lastequationbeforeappendix}
\begin{document}

\title{I don't want the equation numbers to change by section after the appendix}

\maketitle

\section{Before appendix}

Here is an equation
\begin{equation}
1+1=2
\end{equation}

And another
\begin{equation}
F=ma
\end{equation}

\section{Just before appendix}

Next...
\begin{equation}
E=mc^2
\end{equation}

\setcounter{lastequationbeforeappendix}{\number\value{equation}}
\begin{appendix}

\section{An appendix}

La la la...everything is normal here
\begin{equation}
\underset{x\rightarrow0}\lim x=0
\end{equation}

\end{appendix}
\counterwithout{equation}{section}
\setcounter{equation}{\number\value{lastequationbeforeappendix}}

\section{After appendix}

Here is an equation
\begin{equation}
1+1=2
\end{equation}

And another
\begin{equation}
F=ma
\end{equation}

\section{I wanted (3)!}

Next...
\begin{equation}
E=mc^2
\end{equation}

\end{document}

enter image description here