# Use of \afterpage package causes equation to be inserted into following subequations

I have a very long equation, which cannot be split apart, which I place on a landscape page on its own.

However, when I compile the document, this equation now seems to have been placed inside the subequations environment of two equations further down the text. This leaves me with incorrect numbering. The landscape equation should be equation 1, the next two should be 2 a,b. At the moment I get the landscape equation labelled as 1b, with the two later equations written as 1 a,c.

If I reduce the text above the equation, so move the position on the page, the numbering returns to normal. However, I can't unfortunately just delete paragraphs of text...

MWE follows. (The lipsum and seemingly random lines are required to get the equations and text in the right part of the page to see this problem.)

\documentclass[12pt]{ociamthesis}
\usepackage{amsmath, pdflscape,afterpage,hyperref,lipsum}

\begin{document}
\lipsum[1-3]
The long equation is first referenced here. \par
\vspace*{\fill}
\afterpage{
\clearpage
\begin{landscape}
\vspace*{\fill}
$$\label{sf:1} y = {a \over b} .$$
\vspace*{\fill}
\end{landscape}
\clearpage}

A \\
couple \\
more \\
lines \\

\section{Discussion}
\lipsum[2]

\begin{subequations}
\label{sf:2}
$$\label{sf:2a} y = {x\over 2}$$
$$\label{sf:2b} y = {2x \over 3}$$
\end{subequations}
\end{document}


Any ideas on how to return the correct equation numbering?

• The short answer is to use a savebox. – John Kormylo Oct 23 '15 at 18:32
• Why using afterpage? Simple mak a \clearpage before and after that extreme equation. – Johannes_B Oct 23 '15 at 18:38
• if in doubt don't use afterpage! (although in this case I can't really guess what afterpage is intended to do, it appears do be doing exactly what it is designed to do, move its content out of sequence to the later page). – David Carlisle Oct 23 '15 at 20:21
• If I use clearpage then the rest of the page is skipped, so I get a big blank space and then the equation. As the absolute position of the equation doesn't matter, I'd rather the text flowed around it. – JoeyCrossy Oct 26 '15 at 11:06
• Afterpage does move it out of sequence which is fine but it inserts it into lower subequations, which is not as the numbering is wrong. – JoeyCrossy Oct 26 '15 at 11:07

I couldn't find ociamthesis.cls so used article instead. Do not reuse \tempbox until the next page.

\documentclass[12pt]{article}
\usepackage{amsmath, pdflscape,afterpage,hyperref,lipsum}

\newsavebox{\tempbox}

\begin{document}
\lipsum[1-3]
The long equation is first referenced here. \par
\savebox{\tempbox}{\begin{minipage}{\textheight}
$$\label{sf:1} y = {a \over b} .$$%
\end{minipage}}
\vspace*{\fill}
\afterpage{
\clearpage
\begin{landscape}
\thispagestyle{empty}% just a suggestion
\vspace*{\fill}%
\noindent\usebox{\tempbox}\par
\vspace*{\fill}
\end{landscape}
\clearpage}

A \\
couple \\
more \\
lines \\

\section{Discussion}
\lipsum[2]

\begin{subequations}
\label{sf:2}
$$\label{sf:2a} y = {x\over 2}$$
$$\label{sf:2b} y = {2x \over 3}$$
\end{subequations}
\end{document}

• Thank you, this works! (The document class for the thesis is based off memoir, thought this seems like it will work for all classes.) – JoeyCrossy Oct 26 '15 at 11:18