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.

2

0

Browse other questions tagged .