4

Please see the following code. Here, I try to change page margin inside an enumerate environment.

\documentclass{article}

\usepackage[a4paper,top=115.0mm,bottom=65.0mm,left=40.0mm,right=25.0mm]{geometry}

\usepackage{lipsum}

\begin{document}

\begin{enumerate}
\item\lipsum[1]

\item\lipsum[2]

\item\lipsum[3]

  \newgeometry{top=25.0mm,bottom=25.0mm}

\item\lipsum[4]

\end{enumerate}

\end{document}

However, the page margins do not change in the second page. If the same thing is tried without an enumerate environment, it works perfectly well.

What is it I could be missing and how can I correct this?

7

Although it's not explicit in the docs, \newgeometry is designed to be used at the 'top level' of a document, outside of any environments (it carries out local assigments). That is realistically to be expected: changing page geometry should be very rare and usually between distinct document parts. If you add more items you'll notice the list 'thinks' the page is longer than it is as a result.

It is possible to force the definitions set up by \newgeometry to apply globally using the TeX primitive \globaldefs

\documentclass{article}

\usepackage[a4paper,top=115.0mm,bottom=65.0mm,left=40.0mm,right=25.0mm]{geometry}

\usepackage{lipsum}

\begin{document}

\begin{enumerate}
\item\lipsum[1]

\item\lipsum[2]

\item\lipsum[3]

\globaldefs=1
\newgeometry{top=25.0mm,bottom=25.0mm}
\globaldefs=0

\item\lipsum[4]

\end{enumerate}

\end{document}

However, this may cause unexpected effects as the code inside geometry is not designed for this. Use at your own risk!

  • While I agree with your statement, "changing page geometry should be very rare and usually between distinct document parts", the depicted scenario actually happened in a document I am preparing. Thanks anyway, it has allowed me to learn about \globaldefs as well. – Masroor Jan 9 '15 at 13:06
  • Can't upvote too much this answer. This kind of things really happen when trying to define high-level structure commands. Thanks! – Alberto Aug 26 '17 at 16:21

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.