[Tex/LaTex] Replacing vmargin by geometry

geometrymargins

I'm trying to update a old template. Therefore I want to replace the vmargin package by the geometry package:

Code before:

\setpapersize{A4}
\setmarginsrb{3cm}{1cm}{3cm}{1cm}{6mm}{7mm}{5mm}{15mm}

Code after:

\geometry{a4paper,left=30mm,top=10mm,right=30mm,bottom=10mm,headheight=6mm,headsep=7mm,foot=5mm,footskip=15mm}

However, the margins are not the same. For example, the header line is much higher than before. Is there a way, to get the same margins by using the geometry package?

Thomas

Best Answer

The difference in height is as a result of includeheadfoot. Add this option to your geometry specification.


As an example showcasing the similar output, consider the following code using vmargin:

\documentclass{article}

\usepackage{vmargin,showframe}
\setpapersize{A4}
\setmarginsrb{3cm}{1cm}{3cm}{1cm}{6mm}{7mm}{5mm}{15mm}

\begin{document}

Here is some text.

\end{document}

Assume the output is vmargin_exampe.pdf. Now compile:

enter image description here

\documentclass{article}

\usepackage{geometry,pdfpages}
\geometry{
  a4paper,showframe,
  left=30mm,top=10mm,right=30mm,bottom=10mm,
  headheight=6mm,headsep=7mm,foot=5mm,footskip=15mm,
  includeheadfoot
}
\begin{document}
Here is some text.

\clearpage

\includepdf{vmargin_example}

\end{document}
Related Question