Changing the margins in LaTeX

Changing the layout of a document's text on the page involves several subtleties not often realised by the beginner. There are interactions between fundamental TeX constraints, constraints related to the design of LaTeX, and good typesetting and design practice, that mean that any change must be very carefully considered, both to ensure that it "works" and to ensure that the result is pleasing to the eye.

Lamport's warning to beginners in his section on 'Customizing the Style' - "don't do it" - needs to be taken seriously. One-inch margins on A4 paper are fine for 10- or 12-pitch typewriters, but not for 10pt (or even 11pt or 12pt) type because readers find such wide, dense, lines difficult to read: there should ideally be no more than 75 characters per line (though the constraints change for two-column text).

The 'ultimate' tool for adjusting the dimensions and position of the printed material on the page is the geometry package; a very wide range of adjustments of the layout may be relatively straightforwardly programmed, and package documentation is good and comprehensive.

Somewhat simpler to use is the vmargin package, which has a canned set of paper sizes (a superset of that provided in LaTeX2e), provision for custom paper, margin adjustments and provision for two-sided printing.

LaTeX controls the page layout with a number of parameters, which allow you to change the distance from the edges of a page to the left and top edges of your typeset text, the width and height of the text, and the placement of other text on the page. However, they are somewhat complex, and it is easy to get their interrelationships wrong when redefining the page layout. The layout package defines a \layout command which draws a diagram of your existing page layout, with the dimensions (but not their interrelationships) shown. This FAQ recommends that you use a package to establish consistent settings of the parameters: the interrelationships are taken care of in the established packages, without you needing to think about them.

If you're still eager to "do it yourself", start by familiarising yourself with LaTeX's page layout parameters. For example, see section C.5.3 of the LaTeX manual (pp. 181-182), or corresponding sections in many of the other good LaTeX manuals (see LaTeX books).

The text height and width, \textheight and \textwidth, require more care than you might expect: the height should be set to fit an integral number of text lines, and the width should be constrained by the number of characters per line, as mentioned above.

Margins are controlled by three parameters. The pair \oddsidemargin and \evensidemargin are so-called because it is conventionally taken that odd-numbered pages appear on the right-hand side of a two-page spread ('recto') and even-numbered pages on the left-hand side ('verso'). Both parameters refer to the left-hand margin; the right-hand margin is specified by implication, from the size of \textwidth and the width of the paper. The "origin" (the zero position) on the page is one inch from the top of the paper and one inch from the left side; positive horizontal measurements extend right across the page, and positive vertical measurements extend down the page. Thus, the parameters \evensidemargin, \oddsidemargin and \topmargin, should be set to be 1 inch less than the true margin; for margins closer to the left and top edges of the page than 1 inch, the margin parameters must be set to negative values.

Another surprise is that you cannot change the width or height of the text within the document, simply by modifying the text size parameters. The simple rule is that the parameters should only be changed in the preamble of the document, i.e., before the \begin{document} statement. To adjust text width within a document we define an environment:

\newenvironment{changemargin}[2]{%
  \begin{list}{}{%
    \setlength{\topsep}{0pt}%
    \setlength{\leftmargin}{#1}%
    \setlength{\rightmargin}{#2}%
    \setlength{\listparindent}{\parindent}%
    \setlength{\itemindent}{\parindent}%
    \setlength{\parsep}{\parskip}%
  }%
  \item[]}{\end{list}}
This environment takes two arguments, and will indent the left and right margins, respectively, by the parameters' values. Negative values will cause the margins to be narrowed, so \begin{changemargin}{-1cm}{-1cm} narrows the left and right margins by 1cm.

The chngpage package provides ready-built commands to do the above; it includes provision for changing the shifts applied to your text according to whether you're on an odd or an even page of a two-sided document. The package's documentation (in the file itself) suggests a strategy for changing text dimensions between pages - as mentioned above, changing the text dimensions within the body of a page may lead to unpredictable results.

chngpage.sty
macros/latex/contrib/misc/chngpage.sty
geometry.sty
macros/latex/contrib/geometry (zip, browse)
layout.sty
Distributed as part of macros/latex/required/tools (zip, browse)
vmargin.sty
macros/latex/contrib/vmargin (zip, browse)

This question on the Web: http://www.tex.ac.uk/cgi-bin/texfaq2html?label=changemargin