Written and maintained by CASRAI Editorial Board
Published · Last updated
On this page
Researchers set LaTeX margins when a thesis, journal template or funder form specifies page dimensions. The standard tool is the geometry package: \usepackage[margin=2cm]{geometry} sets a 2 cm margin on every edge. This guide covers that line and the less-documented behaviour around it: how unspecified margins are computed, binding offsets, changing margins mid-document and inspecting the result.
What it is used for in research
Theses commonly require fixed margins and extra space for binding; manuscripts for journals are usually typeset with the publisher’s class file, which fixes the layout. For your own documents, preprints and reports, geometry lets you state the layout in one preamble line instead of adjusting low-level length parameters. See the LaTeX document structure guide for where preamble lines go.
Install or access (official source only)
The package is documented in the manual “The geometry package” by Hideo Umeki (version 6.0, 2026/03/07), published on CTAN at mirrors.ctan.org/macros/latex/contrib/geometry/geometry.pdf. Load it in the preamble with \usepackage{geometry}. If your LaTeX distribution or online editor does not already provide it, install it from CTAN through your distribution’s package manager.
Step-by-step: set margins with geometry
- Set one margin everywhere. Put
\usepackage[margin=2cm]{geometry}in the preamble. The manual’s abstract gives this exact example for a 2 cm margin from each edge of the paper. - Set horizontal and vertical margins separately.
margin={A,B}is equivalent tohmargin=Aandvmargin=B;margin=Aexpands tohmargin=Aandvmargin=A.hmarginis left and right,vmarginis top and bottom. - Set individual sides. Use
left,right,topandbottom(aliaseslmargin,rmargin,tmargin,bmargin;innerandouterfor two-sided layouts). Example:\geometry{a4paper, total={170mm,257mm}, left=20mm, top=20mm}; the right and bottom margins are then computed automatically (Overleaf, “Page size and margins”). - Choose the paper. Options such as
a4paper,letterpaperandlegalpaperselect the size;landscaperotates it, andpapersize={w,h}sets custom dimensions. Example:\geometry{legalpaper, landscape, margin=2in}. - Allow for binding.
bindingoffsetremoves the stated space from the left-hand side of the page (inner side in two-sided mode), which the manual describes as useful for glued, stitched or stapled binding. - Two-sided printing.
twosideswaps left and right margins on verso pages.asymmetricgives a two-sided layout without swapping margins. - Change margins part-way.
\newgeometry{options}starts a new layout, for example for a wide table;\restoregeometryreturns to the preamble layout. The manual notes that\newgeometrydisables all options from\usepackageand\geometryand skips paper-size options such as landscape.\savegeometry{name}and\loadgeometry{name}save and reuse a layout.
Output and how to read it
What happens to margins you did not set
Since version 5, if you give only one margin, the text body is sized with the default scale 0.7 (hscale/vscale) and the other margin is computed from that. Default ratios are 1:1 for hmarginratio in one-sided documents, 2:3 in two-sided ones, and 2:3 for vmarginratio. So left=3cm alone does not produce a matching right margin; set both, or use hmargin.
Check the result
showframedraws the page frames on every page; it needs theatbegshipackage (since version 5.4).verbose=trueprints the computed dimensions to the log.- The
layoutpackage:\usepackage{layout}then\layoutdraws the page layout, and\layout*recalculates it.
Troubleshooting
- One side changed, the other did not match. Unspecified margins are derived from the 0.7 scale and ratios above; state all sides or use
total,width/height. - Landscape ignored after
\newgeometry. The manual says paper-size related options, including landscape and portrait, are skipped there; set orientation in the preamble. showframeerrors. It requiresatbegshi.- Wrong paper size. Overleaf uses A4 by default; add
letterpaperif you need US Letter. - Submission class files. When a publisher’s class sets the layout, follow the journal’s instructions rather than overriding margins; see also the Elsevier LaTeX template guide.
Free alternatives
| Approach | What it does | Source |
|---|---|---|
\usepackage[margin=...]{geometry} |
Keyval interface for margins, paper size and body size | geometry manual v6.0 |
\geometry{...} in the preamble |
Same options set after loading the package | geometry manual v6.0 |
\newgeometry / \restoregeometry |
Temporary layout for part of a document | geometry manual v6.0 |
layout package |
Draws the current page layout so you can inspect it | Overleaf, Page size and margins |
Related typesetting guides: line and paragraph spacing in LaTeX and indentation in LaTeX.
FAQ
How do I set 1-inch margins in LaTeX?
Add \usepackage[margin=1in]{geometry} to the preamble; it is the same form as the manual’s 2 cm example, with a different length.
How do I change margins for one page or section?
Use \newgeometry{...} where the change starts and \restoregeometry where the original layout should return.
Can I leave extra room for binding?
Yes, with the bindingoffset option.
Sources (official documentation)
- Hideo Umeki, “The geometry package”, v6.0, 2026/03/07, CTAN: mirrors.ctan.org/macros/latex/contrib/geometry/geometry.pdf (read 2026-11-08).
- Overleaf documentation, “Page size and margins”: overleaf.com/learn/latex/Page_size_and_margins (read 2026-11-08).







