Setting Margin in LaTeX

It is surprisingly not easy to correctly set the margin in LaTeX, and it’s worse if you actually have to adhere to a given specification like:

The total allowable width of the text area is 6.5 inches wide by 8.75 inches high. The top margin on each page should be 1.2 inches from the top edge of the page. The left margin should be 0.9 inch from the left edge. The footer with page number should be at the bottom of the text area.

The above specification may look familiar to some people. Indeed, I copied it from the documentation of the geometry package by Hideo Umeki. :P

I don’t know why, but it seems that many people have managed to avoid running into this fantastic and easy-to-use package. The package is sort of new, in the sense that it didn’t make its way into the first edition of The LaTeX Companion. (But this must-have book is already in its second edition… Yes, go buy a copy if you haven’t.) And somehow it also doesn’t get described in the 133-minute May 2005 version of The Not So Short Introduction to LaTeX2e. (In fact, TNSSI doesn’t have a complete solution to setting margin… Anyway.)

Let’s start with a simple case first. Suppose you want your document to have an one-inch margin on letter paper in portrait. This case is extremely common.

\usepackage[dvips,letterpaper,margin=1in]{geometry}

Now sometimes you may need to squeeze an 0.1 inch from one of the sides. In that case, you can specify lmargin, rmargin, tmargin and bmargin individually.

To switch to landscape, just add the landscape option. The package will even automatically correct for the landscape swapping problem in ghostscript viewers.

And if you happen to be using pdflatex, you can still leave dvips as one of the option. The package will automatically override.

The package manual documents a lot more options. Dig it up if you need something more sophisticated. There is probably an easy way to do it with geometry.

P.S. There is also the vmargin package, but it is a bit more complicated to use than geometry. It was the solution in the first edition of The LaTeX Companion.

P.P.S. To get the above specification, the manual of geometry suggests:

\usepackage[total={6.5in,8.75in}, top=1.2in, left=0.9in, includefoot]{geometry}

  1. Thank you. My forehead was bloody from banging it against the wall.

  2. Thank you for this insight.
    It guided me to modify the margin spacing in my latex document!

  3. Thanks a lot. I was spending a lot of time to figure out how to modify the margin. This doc helped a lot :-)

  4. Thanks for this. It’s been doing my head in!

  5. Thank you for the tip.
    I only reduce the margin in order to save paper when printing drafts. I do not recommend using it for a final paper since you are basically pretending you know more design than the very crafted people from TeX+LaTeX!
    I finally use this:
    \usepackage[margin=0.5in]{geometry}

Leave a Comment


NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>