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.
\ifdim\textwidth=\textwidthis always true ? – David Carlisle Oct 28 '22 at 16:19\ifdim\textwidth=\textwidthlooks quite senseless. – Ulrike Fischer Oct 28 '22 at 20:33