433

How can I change the orientation of some pages of my document into landscape mode, while leaving the others in portrait mode (or vice versa)?

2
  • 7
    Should the header and footer also be in landscape mode?
    – user2478
    Feb 13, 2011 at 16:39
  • 3
    The lscape and the rotating packages do not work together with the watermark package. fancyhdr cfoot size is not changing when the page is rotated. \textwidth is not changed when the page is rotated. Etc. So rotating is not a good solution. There should be a way to switch between landscape and portrait mode - at least PDF allows that so there should be a way to do it when the output is rendered as PDF. Anybody knows the correct answer?
    – nagylzs
    Apr 30, 2015 at 7:50

6 Answers 6

452

If you are using pdfLaTeX or LuaLaTeX, then try pdflscape. The pdflscape package adds PDF support to the landscape environment of package lscape, by setting the PDF/Rotate page attribute. Pages with this attribute will be displayed in landscape orientation by conforming PDF viewers:

\usepackage{pdflscape}
...
\begin{landscape}
...
\end{landscape}

Otherwise, if you don't use a PDF engine, try the lscape package:

% lscape.sty Produce landscape pages in a (mainly) portrait document.
\usepackage{lscape}
...
\begin{landscape}
...
\end{landscape}

This modifies the margins and rotates the page contents but not the page number. Useful, for example, with large multipage tables, and is compatible with the packages longtable and supertabular.

7
  • 37
    The page number appears on the left side of the page with this solution. Aug 3, 2014 at 17:27
  • 10
    nice package, but how do I landscape header and footer? (o.w. they turn out over the landscaped text)
    – mario
    Dec 28, 2014 at 18:52
  • 6
    Right, but how can I go into landscape mode with rotating page numbers as well? Jan 5, 2016 at 15:48
  • 9
    @carloscinelli , this is the intention as when binding the pages physically together the page numbers need to be at the same place (bottom). The 'lscape' package is not able to fix this, see this thread for a solution: tex.stackexchange.com/questions/9071/…
    – Tom
    Mar 15, 2016 at 21:09
  • 5
    This page rotates the content in the page to landscape, not the page itself
    – Viesturs
    Oct 5, 2020 at 8:43
79

The lscape package has problems with doublesided documents!

The landscape pages of even pagenumbers (on the left side of the document) should be upside down from the ones of the odd pagenumbers (on the right side of the document).

To solve this problem in doublesided documents use package rotating:

\usepackage{rotating}
...
\begin{sidewaysfigure}
...
\end{sidewaysfigure}

It rotates the figures with respect to the page numbering. It also supports manual rotation with \begin{sideways} (90 degree counter-clockwise) and \begin{turn}{30} (30 degree rotation).

I found the solution here.

1
  • 9
    I think this is the only solution that prints correct headers and footers.
    – mcy
    Nov 1, 2016 at 9:17
29

There is a nice & simple solution based on the package typearea of the Koma-Scripts (inspired in this answer). You just need to add the following commands block, wherever you want to change the page orientation.

\newpage
\KOMAoptions{paper={portrait or landscape},pagesize}
\recalctypearea

The best of all is that the page number remains vertically at the bottom (it does not rotate with the page) and also the footnotes are gently preserved. See, below, the minimal working example:

\documentclass{article}
\usepackage[paper=portrait,pagesize]{typearea}

\begin{document}
\section{This is my Portrait Page}

\newpage
\KOMAoptions{paper=landscape,pagesize}
\recalctypearea
\section{This is my Landscape Page}
Text in my landscape section\footnote{Footnote in Landscape}

\newpage
\KOMAoptions{paper=portrait,pagesize}
\recalctypearea
\section{This is again Portrait Page}

\end{document}

enter image description here

1
  • This works for me when using pdflatex/xelatex on Arch and pdflatex on Windows; however, it does not appear to work when using xelatex on Windows (MiKTeX 20.11).
    – jdknight
    Feb 19, 2021 at 17:59
20

Found a much better solution that works with PDF files only. Use the pdflscape package instead of the lscape package. This will rotate the page inside the PDF too so it looks good. However, it still does not change \textwidth and other things. Interferes with other packages, so for example instead of \SetWatermarkAngle{19} you will have to manually set \SetWatermarkAngle{109} on landscape (in reality: rotated) pages.

2
  • 4
    rcs already said that in his answer 5 years older than yours. :)
    – gvgramazio
    May 8, 2018 at 15:33
  • 4
    Unless I'm missing something, rcs didn't mention the gotchas with \textwidth and e.g. watermark angles. I found this answer useful. Jun 22, 2019 at 11:48
16

I landed on this page because I had a table that was too wide to be displayed on a portrait page. The problem with lscape or pdflscape for me is that they break the page at the exact location where the landscape page begins. That's not what I wanted. Instead, I used the answer here: Landscape figure in LaTeX

The rotating package offers two environments:

  • \begin{sidewaystable} ... \end{sidewaystable}
  • \begin{sidewaysfigure} ... \end{sidewaysfigure}

If your table or figure is large enough, you also get a landscape page. The difference is that the page break will be at a natural point in your document, rather than exactly where you defined it (which may look ugly).

Note that this package is also compatible with twoside documents:

If the ‘twoside’ option has been given to the main document class (either explicitly, or implicitly as in the default for book class), the package will rotate sideways figures according to the page number (this requires at least two passes through LATEX).

For more details, see the package on CTAN.

5

This is what worked for me. Define a fancy page before your document begins and then call that fancy page when you need landscape. Originally provided by template from UTK graduate school.

\usepackage{pdflscape}
\usepackage{fancyhdr} 

\fancypagestyle{mylandscape}{
\fancyhf{} %Clears the header/footer
\fancyfoot{% Footer
\makebox[\textwidth][r]{% Right
  \rlap{\hspace{.75cm}% Push out of margin by \footskip
    \smash{% Remove vertical height
      \raisebox{4.87in}{% Raise vertically
        \rotatebox{90}{\thepage}}}}}}% Rotate counter-clockwise
\renewcommand{\headrulewidth}{0pt}% No header rule
\renewcommand{\footrulewidth}{0pt}% No footer rule
}

%%%% Now the actual Document %%%%
\begin{document}

% When you need landscape page do this
\begin{landscape}
\thispagestyle{mylandscape} %Call our predefined page type

% Put your figure, table, whatever, here
\begin{figure}[h]  
\centering
\includegraphics[width=9in]{The wide angle...}
\caption{This view is too wide for a portrait page.}
\label{fig:wide-pic}
\end{figure}

%End lanscape to go back to portrait
\end{landscape}
\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .