LaTeX guide · geometry package

LaTeX margins for a thesis with the geometry package

To set LaTeX margins, load the geometry package in the preamble and give it all four values from your university's guide: \usepackage[a4paper, left=35mm, right=25mm, top=25mm, bottom=25mm]{geometry}. For the same margin on every side, margin=25mm sets all four at once.

By André Antão Published 10 min read
The short answer
  1. Find the paper size and the four margins in your university's thesis guide, and note whether the left margin already includes space for binding.
  2. In the preamble (before \begin{document}), add \usepackage[a4paper, left=35mm, right=25mm, top=25mm, bottom=25mm]{geometry} with your own values.
  3. Add showframe to the options and compile. The geometry package then draws the text area on the page so you can check it.
  4. Remove showframe and compile again before you submit.

01Set the margins with geometry

The geometry package is a LaTeX package that sets the paper size, the margins and the size of the text area from a few readable options. Its manual (geometry 6.0, CTAN) describes each margin as the distance from that edge of the paper to the text area, so left=35mm means 35 mm of white space between the left edge of the page and the start of every line.

Load it once, in the preamble, with the options in square brackets. Overleaf's page on page size and margins shows the same two forms: options passed to \usepackage, or the same options given to \geometry{…} after loading the package with no options.

main.tex (preamble)
\documentclass[12pt,a4paper]{report}

% Option 1: everything in one line
\usepackage[left=35mm, right=25mm, top=25mm, bottom=25mm]{geometry}

% Option 2: the same, as a separate command
% \usepackage{geometry}
% \geometry{left=35mm, right=25mm, top=25mm, bottom=25mm}

The options that matter for thesis margins are few. The package accepts any TeX unit, so use the unit your guide uses: mm, cm, in or pt (1 in = 25.4 mm = 72.27 pt).

geometry options for thesis margins
OptionWhat it setsExample
left, right, top, bottomOne margin each. In two-sided documents, left is the inner margin and right the outer.left=35mm
marginAll four margins at once.margin=1in
hmargin, vmarginLeft and right, or top and bottom, as a pair.hmargin={35mm,25mm}
bindingoffsetExtra space added to the left (or inner) margin for binding.bindingoffset=10mm
a4paper, letterpaperThe paper size the margins are measured on.a4paper
includefootCounts the footer (and its page number) as part of the text area, so the bottom margin is measured to the page number.includefoot
showframeDraws the text area and page frame, for checking only.showframe
Figure 1The geometry options a thesis needs, with their meaning as given in the geometry manual and Overleaf's documentation. Separate the options with commas.
Always give all four margins

The geometry package fills in any margin you leave out with its own calculation, and the result is rarely what your guide wants. The geometry manual says top=2.4cm on its own gives a 6.51 cm bottom margin on A4; when I compiled it (geometry 5.9, TeX Live 2025) the bottom margin came out at 3.56 cm and the side margins at 31.5 mm. Neither is what a thesis guide asks for. Write all four, or use margin=.

02Worked example: thesis margins on A4

A thesis margin setup in LaTeX is one geometry line that copies the guide's numbers exactly. Suppose the guide for my fictional thesis, Brand trust and customer loyalty in subscription services, asks for A4 paper, a 35 mm left margin for binding, 25 mm on the other three sides, and the page number centred at the foot of the page. The preamble then reads:

main.tex
\documentclass[12pt,a4paper]{report}
\usepackage[
  left=35mm,   % binding edge
  right=25mm,
  top=25mm,
  bottom=25mm
]{geometry}

\begin{document}
...
  1. Put a4paper in the \documentclass options, so the class and geometry both work on A4. Without a paper option, the standard classes assume US Letter (LaTeX2e reference manual, Document class options).
  2. Load geometry after \documentclass and before \begin{document}. One line per option, with a comment, makes the values easy to check against the guide later.
  3. Compile. On Overleaf, click Recompile. On your own computer, run pdflatex main.tex or latexmk -pdf main.tex.
Figure 2The worked example compiled on A4: 35 mm on the left for binding and 25 mm on the right, top and bottom, which leaves a text area of 150 × 247 mm (dashed). The page number sits below the text area, inside the bottom margin, about 14.5 mm above the bottom edge.

The package works out the text area itself: 210 mm − 35 − 25 = 150 mm wide, and 297 mm − 25 − 25 = 247 mm high. I compiled this preamble in TeX Live 2025 and geometry's log reported exactly those widths (section 06 shows how to read it). The rest of the setup, from the document class to the chapter files, is in my guide to writing a thesis in LaTeX.

Template set to last year's guide, and three weeks to go?I can set it up to the current rules

03Where the page number sits: footskip and includefoot

By default, LaTeX puts the page number in the white space of the bottom margin, below the text area, not inside the text area. The geometry package measures the bottom margin to the end of the text area, and the footer with the page number goes below that, at a distance called footskip: the space from the last line of text to the footer's baseline. In the report class footskip is 30 pt, about 10.5 mm (LaTeX2e reference manual, Page layout parameters).

