# How to avoid the geometry package to change to top/bottom margins?

For my master thesis, i need to print recto verso with margins 4cm and 1 cm (left and right). So I use the following package:

\usepackage[inner=4cm,outer=1cm]{geometry}


However, this increases my bottom margin (with about 1 cm i'm guessing) which ruins my entire document. How can I avoid this package to influence the other margins (when i don't even define them explicitly)?

• Specify also the bottom margin you want. – Bernard May 22 '15 at 9:20
• @Bernard How can i find out how large my initial margin was? (i use the a4wide package and I'm not defining a margin anywhere) – Tiemen De Winter May 22 '15 at 9:21
• Using a4wide is one of the ‘mortal sins’ of LaTeX users described in l2tabu. They advise to simply use the a4paper option, and if needed use geometry. What happened to your bottom margin? – Bernard May 22 '15 at 9:42
• When i dont use the geometry package yet i measure (by putting a ruler on my screen) a bottom margin of about 3.1cm. When i apply this with the package on the print 2-sided, the margin changes. I tried manually 2.5, 2.6, .7, 2.8,...,3.2 cm but none of them work. I have put everything in the good position of this initial unknown margin (i guess it must be some american standard which is why i can't get it right..) – Tiemen De Winter May 22 '15 at 9:54
• Well set bottom=3.1cm in the options for geometry. Anyway, the default is the same for basic latex for all paper formats, and they're adapted to Letter paper, not A4 paper. As far as i know a4wide doesn't touch vertical margins. Another solution would be to specify margins values according to European standard layouts. – Bernard May 22 '15 at 10:07

If I run this sample document

\documentclass{book}
\usepackage[a4paper,pass,verbose]{geometry}

\usepackage{lipsum}

\begin{document}
\lipsum
\end{document}


I get, in the log file and on the console, the relevant lengths:

* \textheight=550.0pt
* \topmargin=22.0pt


Rounding \headsep is irrelevant, so I'll use 18pt:

\documentclass{book}
\usepackage[a4paper,verbose]{geometry}
\geometry{
inner=4cm,outer=1cm,
textheight=550pt,
}

\usepackage{lipsum}

\begin{document}
\lipsum
\end{document}


This prints

* \textheight=550.0pt
* \topmargin=22.0pt


which agrees with the standard setup.

With \documentclass[11pt,a4paper]{book} (the twoside and openright options are on by default), the values obtained in the first step are

* \textheight=595.80026pt
* \topmargin=24.0pt


so the change should be

\documentclass[11pt]{book}
\usepackage[a4paper,verbose]{geometry}
\geometry{
inner=4cm,outer=1cm,
textheight=595.80026pt,
}
\usepackage{lipsum}

\begin{document}
\lipsum
\end{document}


with this setup I get as output

* \textheight=595.80026pt
* \topmargin=24.0pt


Note that, in any case, LaTeX just looks at the values of \topmargin, \headheight, \headsep and \textheight; the bottom margin is whatever remains.

This is the output I get for the first page with the new settings

and this is the output without loading geometry

• I'm sorry but I don't understand on how to interpret this... What is the default bottom margin? – Tiemen De Winter May 22 '15 at 10:59
• I don't think there is... I'm using a4wide though, maybe that's messing some things up? Is there any way i could easily show you my main file? – Tiemen De Winter May 22 '15 at 13:18
• @TiemenDeWinter Of course that's the culprit: the a4wide package is obsolete and deprecated. It should never be used, even more if you want to set the page parameters yourself with geometry. – egreg May 22 '15 at 13:19
• So is there any easy way I could fix this? :/ So that i can change the margins while using the a4wide package without messing my entire layout up? And i also don't understand how my vertical margins are changing by using a4wide or geometry... even when i turn a4wide off and change the margins with your code, the bottom margin increases) – Tiemen De Winter May 22 '15 at 13:22
• @TiemenDeWinter Remove the call to a4wide, it's as easy as this. Why would you continue to use something that just does damages? You're asking how to do contradictory actions. (Please, remove the obsolete comments.) – egreg May 22 '15 at 13:26

From here, you can do it manually

\addtolength{\oddsidemargin}{-.875in}



Note that this has to be added to the preamble.

• But isnt this the same as the geometry package? And the issue that i do not know the default value on which i 'calibrated' my entire document remains.... – Tiemen De Winter May 22 '15 at 10:44

As far as I know, geometry doesn't allow changing some but not all margins, so you must manually get the right height. The best way get exactly the right height is to set the height, not the margins.

If you put \the\textheight somewhere in your document without using the geometry package it will output the default textheight (for your setup this seems to be 595.80026pt). Then you can use textheight=595.80026pt as an argument to geometry to get the same height of the text, which will allow the same amount of text on each page. Note that

1. The top and bottom margin may still have changed. Set one of them (e.g. bottom=3.1cm) to get the same appearance.
2. If the textwidth changes when you change the margins then this may ruin the whole document anyway. This is harder to fix, but perhaps you can set textwidth the same way and make the margins approximately 1 and 4 cm. Otherwise you can try to change the textheight to at least fit about the same amount of text on each page.
• Is there some way to extract the bottom margin the same way you extracted the textheight? Once i know that value I can define it in my geometry and I'm saved. I tried the textheight of 595... that you specified but there is still to much margin at the bottom (my 177p document turns into 195 pages :( ) Thank you so much for your assistance by the way, I greatly appreciate it! – Tiemen De Winter May 22 '15 at 11:44
• Unfortunally not, as everything is measured from the top left corner. (Well, you could take \pageheight and subtract everything mentioned in the Wikibook.) – Jonas Granholm May 22 '15 at 12:00
• If the bottom margin gets bigger then presumably the top margin gets smaller by the same amount (see my point 1). – Jonas Granholm May 22 '15 at 12:01
• This is indeed the case. Could you tell me what i should add within my geometry next to textheight=595.80026pt (for headheight and top margin etc) to get my initial bottom margin? – Tiemen De Winter May 22 '15 at 12:10
• If you initially had a bottom margin of 3.1 cm, then adding bottom=3.1cm should do the trick. – Jonas Granholm May 22 '15 at 14:46