# Equal left and right margins in documentclass book

How do I ensure that, using the documentclass book, my left and right page margins are equal?

I can't use oneside as a class option, because it mangles my headers, and I can't use the geometry package.

I tried

\setlength{\oddsidemargin}{15.5pt}
\setlength{\evensidemargin}{15.5pt}


(found here: https://en.wikibooks.org/wiki/LaTeX/Page_Layout#Odd_and_even_margins), but that did not at all lead to equally sized margins.

There must be a simple way to do this!

• Something like \addtolength\oddsidemargin{1cm} \addtolength\evensidemargin{-.5cm} will get you closer... – Steven B. Segletes Oct 5 '16 at 15:33
• by "left and right page margins are equal" do you mean margins on left hand pages are equal to those on the right (which the code that you show will do) or do you mean that on each page the margin to the left of the text is equal to the margin on the right of the text? – David Carlisle Oct 5 '16 at 15:38
• @David Carlisle: I mean the latter: on each page, the left and right margins should be equal. – rdv Oct 5 '16 at 15:45
• Then the space in the middle (sum of the inner margins) is twice as large as the outer margin for two-side layout, typical for a book. – Heiko Oberdiek Oct 5 '16 at 15:59

You don't say why you can't use geometry which allows you to specify the margins directly, so makes this easier, but latex does not directly specify the right margin, you can specify the left margin, and the text width and the right margin is just whatever space is left over.

So assuming you don't want to change \textwidth or \paperwidth you want the left and right margins to be half the difference between those, and then you want to set \@oddsidemargin to be 1in less than that (as by default the origin is 1in in from the top left corner).

so

\setlength\oddsidemargin{\dimexpr(\paperwidth-\textwidth)/2 - 1in\relax}
\setlength\evensidemargin{\oddsidemargin}


Note that this assumes that \paperwidth is set correctly for your paper (a4paper or usletter options typically) and that the pdf media size has been set to the paper size (loading graphicx, or geometry or hyperref would do that) or set

\pdfpageheight=\paperheight
\pdfpagewidth=\paperwidth


or in newer luatex the same but without pdf in the command names.

• Excellent, that did the trick. I remember trying something similar a while ago and giving up. I'm glad I asked again - answer accepted! – rdv Oct 5 '16 at 20:57