Rotating PDF pages without rotating the contents in LaTeX, is tricky to find information on. The goal is to get the page on the left, to render in landscape mode as the page on the right. This is purely about how pages are rendered in PDF viewers.
Searching for landscape pages or landscape orientation leads to the "Landscape in LaTeX" post on texblog.org, which talks about the packages lscape
and pdflscape
. However, using lscape
rotates the page contents (as seen on the left), while pdflscape
additionally rotates the PDF page for viewing (as seen on the right).
Only rotating the viewing orientation of PDF pages can be done using pdfpageattr
, by specifying the Rotate
PDF page attribute. Note that the Rotate
attribute affects all consecutive pages, until it is changed again.
% Portrait
\global\pdfpageattr\expandafter{\the\pdfpageattr/Rotate 0}
% Landscape - top of the page on the right
\global\pdfpageattr\expandafter{\the\pdfpageattr/Rotate 90}
% Upside Down Portrait
\global\pdfpageattr\expandafter{\the\pdfpageattr/Rotate 180}
% Landscape - top of the page on the left
\global\pdfpageattr\expandafter{\the\pdfpageattr/Rotate 270}
The rotations only affect how the pages are rendered in a PDF viewer, as can be seen here:
Minimal Working Example
The following example defines a custom pdflandscape
environment, which automatically handles resetting to portrait mode.
\documentclass{article}
\usepackage{rotating} % sideways
\usepackage{graphicx}
\newenvironment{pdflandscape}%
{\clearpage\global\pdfpageattr\expandafter{\the\pdfpageattr/Rotate 90}}%
{\clearpage\global\pdfpageattr\expandafter{\the\pdfpageattr/Rotate 0}}
\begin{document}
\section*{Appendix A}
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis
nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
\begin{figure}[h!]
\centering
\begin{sideways}
\includegraphics[height=6.5cm]{example-image}
\end{sideways}
\end{figure}
\begin{pdflandscape}
\section*{Appendix A}
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis
nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
\begin{figure}[h!]
\centering
\begin{sideways}
\includegraphics[height=6.5cm]{example-image}
\end{sideways}
\end{figure}
\end{pdflandscape}
\end{document}
Excluding the page layout settings, then the above LaTeX results in this: