3

I have a document in 'portrait' format, and would like to include short sections in 'landscape' format.

The geometry package works nicely, but only allows me to insert one such section. The second call to \newgeometry fails to orient the page to landscape format. I have tried \savegeometry and \loadgeometry to no avail.

Is there any way to use the geometry package for multiple 'landscape' sections? Is there an alternative?

Thanks!

\documentclass{book}
\usepackage[a4paper,hmargin=3cm,vmargin=5cm]{geometry}
\usepackage{lscape,lipsum}
\usepackage{etoolbox}

\makeatletter
\def\ifGm@preamble#1{\@firstofone}
\appto\restoregeometry{%
  \pdfpagewidth=\paperwidth
  \pdfpageheight=\paperheight}
\apptocmd\newgeometry{%
  \pdfpagewidth=\paperwidth
  \pdfpageheight=\paperheight}{}{}
\makeatother

\begin{document}

\chapter{One}
\lipsum[1]

\newgeometry{,hmargin=3cm,vmargin=5cm,landscape}  
\section{One One}
\lipsum[1]

\restoregeometry
\chapter{Two}
\lipsum[6]

\newgeometry{,hmargin=3cm,vmargin=5cm,landscape}
\section{Two One}
\lipsum[3-5]

\restoregeometry
\section{Two Two}
\lipsum[6]

\end{document}

1 Answers1

2

You can use the pdflscape package together with \newgeomety.

\usepackage[a4paper,hmargin=3cm,vmargin=5cm]{geometry}
\usepackage{pdflscape,lipsum}
\usepackage{etoolbox}


\begin{document}

\chapter{One}
\lipsum[1]

\newgeometry{,vmargin=3cm,hmargin=5cm} 
\begin{landscape}
 \section{One One}
\lipsum[1]
\end{landscape}
\restoregeometry

\chapter{Two}
\lipsum[6]

\newgeometry{,vmargin=3cm,hmargin=5cm}
\begin{landscape}
\section{Two One}
\lipsum[3-5]
\end{landscape}
\restoregeometry
\section{Two Two}
\lipsum[6]

\end{document}
John Kormylo
  • 79,712
  • 3
  • 50
  • 120
  • Although this works, this does not change the location of the page numbers – Murmel Mar 12 '19 at 08:56
  • 1
    @Murmel - I take it you want to move and rotate the page number. That is covered elsewhere. See https://tex.stackexchange.com/questions/278113/single-landscape-page-with-page-number-at-the-bottom – John Kormylo Mar 12 '19 at 15:03
  • I will definitely have a look at it, but I only wanted to emphasize the difference between your solution and the MWE of @Alex Lehmann – Murmel Mar 12 '19 at 16:03