jerichoblog

linux and windows tips, mathematics, and some recipes

Saturday, February 25, 2006

Simple Margin Adjustment in LaTeX

LaTeX enforces beauty upon its documents, sometimes to the detriment of practicality. By default, LaTeX margins are extremely generous. This leads to good-looking documents, but there are occasions when it may be better to have smaller margins —— for instance, if you want a document to fit entirely within one page.

Page layout with LaTeX is a complicated matter. A cursory glance at the LaTeX documentation shows that the layout is determined by 11 different parameters. However, I find that the following commands are sufficient for most purposes:

\addtolength{\textwidth}{ain}
\addtolength{\hoffset}{-bin}
\addtolength{\textheight}{cin}
\addtolength{\voffset}{-cin}

where a, b, c are numerical quantities such that a=2b. The effect of these commands is to increase the extent of the horizontal material by a inches and increase the extent of the vertical material by c inches.

If you want more control over your margins, then I highly recommend the LaTeX geometry package. The author of the geometry package is careful to ensure that all page settings are correctly assigned, leaving a straightforward interface to the user. As a simple example, add the following to your preamble:

\usepackage[hmargin=3cm,vmargin=3.5cm]{geometry}

This sets the left and right margins to be 3cm and the top and bottom margins to be 3.5cm. Full details are set out in section 5.3 of the geometry user manual.

29 Comments:

  • At 11:17 am, Anonymous Anonymous said…

    Cheers mate

     
  • At 4:48 pm, Anonymous Anonymous said…

    Thanks for explaining this, and including the example of the geometry package.

     
  • At 11:26 am, Anonymous Anonymous said…

    this was very helpfull

     
  • At 9:24 am, Blogger Teja said…

    That a very useful post. Thanks!

     
  • At 5:53 am, Anonymous Dark Sun said…

    Thumbs up from Dark Sun. Probably saved me hours.

     
  • At 8:28 pm, Anonymous T. said…

    Thanks, very useful post!

     
  • At 12:19 am, Blogger Srinivasa said…

    Thanks for the post!
    Question: What if you want to set different margins on the left and right sides? Thanks in advance!

     
  • At 5:33 pm, Blogger Andy Wilson said…

    very helpful -
    I had a lot of errors using all of the options individually, but the {geometry} options made everything really simple. Now it doensn't look like I'm trying to weasel out of page requirements;)

     
  • At 4:58 am, Anonymous Anonymous said…

    God bless your soul!

     
  • At 11:21 am, Anonymous Anonymous said…

    kudos MATE....that was really helpful :) :P :D

     
  • At 3:19 pm, Blogger steph said…

    Really useful, if you want to set up margins in latex come here mate, you won't regret it.

    Bravo, c'est du bon travail mon gars.

     
  • At 10:38 pm, Anonymous Anonymous said…

    Thanks for the helpful post!

     
  • At 12:54 pm, Anonymous Anonymous said…

    Thanks! This post gave me straight-forward and fast help on an otherwise complex topic. THANKS ALOT!

     
  • At 10:44 pm, Anonymous Anonymous said…

    What if you want to change the margin midstream in the text of the document? For example, how can you produce a wide margin in the textual part of a book for margin notes and graphical material, but then small margins at each chapter end where a multicolumn problem set could be displayed?

     
  • At 9:51 pm, Anonymous Anonymous said…

    well that got me out of a jam. thanks!

     
  • At 4:01 pm, Anonymous Anonymous said…

    Cheers, using the geometry package took me only 5 seconds.

     
  • At 2:24 pm, Anonymous Anonymous said…

    nice! this is way easier than what i've been doing. thanks for the tip.

     
  • At 6:16 pm, Blogger proteus said…

    I also have been enormously helped by this useful information. Thank you for posting it --Donald

     
  • At 12:39 am, Blogger Sziri said…

    thx very helpful indeed :)

     
  • At 2:28 am, Anonymous Anonymous said…

    SUPER HELPFUL! :D thanks! - roy, Philippines

     
  • At 10:48 am, Anonymous Anonymous said…

    Thank You

     
  • At 10:14 pm, Anonymous Anonymous said…

    Simple. Awesome.

     
  • At 11:31 am, Anonymous Anonymous said…

    thank you very much

     
  • At 4:13 pm, Anonymous Dan Schroeder said…

    Thank you! (From someone who's used plain TeX for 25 years and is utterly bewildered by LaTeX.)

     
  • At 1:14 pm, Anonymous Anonymous said…

    Thanks a lot for fullpage package!

     
  • At 2:52 pm, Blogger obeshankar said…

    Thanks for helping me fix the margins on an old style document.

     
  • At 10:49 am, Anonymous Anonymous said…

    Thanks a lot & good work, it was very helpfull.

     
  • At 1:56 pm, Anonymous shashindra said…

    Thanks bro.

     
  • At 9:59 am, Anonymous Anonymous said…

    Thanks a lot!

     

Post a Comment

<< Home