16

I'm using this code for showing an image in landscape mode:

\begin{landscape}

\begin{figure}[H]
\centering
\includegraphics[width=\hsize]{./images/SelectDVA.png}
\caption{DVA part of the Use Case \ref{sec:use_case_2}.}
\end{figure}

\end{landscape}

This causes the output to have a blank page immediately after the rotated page containing the image.

It seems that using landscape causes a page break, is it true?

How can I prevent this behaviour?

3
  • 1
    landscape won't leave a blank page but it causes a page break. You can use afterpage to avoid the white space produced thereby.
    – user11232
    Nov 27, 2012 at 15:32
  • Never ever include a figure in landscape! Nov 27, 2012 at 15:36
  • 3
    @StephanLehmke Why not?
    – Lucas
    Oct 28, 2014 at 0:40

5 Answers 5

14

landscape will not produce blank pages but cause a page break where it is introduced. This will result in undesired white space in the previous page. This can be avoided by using the afterpage package:

\documentclass{article}
\usepackage{lipsum}
\usepackage{graphicx}
\usepackage{afterpage}
\usepackage{lscape}
\begin{document}
\lipsum[1-2]
\afterpage{
\begin{landscape}

\begin{figure}[H]
\centering
\includegraphics[width=\hsize]{example-image-a}
\caption{DVA part of the Use Case \ref{sec:use_case_2}.}
\end{figure}

\end{landscape}
}
\lipsum[3-8]

\end{document}

If you use pdflscape instead of lscape package,

enter image description here

8
  • can you explain me what is the \lipsum command doing?thks in advance
    – Matteo
    Nov 27, 2012 at 15:59
  • @Matteo It's just filler en.wikipedia.org/wiki/Lipsum Nov 27, 2012 at 16:53
  • 2
    This isn't working for me. I still have a blank page before the landscape figure. The code was used exactly as in the example above, except that I am using package 'pdflscape'.
    – cryptic0
    May 19, 2014 at 11:17
  • @cryptic0 Not working isn't useful enough. This code works for me.
    – user11232
    May 19, 2014 at 22:28
  • 4
    The problem is related to the size of the figure. Even if it fits on one page, it might still result in a blank page. I scaled down the figure gradually until the blank page went away. FYI.
    – cryptic0
    May 21, 2014 at 21:04
11

A blank page can be caused by the figure (or table, etc) within the landscape environment exceeding the dimensions of the page's textwidth or textheight. In this case, we can manually define the page margins with \newgeometry{} and then revert back to the document default with\restoregeometry. For example:

\documentclass{article}
\usepackage{geometry}
\usepackage{lscape}
\begin{document}

% Set some new page margins:
\newgeometry{a4paper,left=1in,right=1in,top=1in,bottom=1in,nohead}
\begin{landscape}
     % figure, etc
\end{landscape}
\restoregeometry % Restore the global document page margins

\end{document}

Or you can do it with \savegeometry{name} and \loadgeometry{name}. See http://texdoc.net/texmf-dist/doc/latex/geometry/geometry.pdf

2
  • 1
    Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format.
    – Pier Paolo
    Jan 18, 2015 at 21:43
  • 6
    Thanks for your comment @PierPaolo. I have read the article countless times, but for the life of me I don't understand which specific policy you and your upvoter believe I have not followed. Please explain.
    – pds
    Apr 3, 2015 at 14:08
7

Have you checked this simple solution? I had a big, page-filling table and the landscape environment caused a blank page before the table. I noticed that the option [H] in \begin{table}[H] caused the blank page. If you use \begin{table}[htbp] instead, the annoying blank page is gone. [H] is useful to place the tables exactly where you position the command, but in conjunction with the landscape environment it is unnecessary.

Example:

\usepackage{lscape}

\begin{document}    
% some text    
\begin{landscape}    
\thispagestyle{empty} %if you want to suppress footer and header    
\begin{table}[htbp]    
...    
\end{table}    
\end{landscape}    
% continue with your text    
\end{document}
2
  • 1
    Welcome to TeX.SX! A tip: If you indent lines by 4 spaces or enclose words in backticks `, they'll be marked as code, as can be seen in my edit. You can also highlight the code and click the "code" button (with "{}" on it).
    – Adam Liter
    Jul 2, 2014 at 1:56
  • To rotate pages with \usepackage{pdflscape} or \usepackage{lscape} in a document generated with bookdown/R markdown, this was the only viable solution that worked for me. I.e., adding fig.pos = 'htbp' to the chunk header of my figure made the obsolete blank white landscape page before the landscape page with the figure magically disappear.
    – mavericks
    Dec 29, 2020 at 12:01
5

Another simple solution is turn 90° the content of a normal float (without [H]) using only normal (portrait) pages:

\documentclass[12pt]{article}
\usepackage{lipsum}
\usepackage{graphicx}
\begin{document}
\lipsum[1-2]
\begin{figure}
\rotatebox{90}{
\begin{minipage}{\textheight}
\includegraphics[width=\linewidth]{example-image-a}
\caption{DVA part of the Use Case.}
\end{minipage}}
\end{figure}
\lipsum[3-7]
\end{document}

MWE

0

I have exactly the same problem as you. I have a landscape environment followed by a figure environment. The landscape environment introduces a blank page between the landscape environment and the figure environment. I solve this issue by accidentally changing \begin{figure} to \begin{figure}[H]. Have no idea why ...... but it works! I got the idea from this post: How to remove a blank page before landscape figure tabular? where they said removing [H] works, but for me adding [H] works.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.