TransWikia.com

Landscape on a Single Page by Rotating Counterclockwise

TeX - LaTeX Asked by awenborn on February 1, 2021

I’m looking for a solution to rotate pages in my PDF output in the opposite direction to what seems to be the standard for most packages. I have a header and footer on my page and for aesthetic reasons would like the page to rotate to a landscape orientation by turning counterclockwise i.e. the content appears to rotate clockwise and the footer appears on the right hand side.

I’ve tried the pdflscape package, which rotates it in the opposite direction by default and seemingly no option to alter rotation direction:

begin{landscape}
... 
end{landscape}

And I’ve also tried the rotation package, which achieves the layout that I want, but leaves the page in portrait mode when viewing in a PDF viewer:

begin{turn}{-90}
begin{minipage}
... 
end{minipage}
end{turn}

I’d like to keep the header and footer in their "portrait" positions for consistency within the document, as is the case in both of these solutions.

So, is there any way to achieve a landscape pageview in a PDF, whilst simply rotating the page in a counterclockwise direction?

One Answer

This solution creates a new environment: clandscape (counter rotate).

documentclass{article}
usepackage{pdflscape}
usepackage{etoolbox}
usepackage{lipsum}

makeatletter
letclandscape=landscape
letendclandscape=endlandscape
patchcmd{clandscape}{PLS@Rotate{90}}{PLS@Rotate{-90}}{}{}
makeatother

begin{document}
lipsum[1]
begin{clandscape}
lipsum[2]
end{clandscape}
begin{landscape}
lipsum[3]
end{landscape}
end{document}

The actual implementation of landscape is probably handled by the shipout hook, but so far all attempts to modify ShipoutBox have failed.. For single pages one can use rotatebox (adjustbox package) and a minipage.

documentclass{article}
usepackage{pdflscape}
usepackage{etoolbox}
usepackage{lipsum}
usepackage{adjustbox}

makeatletter
letclandscape=landscape
letendclandscape=endlandscape
patchcmd{clandscape}{PLS@Rotate{90}}{PLS@Rotate{-90}}{}{}
makeatother

begin{document}
lipsum[1]
begin{clandscape}
rotatebox{180}{begin{minipage}[t][textheight][t]{linewidth}
lipsum[2]
end{minipage}}% flip page
end{clandscape}
begin{landscape}
lipsum[3]
end{landscape}
end{document}

Answered by John Kormylo on February 1, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP