Using \restoregeometry in environment, next page runs off the page bottom
You're using a group too many and don't restore properly the geometry, as the \restoregeometry
command is issued when LaTeX is still processing the environment, which forms a group:
\newenvironment{quotepage}[1]
{\newpage
\newgeometry{margin=0pt}
\thispagestyle{empty}
\centering
\vspace*{\fill}\vspace{-\baselineskip}
\begin{minipage}{#1}
\setlength{\parskip}{0.6\baselineskip}
\setlength{\parindent}{0pt}
}
{\end{minipage}
\vfill
\clearpage
\aftergroup\restoregeometry
}
You may want to look at other solutions, for example TikZ provides the ability to put nodes at the physical page center.
\usepackage{tikz}
\newsavebox{\quotepagebox}
\newenvironment{quotepage}[1]
{\begin{lrbox}{\quotepagebox}\begin{minipage}{#1}
\setlength{\parskip}{0.6\baselineskip}
\setlength{\parindent}{0pt}}
{\end{minipage}\end{lrbox}%
\clearpage\thispagestyle{empty}
\begin{tikzpicture}[remember picture,overlay]
\node at (current page.center) {\usebox{\quotepagebox}};
\end{tikzpicture}
\clearpage}
As egreg
said, \restoregeometry
must be executed outside the environment.
You can use the \AfterEndEnvironment
-hook from the etoolbox
package for that.
From the etoolbox
documentation:
\AfterEndEnvironment{environment}{code}
Appends arbitrary
code
to a hook executed at a very late point by the\end
command, after the group holding the environment has been closed.
MWE:
\documentclass[a6paper,landscape]{article}
\usepackage{etoolbox}
\usepackage[showframe]{geometry}
\usepackage{lipsum}
\newenvironment{myenv}{Hello!}{Bye!}
\BeforeBeginEnvironment{myenv}{\newgeometry{left=5mm,right=5mm,top=5mm,bottom=5mm}}
\AfterEndEnvironment{myenv}{\restoregeometry}
\begin{document}
\lipsum[1]
\begin{myenv}
Test
\end{myenv}
\lipsum[2-3]
\end{document}
Output: