TransWikia.com

move equations without changing numbering

TeX - LaTeX Asked by jverdyck on December 12, 2020

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}.}
begin{equation} label{eq:a}
A = aaaaaa
end{equation}

lipsum[2]
textbf{First reference of eqref{eq:b}.}
begin{equation} label{eq:b}
B = bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
end{equation}

lipsum[3]
textbf{First reference of eqref{eq:c}.}
begin{equation} label{eq:c}
C = cccccc
end{equation}

lipsum[4]
textbf{First reference of eqref{eq:d}.}
begin{equation} label{eq:d}
D = ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
end{equation}

lipsum[5]
textbf{First reference of eqref{eq:e}.}
begin{equation} label{eq:e}
E = eeeeee
end{equation}

lipsum[6]
textbf{First reference of eqref{eq:f}.}
begin{equation} label{eq:f}
F = fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
end{equation}

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}.}
begin{equation} label{eq:a}
A = aaaaaa
end{equation}

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}.}
begin{equation} label{eq:c}
C = cccccc
end{equation}

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

lipsum[5]
textbf{First reference of eqref{eq:e}.}
begin{equation} label{eq:e}
E = eeeeee
end{equation}

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}.

One Answer

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.

begin{equation}
x' + y^{2} = z_{j}^{2}
end{equation}

begin{equation}
x' + y^{2} = z_{j}^{2}
end{equation}

Some out of sequence equation numbers.

setcounter{equation}{57}
begin{equation}
x' + y^{2} = z_{j}^{2}
end{equation}

setcounter{equation}{-23}
begin{equation}
x' + y^{2} = z_{j}^{2}
end{equation}

begin{equation}
x' + y^{2} = z_{j}^{2}
end{equation}

Now back to picking up the initial regular sequence numbers.

setcounter{equation}{2}
begin{equation}
x' + y^{2} = z_{j}^{2}
end{equation}

begin{equation}
x' + y^{2} = z_{j}^{2}
end{equation}


end{document}

enter image description here

Answered by Peter Wilson on December 12, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP