0

The minimal working example below demonstrates a wrong placement of the page number on the first page after the appearance of the environment myenv. How can this be prevented?

\documentclass{scrartcl}

\usepackage[top=0.2in, left=0.8in, right=0.8in, bottom=0.5in, includeheadfoot]{geometry} \usepackage{scrlayer-scrpage}

\newenvironment{myenv}{ \newgeometry{top=0in, left=0.8in, right=0.8in, bottom=0.8in, includehead} \cfoot{} \rofoot{Page~\thepage} }{ % \recalctypearea% doesn't seem to be respected \restoregeometry % \pagestyle{empty}% doesn't seem to be respected either }

\begin{document} \begin{myenv} This is a page from the environment myenv, all fine here. \end{myenv} \clearpage See the wrong placement of the page number at the bottom of this page. \clearpage This page is all fine again. \end{document}

You see that two lines in the example are commented out. If you include them, they have no effect on the problem. The reason I included them is that the first was mentioned here as a solution to this problem (but doesn't work in my case). The second one also doesn't seem to work.

  • 1
    Probably the same question as https://tex.stackexchange.com/questions/40501/using-restoregeometry-in-environment-next-page-runs-off-the-page-bottom?rq=1 ? – Willie Wong Feb 10 '22 at 17:37
  • Thanks, Willie, I searched quite a bit but didn't spot that. Indeed, the solution with \aftergroup before \restoregeometry worked. – Marius Hofert Feb 10 '22 at 17:51

0 Answers0