So with bottom=25mm, the page number lands about 14.5 mm above the bottom edge of the paper. The default is right when your guide gives margins for the text only and says nothing about where the page number goes. Some guides say nothing, not even the page number, may sit in the margin, or that the page number must be at least a set distance from the edge. For those, add includefoot: geometry then counts the footer as part of the text area, so the page number sits at 25 mm and the text stops about 10.5 mm higher.

Figure 3The same page with bottom=25mm. Default: the text area ends 25 mm from the bottom edge and the page number sits about 14.5 mm from the edge, in the margin. With includefoot: the page number sits at 25 mm and the text area ends about 10.5 mm above it.

To move the number without touching the margins, change footskip, for example footskip=15mm in the geometry options. Where the number goes (bottom centre, top right) and how roman numerals switch to arabic at Chapter 1 belong to the page style, which my guide to LaTeX page numbers covers.

04Binding margin: bindingoffset, oneside and twoside

A binding margin is extra space on the edge of the page that goes into the spine, so no text disappears when the thesis is bound. In LaTeX, there are two equivalent ways to set it: a wider left margin, or the normal margins plus bindingoffset, which the geometry manual says adds the given length to the left (or inner) margin.

These two preambles give the same page. I compiled both, and both put the text 35 mm from the left edge with a 150 mm text width:

  • left=35mm, right=25mm, top=25mm, bottom=25mm
  • margin=25mm, bindingoffset=10mm

Use one method, never both. Read your guide carefully here: if it says "left margin 35 mm (including binding)", write left=35mm and no offset. If it says "25 mm margins plus 10 mm for binding", use the offset.

Printed on one side or both?

The twoside option tells LaTeX the thesis is printed on both sides of the paper, so the binding edge alternates: left on odd pages, right on even pages. The book class is two-sided by default; report and article are one-sided (LaTeX2e reference manual). With twoside, geometry treats left as the inner margin and swaps it on even pages.

Figure 4Pages 12 and 13 with margin=25mm, bindingoffset=10mm (binding strip shaded). One-sided: the text area sits 35 mm from the left edge on every page. Two-sided: the 35 mm moves to the spine side, so on even pages it is on the right.
One-sided and two-sided margin layouts in geometry
LayoutHow to get itWide margin on even pagesUse it when
One-sidedreport or article (default), or onesideLeftPDF submission, or printing on one side
Two-sidedbook (default), or twosideRight (the inner edge)Printing on both sides and binding
Asymmetricgeometry's asymmetric optionMargins not swapped; binding offset still isRarely needed in a thesis
Figure 5How the three layouts treat the margins, as described in the geometry manual (twoside, asymmetric and bindingoffset options) and the LaTeX2e reference manual (class defaults).

A trap I see in templates: twoside in the class options while the guide asks for single-sided printing. The text then jumps sideways between pages: with a wide inner margin, as in this guide's setup, it sits further left on even pages, and with the class defaults (a narrow inner margin, as in Overleaf's thesis series) it sits further right. Either way, it surprises people who expect every page to look the same. If the thesis is printed on one side or submitted only as a PDF, remove twoside.

05Change the margins for one page

To change the margins for one page in LaTeX, such as a title page with different spacing, use \newgeometry{…} before it and \restoregeometry after it. The geometry manual says both commands start a new page, that \newgeometry drops every geometry option given in the preamble, binding offset included, and that it cannot change the paper size or orientation.

main.tex
\begin{document}

\newgeometry{margin=25mm}    % title page only
\begin{titlepage}
  ...
\end{titlepage}
\restoregeometry             % back to the preamble margins

\pagenumbering{roman}
...

Because \newgeometry forgets the preamble options, repeat any that still apply on that page, such as bindingoffset. For a table or figure too wide for the page, the usual answer is a landscape page rather than narrower margins; the pdflscape package makes such pages display in landscape in PDF viewers: load \usepackage{pdflscape} and put the table inside \begin{landscape}…\end{landscape}. My guide to long tables in LaTeX covers wide and multi-page tables.

06Check the margins before you submit

The quickest margin check in LaTeX is geometry's showframe option, which draws the text area, the page frame and the header and footer lines on the page. Add it, compile, look at a few pages in the PDF, then remove it. For exact numbers, add verbose: geometry then prints its results to the terminal (it writes them to the .log file in any case).

On your own computer, open main.log next to the PDF; on Overleaf, open the raw compile log. Search for *geometry*. The output is in points, and the last line gives the conversion. If you used bindingoffset, L shows the margin without it: the offset is on its own bindingoffset line, so add the two (71.13 pt + 28.45 pt = 99.58 pt, or 35 mm).

Figure 6The geometry log for the worked example, compiled in TeX Live 2025. L, W and R are the left margin, text width and right margin: 99.58 pt = 35 mm, 426.79 pt = 150 mm and 71.13 pt = 25 mm. T, H and B are the top margin, text height and bottom margin.

Two more checks before submission. In the PDF reader's document properties, the page size should read A4 (210 × 297 mm) or Letter (8.5 × 11 in), whichever your guide sets. And if you print a copy, print at 100% scale: shrinking to fit the printer's page makes every margin wider than you set.

