Two-sided LaTeX page margins
- Mar 31, 2011 |
- 8 Comments
Just a quick tip today: how to change the margins of your LaTeX document when the twoside option is enabled. The option for a two-sided document is mostly called within the documentclass as in \documentclass[twoside]{article}.Try to enable it in one of your documents and you’ll notice the difference: the side margins of even pages is different from that of odd pages. Personally, I do not understand this layout since I expect that left margins on odd pages (and right margins on even pages) should be enlarged in order to make space for the bindings.
This post was edited on April 9, 2012; see below
Adjusting the margins
There are plenty of ways to get rid of these margins and I’ll show you my favorite. I chose this above others because this is straight forward and easy to remember. In your preamble, define:
\setlength{\oddsidemargin}{5mm} \setlength{\evensidemargin}{5mm} |
Now you see why this is straight forward? :-)
Advantages of twoside option
Now that we have redefined the margins, the document looks again like when the twoside is not called at all! Then why should you use this option? Well, one big advantage is when you combine this with the fancyhdr package. I’m not going to explain this package, but it might be a good idea to read the package documentation
In the preamble, you can define:
\usepackage{fancyhdr} \pagestyle{fancy} \fancyhead[LE,RO]{\thepage} |
This will print page numbering left (L) on even (E) pages and right (R) on odd (O) pages, which is in my eyes the only right way to print page numbers.
EDIT: Even simpler solution
This part is added to the original post, because I discovered a more simple approach using the geometry package. Here’s what to do:
\documentclass[twoside]{article} \usepackage[hmarginratio=1:1]{geometry} |
The hmarginratio option sets the horizontal margin ratio to 1:1 (default for two sided documents is 2:3). Easy as that!
Nice article! As for the unexpected margins on odd and even pages it’s true bat fixed…
If you afterwards set:
\setlength{\oddsidemargin}{-{somevalue}in} // negative required to produce symmetry
\setlength{\evensidemargin}{{somevalue}in}you configure it to work in the "expected" way.
Cheers!
\usepackage[hmarginratio=1:1]{geometry} works perfectly. Thanks a lot.
Many thanks for the art, it is interesting and compelling. I have found my way here through Google, I am going to return one more time :)
I am very happy to read this. This is the kind of manual that needs to be given and not the random misinformation that is at the other blogs. Appreciate your sharing this best doc.
Awesome information over again! Thank you!
Thanks Will, that’s an interesting link and I didn’t knew that.
mbork, as I wrote in the post there are multiple ways of doing this. I just prefer the method that I described ;-)
Thinking that the inner margin should be larger is a very common misconception. Please see Peter Wilson’s “memdesign” document that comes with the memoir class (type “texdoc memdesign”) or see Wikipedia:
http://en.wikipedia.org/wiki/Book_design#Page_spread
The two text blocks should be evenly spaced between the outer margins of the spread, hence the inner margin is smaller. Binding does not take much room at all; if you need to reserve some space for it, the geometry and memoir and typearea packages all (I think) have options to do this.
Nice, but why don’t we rather use the geometry package?