I've tried this
\documentclass{article}
\usepackage{geometry}
\usepackage{changepage}
\usepackage{bophook}
\begin{document}
\AtBeginPage{%
\strictpagecheck
\ifnum\value{page}>1
\ifoddpage
\newgeometry{top=0.5cm, bottom=3cm}
\else
\newgeometry{top=3cm, bottom=0.5cm}
\fi
\else
\fi
}
Test \newpage
Test 2 \newpage
Test 3
\end{document}
but it does not work.
The message error is
Improper \prevdepth. \newpage ...everypar {}\fi \par \ifdim \prevdepth
>\z@ \vskip -\ifdim \prevd...
Is there a better way to do?
Why
I have a document in landscape "style" and I want the top margin to be 2cm on odd pages and 1cm on even pages, and the inverse for bottom margins.
\AtBeginPage
hook, the page has already been built, and all the hook does, is let you add things like a background image to it. In particular, it is way too late to change the layout with\newgeometry
. Due to the asynchronous nature of TeX, switching page geometry the middle is rather tricky anyhow. If all you want to do, is to shift the entire page up or down, with headers and footers and all such things, there is hope, though. Is that what you want to accomplish?