The layout package can also draw a diagram of the current layout with \layout, as Overleaf's margins page shows; it is useful when you need to see header and margin-note lengths as well.

07LaTeX margins not changing? Fixes

When LaTeX margins don't change, the geometry line is usually being overridden, never read, or measured on the wrong paper. In LaTeX theses that reach me, the most common cause is a template whose class file already loads geometry, plus a second \usepackage[...]{geometry} in the preamble that clashes with it. Check the causes below in order and recompile after each.

"Option clash for package geometry"

The package was loaded twice with different options, often once by the class or template and once by you. I reproduced the error by loading it first without options and then again with options in the same preamble (the reverse order does not clash). If the class or template already loads geometry, delete your own \usepackage[...]{geometry} line and write your values in \geometry{left=35mm, …} in the preamble. If it does not, keep one \usepackage{geometry}. The geometry manual allows \geometry to be called more than once in the preamble; later values override earlier ones.

The margins in the PDF don't match the numbers

Check three things. First, all four margins are given: a missing one is calculated by geometry (see section 01). Second, bindingoffset is not added on top of a left margin that already includes binding. Third, the page number is not being measured as if it were text: by default it sits below the bottom margin (section 03).

The PDF is US Letter, not A4

The standard classes default to US Letter when no paper option is given (LaTeX2e reference manual). In my test, a report with geometry but no paper option produced an 8.5 × 11 in page. Add a4paper to \documentclass or to the geometry options. Overleaf notes that its installation produces A4 by default, but that default only decides the PDF size when nothing else sets it: without geometry, the PDF can be A4 while the class still lays out the text for Letter. Giving a4paper explicitly fixes both, on any installation.

Text jumps left and right on alternate pages

The document is two-sided: twoside is in the class options, or the class is book. Each even page then mirrors the odd page, so the text sits nearer the left edge or the right edge on alternate pages, depending on which margin is wider. With left=35mm, even pages put the 35 mm on the right (the spine side), so their text sits 10 mm further left. Remove twoside (or add oneside for book) if the thesis is not printed on both sides. See section 04.

Text runs into the right margin

The margins are fine; one line is too long to break. LaTeX reports it as an Overfull \hbox warning with a line number. Long URLs, wide tables and images wider than \textwidth are the usual causes. Fix the line, for example with \includegraphics[width=\textwidth]{…}, rather than narrowing the margins for the whole thesis.

One page has different margins from the rest

A \newgeometry without a matching \restoregeometry changes every page after it. Search the .tex files for \newgeometry and close each one.

Inherited a template that fights every change?Send me the project and I'll set the layout to your guide

08Questions people ask

How do I set 1-inch margins in LaTeX?

Add \usepackage[margin=1in]{geometry} to the preamble. It sets all four LaTeX margins to 1 inch (25.4 mm). Add letterpaper or a4paper so the margins are measured on the right paper.

What are the default margins in LaTeX?

Without geometry, the margins depend on the class, the font size and the paper. If you load geometry with no margin options, it makes the text area 70% of the paper: on A4 that gave me 31.5 mm left and right, about 35.6 mm at the top and 53.5 mm at the bottom. Neither is a thesis setting, so give your guide's values.

How do I change the margins in Overleaf?

Margins in Overleaf are set in the preamble of main.tex with the geometry package, exactly as in any other LaTeX installation. Edit the geometry line and click Recompile.

Can I use centimetres instead of millimetres?

Yes. The package accepts any TeX unit, including cm, mm, in and pt, and you can mix them: left=3.5cm, right=25mm is valid.

Do the margins apply to the front matter and appendices too?

Yes. The geometry options in the preamble apply to every page, from the title page to the last appendix, unless you change them with \newgeometry. If your guide gives one set of margins, that single geometry line is all you need; check whether it sets different margins for the title page. The contents pages follow the same margins; my guide to the LaTeX table of contents and lists covers how to build them. The order of the front pages and their numbering are in my thesis formatting checklist.

Does APA style set the margins for a LaTeX thesis?

For a thesis, your university's guide sets the margins, even when it follows APA for citations and headings. If you write an APA paper in LaTeX, my guide to APA style in LaTeX covers the class that applies the whole format.

How this was checked: every example on this page was compiled with pdfLaTeX in TeX Live 2025 (geometry 5.9) on Windows 11, and the margins were read from geometry's log. Option meanings were checked against the geometry manual (version 6.0, CTAN), Overleaf's documentation and the LaTeX2e reference manual, on .

André Antão is a university lecturer in Management and Marketing at the Polytechnic University of Portalegre and a PhD candidate in Management. He has formatted theses in Word and LaTeX for 8 years.

Sources

  1. The geometry package (manual, v6.0) CTAN
  2. geometry – Flexible and complete interface to document dimensions CTAN
  3. Page size and margins Overleaf
  4. How to Write a Thesis in LaTeX (Part 2): Page Layout Overleaf
  5. Document class options LaTeX2e unofficial reference manual
  6. Page layout parameters LaTeX2e unofficial reference manual
  7. pdflscape – Make landscape pages display as landscape CTAN