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}
3
  • The modification disables the warning "landscape not allowed in newgeometry". Obviously there is a reason for the warning, other than just being nasty. Commented Sep 28, 2018 at 3:31
  • Maybe tex.stackexchange.com/a/440307/43317 helps.
    – esdd
    Commented Sep 28, 2018 at 11:57
  • Very helpful thanks, the typearea package discussed there is a good option Commented Oct 2, 2018 at 2:40

1 Answer 1

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}
3
  • Although this works, this does not change the location of the page numbers
    – Murmel
    Commented Mar 12, 2019 at 8:56
  • 1
    @Murmel - I take it you want to move and rotate the page number. That is covered elsewhere. See tex.stackexchange.com/questions/278113/… Commented Mar 12, 2019 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
    Commented Mar 12, 2019 at 16:03

You must log in to answer this question.

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