291

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

  • 6
    Should the header and footer also be in landscape mode? – user2478 Feb 13 '11 at 16:39
  • 1
    @Herbert: If yes, how to do this? – xport Jun 9 '11 at 23:48
  • 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 '15 at 7:50
307

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.

If you are using pdfLaTeX, you should use pdflscape instead. 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}
  • 21
    The page number appears on the left side of the page with this solution. – carloscinelli Aug 3 '14 at 17:27
  • 5
    nice package, but how do I landscape header and footer? (o.w. they turn out over the landscaped text) – mario Dec 28 '14 at 18:52
  • 4
    Right, but how can I go into landscape mode with rotating page numbers as well? – user2300369 Jan 5 '16 at 15:48
  • 4
    @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 '16 at 21:09
  • This was very helpful, helped me out in many places. One corner-case I ran into was that while using a tcolorbox or posterbox inside a page that was rotated using these instructions ... it left too much margin to the left of my posterbox that I didn't know how to remove. – pulkitsinghal May 28 at 4:59
57

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.

  • 3
    I think this is the only solution that prints correct headers and footers. – mcy Nov 1 '16 at 9:17
14

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.

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

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.

\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

5

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.

2

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}

protected by Community Mar 20 at 11:50

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

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