TransWikia.com

Strange problem using landscape, afterpage and split

TeX - LaTeX Asked by CarlJacobi on December 9, 2020

I have a problem in Latex where afterpage somehow seems to have problems with a split equation, so that the code does not compile. I use afterpage to fill a page before a large landscape figure is presented, to avoid the whitespace that is produced otherwise.
This is the MWE (comment out the afterpage command and it will compile):

documentclass[a4paper]{scrbook}
usepackage{amsmath, amssymb}
usepackage{graphicx}
usepackage{pdflscape}
usepackage{afterpage}
usepackage{lipsum}


begin{document}
lipsum[1-2][1-20]
afterpage{
begin{landscape}
begin{figure}
includegraphics[width=textwidth]{example-image-a}
caption{Caption}
end{figure}
end{landscape}}
lipsum[1-5]
begin{equation}
begin{split}
x&=frac{pi}{2}
&=frac{3}{2}
end{split}
end{equation}
lipsum[1-2]
end{document}

One Answer

An easy solution is to separate the equation from the preceding paragraph. This solution puts the equation inside a splitable paragraph, but the spacing on the first and last lines are slightly off.

documentclass[a4paper]{scrbook}
usepackage{amsmath, amssymb}
usepackage{graphicx}
usepackage{pdflscape}
usepackage{afterpage}
usepackage{lipsum}

newsavebox{tempbox}

begin{document}
lipsum[1-2]
afterpage{%
begin{landscape}
begin{figure}
centering
includegraphics[width=textheight]{example-image-a}
caption{Caption}
end{figure}
end{landscape}}
lipsum[1-3]

setboxtempbox=vbox{strut
Text in pragraph before equation.
Text in pragraph before equation.
Text in pragraph before equation.
Text in pragraph before equation.
Text in pragraph before equation.
Text in pragraph before equation.
Text in pragraph before equation.
begin{equation}
begin{split}
x&=frac{pi}{2}
&=frac{3}{2}
end{split}
end{equation}
Text in same paragraph after equation.
}unvboxtempbox
lipsum[1-2]
end{document}

Answered by John Kormylo on December 9, 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