2

Consider the following MWE:

\documentclass{article}

\usepackage{pdflscape}
\usepackage{everypage}

\newcommand*\Lpagenumber{\ifdim\textwidth=\textwidth\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\textwidth}[0pt][0pt]{%
    \rlap{\hspace{\dimexpr \margin+\textheight+\footskip}%
    \llap{\rotatebox{90}{\thepage}}}}%
\egroup\fi}
\AddEverypageHook{\Lpagenumber}%

\begin{document}

\begin{landscape}
Test
\end{landscape}

\end{document}

Question 1

When I compiled this code (or something equivalent) last year, I think it was, the page number was placed nicely a the bottom of the rotated page; now it's placed rotated at the left side of the page, as if the number stays fixed when the page is rotated.

How do I fix this so that the number is placed at the bottom center of the page? (I compile using lualatex if that is of any importance.)

Question 2

I also get the warning

Package everypage Warning: Functionality similar to this package has recently
(everypage)                been implemented in LaTeX. This package is now in
(everypage)                legacy status.
(everypage)                Please, don't use it in new documents and packages.


Package everypage Warning: You appear to be running a version of LaTeX
(everypage)                providing the new functionality.
(everypage)                Doing the best to deliver the original `everypage`
(everypage)                interface on top of it. Strict equivalence is
(everypage)                not possible, breakage may occur.
(everypage)                If truly needed, Use `everypage-1x` to force the
(everypage)                loading of an older code base.

Can I somehow change the code to avoid this warning?

Update

I think that the warning problem can be fixed using the following instead (which I found here):

\documentclass{article}

\usepackage{pdflscape}

\AddToHook{shipout/background}{
\ifdim\textwidth=\textwidth\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\textwidth}[0pt][0pt]{%
    \rlap{\hspace{\dimexpr \margin+\textheight+\footskip}%
    \llap{\rotatebox{90}{\thepage}}}}%
\egroup\fi
}%

\begin{document}

\begin{landscape}
Test
\end{landscape}

\end{document}

P.S. I still don't know how to fix problem 1.

7
  • 1
    well for the second: do what the warning says and no longer use the package. (Look into it to find out how to replace its commands). Commented Oct 28, 2022 at 15:52
  • 1
    \ifdim\textwidth=\textwidth is always true ? Commented Oct 28, 2022 at 16:19
  • 1
    the whole point of (pdf)lscape is to rotate the page body while keeping the page head and foot unrotated Commented Oct 28, 2022 at 16:22
  • @DavidCarlisle Okay, I see. Can you tell me how I can rotate the page but move the page number's position so that it is at the bottom of the page after it has been rotated? At the same time, I would like to have page numbers at the bottom on the pages in that are not rotated in the same document. Commented Oct 28, 2022 at 18:22
  • 1
    well as David wrote: \ifdim\textwidth=\textwidth looks quite senseless. Commented Oct 28, 2022 at 20:33

1 Answer 1

1

You can do something like this. But it is up to you to calculate where exactly the rotated page number should be.

\documentclass{article}

\usepackage{pdflscape,lipsum}

\AddToHook{env/landscape/begin}
 {%
  \clearpage
  \pagestyle{empty}
  \AddToHook{shipout/background}[sven/page]
    {
     \put(0.9\paperwidth,-0.5\paperheight)%adapt values
      {\rotatebox{90}{\thepage}}
    }%
 }     

\AddToHook{env/landscape/after}
 {\RemoveFromHook{shipout/background}[sven/page]}


\begin{document}


\lipsum 

\begin{landscape}
\lipsum 
\end{landscape}

\lipsum 
\end{document}
0

You must log in to answer this question.

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