How to change the margins of a LaTeX document?


We can change the margins of a LaTeX document fine-tuning different lengths that are defined inside the system. In this tutorial, however, we will see how to more conveniently change the margins and other page-related lengths using the geometry package.

Geometry package: simple method for customizing page layout

Geometry packageOpens in a new tab., written by Hideo Umeki, provides a flexible and easy interface to page dimensions. It lets you change the page layout with intuitive parameters, that are passed as optional arguments when including the package. Basically, when you call the package inside your document you make a declaration of the following style:

\usepackage[key=val]{geometry}

where key=val is a list of keys and values separated by commas, every value being a valid TeX dimension, and every key is one of the following:

1. textwidth

Sets the width that the text will take up on the page.

2. textheight

Sets the height that the text will take up on the page.

3. left, lmargin, inner

These three parameters change the length of the left margin.

4. right, rmargin, outer

These three parameters change the length of the right margin.

5. top, tmargin

These two parameters determine the height of the top margin.

6. bottom, bmargin

These two parameters set the distance from the bottom edge of the document to its baseline.

7. headheight

Determines the height of the header.

8. headsep

Determines the separation between the baseline of the head and the text body.

9. footnotesep

This option corresponds to the separation between the baseline of the last line of text and the top of the footnote text.

10. footskip

This corresponds to the distance separation between the baseline of the last line of text and the baseline of the footer.

11. marginparwidth,marginpar

These two parameters determine the width of the right margin left for notes.

12. papersize

Determines the size of the paper. This parameter, unlike the previous ones, has to be set to a couple of TeX dimensions separated with a comma, and between braces, for example:

papersize= {597pt,845pt}

With all of this, you should be able to fully customize the blank space left in the pages of your document. If this is not good enough for you, or maybe you want to look for some predefined page geometries and sizes, you can always look up the documentation for the geometry packageOpens in a new tab..

We reached the end of this short tutorial, If you have any remarks or suggestions, please feel free to reach us via email at admin@latex-tutorial.comOpens in a new tab.

Recent Posts