[Tex/LaTex] single landscape page with page number at the bottom

landscapepage-numbering

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?

Best Answer

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.