9

This question has already been asked (How to change certain pages into landscape/portrait mode), but as a comment says, the given solution puts the page number on one of the side at with a 90° rotation:

\usepackage{pdflscape}
...
\begin{landscape}
...
\end{landscape}

I would think this might be logical if you actually print the stuff, since then you would stack it in with the portrait pages and this way you will have the page number on the same physical location, but it is quite confusing when viewing on the monitor. Is there a way to place the page number at the bottom of the page?

6

The hard way to do it would be to use:

\documentclass{article}
\usepackage{pdflscape}
\usepackage{everypage}
\usepackage{lipsum}

\newcommand{\Lpagenumber}{\ifdim\textwidth=\linewidth\else\bgroup
  \dimendef\margin=0 %use \margin instead of \dimen0
  \ifodd\value{page}\margin=\oddsidemargin
  \else\margin=\evensidemargin
  \fi
  \raisebox{\dimexpr -\topmargin-\headheight-\headsep-0.5\linewidth}[0pt][0pt]{%
    \rlap{\hspace{\dimexpr \margin+\textheight+\footskip}%
    \llap{\rotatebox{90}{\thepage}}}}%
\egroup\fi}
\AddEverypageHook{\Lpagenumber}%

\begin{document}
\begin{landscape}
\pagestyle{empty}%
\lipsum[1]
\newpage
\noindent\rule{\linewidth}{\textheight}% fill text area
\end{landscape}
\pagestyle{plain}%
\lipsum[2]
\end{document}

Then again, this will also work for multiple pages.

Note that the page hook runs after the page of formatted but before the page number is incremented. At this point the "cursor" is located 1in below and 1in to the right of the upper left corner, and must not be moved.

6
  • 2
    Why is the "hard way" better than the "easy"? – fbence Nov 14 '15 at 8:44
  • It isn't. But it can easily be adapted to handle multiple pages. All you need is to use \AddEverypageHook and add a switch to turn it on and off. – John Kormylo Nov 14 '15 at 14:27
  • thanks:) just to flesh out the answer: how would that be done? – fbence Nov 14 '15 at 17:24
  • This test will fail if the text area is perfectly square. Then again, why bother doing a square in landscape? – John Kormylo Nov 14 '15 at 18:28
  • What part of the code accomplishes the task? It's not clear to me. Can you add comments to the code? Thanks! – tommy.carstensen Feb 26 '18 at 16:25
10

easiest way would be to use

\begin{landscape}
\thispagestyle{empty}

....
\vfill
\raisebox{-??}{\makebox[\linewidth]{\thepage}}
\end{landscape}

adjusting the raisebox amount to position it "by eye" into the space normally used for the left margin.

Note \thepage here is "safe" as landscape forces a pagebreak with \clearpage so you do not have the usual problem about references to page numbers not being known within the document.

3

For isolated pages needing the "landscaped page number" at the bottom, I like the idea from David Carlisle's approach, but couldn't get it to work. (The \raisebox didn't seem to have an effect for me, seems the shifts are absorbed by the \vfill.) Here's what I defined to get that idea to work:

\def\fillandplacepagenumber{%
 \par\pagestyle{empty}%
 \vbox to 0pt{\vss}\vfill
 \vbox to 0pt{\baselineskip0pt
   \hbox to\linewidth{\hss}%
   \baselineskip\footskip
   \hbox to\linewidth{%
     \hfil\thepage\hfil}\vss}}

Using that definition, one can now place a "landscaped page number" as follows:

% Preamble needs: \usepackage{pdflscape}
\begin{landscape}
  Landscape content.
  \fillandplacepagenumber
\end{landscape}

For several landscape pages in a row, one can just repeat separate copies of the block shown above, or the following also works:

% Preamble needs: \usepackage{pdflscape}
\begin{landscape}
  Landscape content.
  \fillandplacepagenumber
\newpage
  More landscape content.
  \fillandplacepagenumber
\end{landscape}

Possibly an easy fix to David Carlisle's \raisebox approach exists and thus would be a simpler (and more LaTeX-like) solution than the messy \fillandplacepagenumber shown here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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