# Remove white space before landscape

I am inserting a landscape figure.

\begin{landscape}
\begin{figure}
\centering
\includegraphics[width=\linewidth]{figures/sensor_diffs.jpg}
\caption{Example of a single rep in which sensors are fused together to create a reaction time algorithm}
\label{fig:sensor_diffs}
\end{figure}

\begin{figure}
\centering
\includegraphics[width=\linewidth]{figures/sensor_diffs2.jpg}
\caption{Another example of a single rep in which sensors are fused together to create a reaction time algorithm}
\label{fig:sensor_diffs2}
\end{figure}
\end{landscape}


However, the page before the figure produces lots of white space at the end. There is plenty of text in same section after the figure, however it doesn't seem to be adjusting it properly.

Any ideas?

In addition, I have this issue in several places through the document so any sort of global solution would be ideal.

You can use afterpage package for this so that the figures are typeset after filling the current page.

\documentclass{article}
\usepackage{pdflscape}
\usepackage{graphicx}
\usepackage{afterpage}
\usepackage{lipsum}
\begin{document}
\lipsum[1-2]
\afterpage{%         <--------------like this
\begin{landscape}
\begin{figure}
\centering
\includegraphics[width=\linewidth]{example-image}
\caption{Example of a single rep in which sensors are fused together to create a reaction time algorithm}
\label{fig:sensor_diffs}
\end{figure}

\begin{figure}
\centering
\includegraphics[width=\linewidth]{example-image-a}
\caption{Another example of a single rep in which sensors are fused together to create a reaction time algorithm}
\label{fig:sensor_diffs2}
\end{figure}
\end{landscape}
}
\lipsum
\end{document}


• Sweet this appears to have fixed my issues,. I need to drop to over several more of my figures, but looks like it was the fix. Apr 19, 2015 at 2:45
• @FrankSposaro: No easy automatic solutions for this though.
– user11232
Apr 19, 2015 at 2:46
• Thanks this works perfectly ! Feb 10, 2021 at 12:05

I suggest you load the rotating package and its sidewaysfigure environment, which is a "floating environment" in LaTeX jargon. In contrast, the landscape environment is not a floating environment, and that's why you're getting the immediate page break when \begin{landscape} is encountered.

Observe also that (i) it's possible to have several images, each with its own \caption and \label statements, in a single sidewaysfigure environment, and (ii) the \centering instructions don't do anything (and may thus be omitted) since the widths of graphs are set to \linewidth.

\documentclass{article}
\usepackage[demo]{graphicx}   % omit 'demo' option in real document
\usepackage{rotating}   % for 'sidewaysfigure' environment
\usepackage{lipsum}     % for filler text

\begin{document}

\lipsum[1-2]   % filler text

A cross-reference to Figures \ref{fig:sensor_diffs} and \ref{fig:sensor_diffs2}.

\begin{sidewaysfigure}   % this will show up on page 2

\includegraphics[width=\linewidth]{figures/sensor_diffs.jpg}
\caption{Example of a single rep in which sensors are fused together to create a reaction time algorithm}
\label{fig:sensor_diffs}

\vspace{2cm}  % get some vertical separation

\includegraphics[width=\linewidth]{figures/sensor_diffs2.jpg}
\caption{Another example of a single rep in which sensors are fused together to create a reaction time algorithm}
\label{fig:sensor_diffs2}

\end{sidewaysfigure}

\lipsum[3-7]   % more filler text, continued on page 1 and then on page 3
\end{document}

• This is also a really good solution. I will keep this in mind if I start to run into problems with afterpage. Apr 19, 2015 at 2:49
• @Mico How to rotate the page like landcsape Aug 25, 2017 at 14:53
• @DanielValencia - I'm afraid I'm not sure I understand your query/comment. Please clarify what you're trying to achieve.
– Mico
Aug 25, 2017 at 14:57
• @Mico Sorry if I wasn't clear. When I use sidewaystable, the resulting pdf document appears with the page with the table in vertical orientation. Using sidewaystable, how can I get the page in the pdf rotated as pdflscape package do? Aug 25, 2017 at 15:03
• @DanielValencia - If you want the page in the pdf file to be rotated, you'll have to use the pdflscape package and the landscape environment. To avoid getting a premature page break, load the afterpage package and use something like \afterpage{\begin{landscape}\begin{table}...\end{table}\end{landscape}}. (Basically, I'm suggesting you use the solution method advocated in the other answer.)
– Mico
Aug 25, 2017 at 15:10