0

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.

4
  • I think your approach is doomed to failure. For example, at the execution of the \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? Sep 8, 2018 at 6:49
  • I will ask another question. Thanks for your interest.
    – Colas
    Sep 8, 2018 at 10:29
  • Fair enough. So my answer did not do what you need? Sep 8, 2018 at 12:08
  • I've posted another question, more precise, there: tex.stackexchange.com/q/450006/8323 in case you can cast an eye. Thanks 😊
    – Colas
    Sep 8, 2018 at 14:44

1 Answer 1

1

A possible approach is to apply a different \voffset to each page. Here is one way to achieve that:

\documentclass{article}

\usepackage{bophook}

\begin{document}

\AtBeginPage{%
  \ifodd\count0 \global\voffset=0mm \else \global\voffset=25mm \fi
}

Test \newpage
Test 2 \newpage
Test 3
\end{document}

This moves the entire text block 25 mm down on even pages. Adjust your margins once and for all to achieve the effect you want.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.