# move equations without changing numbering

## Short description:

The order of appearance of the equations in the text of my document is different from the order of appearance of the equations in my tex-document. Normally, the equation numbering follows the order of appearance in the tex-document. However, I want the numbering to follow the order of appearance in the text. How can I change my equation numbers such that they match the order of appearance in the text?

## Detailed description:

My document has several very long equations, which are wider than the allowed text width of the document. These long equations appear at multiple locations throughout the document, as in the following example (MWE1).

\documentclass[a4paper]{article}
\usepackage{amsmath}
\usepackage{lipsum}
\usepackage{lscape}

\begin{document}

\lipsum[1]
\textbf{First reference of \eqref{eq:a}.}
$$\label{eq:a} A = aaaaaa$$

\lipsum[2]
\textbf{First reference of \eqref{eq:b}.}
$$\label{eq:b} B = bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb$$

\lipsum[3]
\textbf{First reference of \eqref{eq:c}.}
$$\label{eq:c} C = cccccc$$

\lipsum[4]
\textbf{First reference of \eqref{eq:d}.}
$$\label{eq:d} D = ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd$$

\lipsum[5]
\textbf{First reference of \eqref{eq:e}.}
$$\label{eq:e} E = eeeeee$$

\lipsum[6]
\textbf{First reference of \eqref{eq:f}.}
$$\label{eq:f} F = fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff$$

\end{document}


My preferred solution to this problem is to put all the long equations together on a single landscape page, as in the following example (MWE2).

\documentclass[a4paper]{article}
\usepackage{amsmath}
\usepackage{lipsum}
\usepackage{lscape}

\begin{document}

\lipsum[1]
\textbf{First reference of \eqref{eq:a}.}
$$\label{eq:a} A = aaaaaa$$

\lipsum[2]
\textbf{First reference of \eqref{eq:b}.}
\begin{landscape}
\begin{align}
B &= bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
\label{eq:b}
\\[40mm]
D &= ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
\label{eq:d}
\\[40mm]
F &= fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
\label{eq:f}
\end{align}
\end{landscape}

\lipsum[3]
\textbf{First reference of \eqref{eq:c}.}
$$\label{eq:c} C = cccccc$$

\lipsum[4]
\textbf{First reference of \eqref{eq:d}.}

\lipsum[5]
\textbf{First reference of \eqref{eq:e}.}
$$\label{eq:e} E = eeeeee$$

\lipsum[6]
\textbf{First reference of \eqref{eq:f}.}
\end{document}


This however changes the equation numbering, such that it no longer agrees with the equations' order of appearance in the text.

Q: How can the equation numbers in MWE2 be changed, such that they are again as they were in MWE1? I am unable to come up with a solution that avoids hard-coding the equation numbers of the long equations using \tag{nb}.

• Do you mean that the three equations in the landscape page should be numbered as (2), (4) and (6)? Oct 30 '20 at 12:30
• Exactly. And I'd like the other equations to be numbered as (1), (3), and (5). Oct 30 '20 at 12:52
• Just to be sure: you do know that your readers will hate you, do you? ;-) Oct 30 '20 at 12:55
• I'm not counting on having too many readers ;-) Oct 30 '20 at 13:00
• Other suggestions to solve my 'core problem' of having too long equations are of course welcome as well. But I'd be very interested in answers to my specific question about how to renumber my equations. Oct 30 '20 at 13:02

Here's a possible implementation. At the point where you'd insert the long equation, you write \sethere{<label>} and the equation will use \taghere{<label>} instead of \label.

\documentclass[a4paper]{article}
\usepackage{amsmath}
\usepackage{lipsum}
\usepackage{pdflscape}

\newcommand{\sethere}[1]{\refstepcounter{equation}\label{#1}}
\newcommand{\taghere}[1]{\tag{\ref{#1}}}

\begin{document}

Note for the reader: some long equation appear on the
dedicated page~\pageref{longequations}

\lipsum[1]
\textbf{First reference of \eqref{eq:a}.}
$$\label{eq:a} A = aaaaaa$$

\lipsum[2]
\textbf{First reference of \eqref{eq:b}.}\sethere{eq:b}
\begin{landscape}\label{longequations}
\begin{align}
B &= bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
\taghere{eq:b}
\\[40mm]
D &= ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
\taghere{eq:d}
\\[40mm]
F &= fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
\taghere{eq:f}
\end{align}
\end{landscape}

\lipsum[3]
\textbf{First reference of \eqref{eq:c}.}
$$\label{eq:c} C = cccccc$$

\lipsum[4]
\textbf{First reference of \eqref{eq:d}.}\sethere{eq:d}

\lipsum[5]
\textbf{First reference of \eqref{eq:e}.}
$$\label{eq:e} E = eeeeee$$

\lipsum[6]
\textbf{First reference of \eqref{eq:f}.}\sethere{eq:f}
\end{document}


Probably it's better to set the long equations at end, but it's your decision.

You can use \setcounter{equation}{<new>} to specify that the next equation will be numbered <new> + 1.

% eqnumprob.tex  SE 568922
\documentclass[a5paper]{article}
\begin{document}
\pagestyle{empty}

Regular sequential equation numbers.

$$x' + y^{2} = z_{j}^{2}$$

$$x' + y^{2} = z_{j}^{2}$$

Some out of sequence equation numbers.

\setcounter{equation}{57}
$$x' + y^{2} = z_{j}^{2}$$

\setcounter{equation}{-23}
$$x' + y^{2} = z_{j}^{2}$$

$$x' + y^{2} = z_{j}^{2}$$

Now back to picking up the initial regular sequence numbers.

\setcounter{equation}{2}
$$x' + y^{2} = z_{j}^{2}$$

$$x' + y^{2} = z_{j}^{2}$$

\end{document}


If you only care about how it looks printed: Use \refstepcounter{equation} right before where you first refer to them, and then \tag the equation with the label.

If you use \hyperref this will however be a very bad idea.

\documentclass[a4paper]{article}
\usepackage{amsmath}
\usepackage{lipsum}
\usepackage{lscape}

\begin{document}

\lipsum[1]
\textbf{First reference of \eqref{eq:a}.}
$$\label{eq:a} A = aaaaaa$$

\lipsum[2]
\refstepcounter{equation}
\label{eq:b}
\textbf{First reference of \eqref{eq:b}.}
\begin{landscape}
\begin{align}
B &= bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
\tag{\ref{eq:b}}
\\[40mm]
D &= ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
\tag{\ref{eq:d}}
\\[40mm]
F &= fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
\tag{\ref{eq:f}}
\end{align}
\end{landscape}

\lipsum[3]
\textbf{First reference of \eqref{eq:c}.}
$$\label{eq:c} C = cccccc$$

\lipsum[4]
\refstepcounter{equation}
\label{eq:d}
\textbf{First reference of \eqref{eq:d}.}

\lipsum[5]
\textbf{First reference of \eqref{eq:e}.}
$$\label{eq:e} E = eeeeee$$

\lipsum[6]
\refstepcounter{equation}
\label{eq:f}
\textbf{First reference of \eqref{eq:f}.}
\end{document}