Set \oddsidemargin to 0pt in LaTeX and the left margin does not become zero — it becomes exactly one inch. It looks like a bug in the design, but it is a convention TeX inherited from DVI: a page’s reference point sits one inch in from the top-left corner of the paper, and every margin parameter is measured as a displacement from that point. Knowing this one fact changes how the whole margin business looks. This page covers where that inch comes from, what text block the standard classes actually set, and how to hit a required margin specification exactly with today’s answer, the geometry package — all with measured numbers.
Why \oddsidemargin=0pt produces a one-inch margin
Because the reference point is not the corner of the sheet but a point one inch inside it. You can confirm this by measurement: in an article with both \oddsidemargin and \topmargin set to 0pt, asking pdfTeX for the absolute position of the first character gives 72.26999pt from the left edge — exactly 1.00000 inch. So the real left margin is the following sum. \hoffset is the knob that moves the reference point itself, and \oddsidemargin shifts things further from there. Re-measured with \hoffset at 20pt, the left edge moved to precisely 92.27pt (that is, 72.27 + 20).
% How the page is actually built up (all measured, article, letterpaper)
% left margin = 1in + \hoffset + \oddsidemargin
% top of header = 1in + \voffset + \topmargin
% top of body = top of header + \headheight + \headsep
% first baseline = top of body + \topskip
% The classical way, by hand. Correct, but you own every consequence.
\setlength{\oddsidemargin}{0pt} % real left margin = 1in + 0pt = 1in
\setlength{\topmargin}{0pt} % header top at 1in; body starts 37pt lower
\setlength{\textwidth}{16cm} % the RIGHT margin is now whatever is left
\setlength{\textheight}{24cm} % likewise the bottom margin
% Measured with the two margins above: left edge 72.26999pt = 1.00000in,
% first baseline 119.27pt from the paper top = 1in + 0 + 12 + 25 + 10It is worth looking inside that 1in, too. TeX’s pt is the American printer’s point, 72.27 to the inch — not the DTP or PostScript point of 72 to the inch. TeX calls the latter bp (big point), and measured, 1bp = 1.00374pt. So 12pt and 12bp differ by about 0.37 %. Invisible over one line, but apply the same fraction to the 345pt of \textwidth and it is 1.29pt, close to half a millimetre. On a document whose margins are specified in millimetres, picking the wrong unit can put you outside the specification. pdfTeX carries the one-inch offset as \pdfhorigin and \pdfvorigin, both defaulting to 72.26999pt.
| Parameter | Meaning |
|---|---|
\paperwidth / \paperheight | The paper dimensions as LaTeX understands them — not the physical PDF page size (see below) |
\textwidth / \textheight | Width and height of the body (text area); 345.0pt by 550.0pt in a 10pt article |
\oddsidemargin | Left-margin displacement on odd pages (all pages under oneside), from the origin; add 1in for the real margin |
\evensidemargin | The same for even pages under twoside; the default in a 10pt book is 89.0pt |
\topmargin | Distance from the origin to the top of the header — not to the top of the body |
\headheight | Height of the box holding the running head; 12.0pt by default |
\headsep | Gap between the header and the top of the body; 25.0pt by default in article |
\footskip | Baseline-to-baseline distance from the last text line to the footer; 30.0pt by default |
\marginparwidth / \marginparsep | Width of marginal notes and their separation from the body; 65.0pt and 11.0pt in a 10pt article |
\hoffset / \voffset | Move the reference point itself; normally left at 0pt and not touched |
Try to set these by hand and the table doubles as a list of traps. Widening \textwidth does not narrow the right margin — the right margin is whatever is left over from “paper width − left margin − \textwidth”, so it changes behind your back. And because \topmargin reaches only to the top of the header, moving the body down to one inch means subtracting \headheight and \headsep yourself. Measured: hand geometry a margin=1in and \topmargin comes out at −37.0pt, which is exactly −(12 + 25). There is no longer any reason to do that arithmetic yourself.
Why the standard classes leave so much white space: article and book measured
To keep the number of characters per line inside a readable range. A 10pt article pins \textwidth at 345.0pt regardless of the sheet: on letter paper (614.295pt wide) that leaves roughly 134pt on each side, and on A4 (597.5pt wide) the text is still 345.0pt. A wider sheet does not buy longer lines, because line length should be decided by legibility. Larger type does widen the block a little — 360.0pt at 11pt, 390.0pt at 12pt — since bigger letters fit fewer of themselves into the same measure.
| Class (letter paper) | textwidth | textheight | oddsidemargin | evensidemargin |
|---|---|---|---|---|
article | 345.0pt | 550.0pt | 62.0pt | 62.0pt |
article, 11pt | 360.0pt | 541.4pt | 54.0pt | 55.0pt |
article, 12pt | 390.0pt | 548.5pt | 39.0pt | 40.0pt |
book | 345.0pt | 550.0pt | 35.0pt | 89.0pt |
The book row contains the whole philosophy of a two-sided layout. On an odd page the left side (the binding side) is 1in + 35.0pt = 107.27pt, and the outer right side gets the remaining 162.02pt. So LaTeX’s book makes the outer margin wider than the binding margin — the opposite of the usual rule about allowing room for the binding. The reason is that the outer margin is being reserved as a home for marginal notes (\marginpar), which is also why \marginparwidth is as large as 65.0pt. On even pages the two swap and \evensidemargin’s 89.0pt takes over. Use that layout in a document with no marginal notes and the outer edge simply looks slack — which is where geometry comes in.
How to use geometry: paper and margins in one line
One line — \usepackage[a4paper, margin=25mm]{geometry} — settles both the paper and all four margins. Options can go in the brackets of \usepackage or in a later \geometry{...} command; both are equivalent, and you may call it as often as you like in the preamble, a later setting of the same key overriding an earlier one. Order does not matter. The package is by Hideo Umeki, its copyright line starts in 1996, and since 2018 it has been maintained by David Carlisle (TeX Live 2024 ships v5.9, January 2020). It has been the answer for margins for a quarter of a century because its interface matches the order people think in: so many millimetres in from the edge of the paper.
| Option | Meaning |
|---|---|
a4paper / letterpaper / … | Pick the sheet by name; A0–A6, B0–B6, b5paper, a5paper, legalpaper, executivepaper and more are provided |
paperwidth= / paperheight= / papersize= | A custom sheet; papersize={210mm,297mm} gives both at once |
margin= | All four margins at once; margin={A,B} means left/right = A, top/bottom = B |
left= / right= / top= / bottom= | Each side separately; lmargin, rmargin, tmargin, bmargin are aliases |
hmargin= / vmargin= | Given as a pair: hmargin={left,right} and vmargin={top,bottom} |
inner= / outer= | Binding-side and fore-edge margins in a two-sided layout; aliases of left and right |
textwidth= / textheight= / total= | Specify the text block instead of the margins; total={width,height} sizes the whole body block, and width= / height= belong to the same family |
bindingoffset= | Binding offset; adds this length to the inner side (the left side under oneside) |
includehead / includefoot | Count the header (\headheight + \headsep) or footer (\footskip) as part of the body block height |
landscape | Landscape orientation; swaps width and height |
asymmetric | Keeps the margins from swapping between odd and even pages, so marginal notes stay on one side |
showframe | Actually draws the frames of the body, header and footer; use it to eyeball whether a spec is met |
Hitting a required margin specification exactly
The shortest path is to copy the required numbers straight into geometry’s keys. Here is a worked check. Writing the specification “A4, 30 mm on the binding side, 20 mm on the fore-edge, 5 mm binding offset, two-sided” as below and then measuring, \oddsidemargin and \evensidemargin came out at 27.31464pt and −15.36449pt. Add the inch and the binding side of an odd page is 99.5846pt = 35 mm (30 + 5), while the left, outer edge of an even page is 56.9055pt = exactly 20 mm. However the sides swap, the binding margin is always 35 mm and the fore-edge always 20 mm.
\documentclass[twoside]{book}
\usepackage{geometry}
\geometry{
a4paper,
inner=30mm, % binding side
outer=20mm, % fore-edge
bindingoffset=5mm, % added to the inner side
includehead, % count the header into the block height
}
% Measured result: \oddsidemargin 27.31464pt, \evensidemargin -15.36449pt
% -> binding side 35mm, fore-edge 20mm, on both odd and even pages
\begin{document}
Body text goes into this block.
\end{document}It pays to know how to check the result. Adding showframe to the preamble actually draws the frames of the body, header and footer, and the layout package’s \layout command prints a diagram page annotating every parameter. If you want the raw numbers, \typeout something like \the\textwidth and read the log. One caution: specify margins and text block at the same time and geometry warns with Package geometry Warning: Over-specification in h-direction. and quietly ignores one of them. Give left, right and textwidth and the three agreeing is pure luck — the rule is specify at most two and let geometry compute the third.
You asked for one paper size and the PDF came out another
A class option only tells LaTeX what size the paper is; it does not touch the physical page size of the PDF. They are two separate variables. Measured: with \documentclass[a5paper]{article}, LaTeX’s \paperwidth becomes 421.10078pt while pdfTeX’s \pdfpagewidth stays at 597.50787pt — the width of A4. The same happens with [letterpaper] and [b5paper]: the PDF’s sheet stays at whatever the TeX distribution defaults to (a4 on a stock TeX Live 2024). The result is a lopsided PDF whose layout was computed for A5 and whose page is A4.
Loading geometry resolves the mismatch by itself. In all four measured cases where the paper was handed to geometry, \pdfpagewidth and \pdfpageheight came out equal to \paperwidth and \paperheight. Give the paper size to geometry, not to the class option — a workflow rule worth remembering.
Changing the margins mid-document: \newgeometry and \restoregeometry
Call \newgeometry{...} in the body and a new text block takes over from that point. It resets everything given earlier except the paper size and then applies only the options you passed, so writing it as though it patched a couple of values is how accidents happen. Measured: in an A4 document with margin=1in, calling \newgeometry{margin=1cm} moved \textwidth from 452.9679pt to 540.60239pt (that is, 597.50787 − 2 × 28.4526), and \restoregeometry brought it back to 452.9679pt. Both commands insert a \clearpage, so the switch never lands mid-page. If you reuse a layout repeatedly, store it with \savegeometry{name} and recall it with \loadgeometry{name}.
\usepackage[a4paper, margin=1in]{geometry}
\savegeometry{normal} % remember this layout under a name
% ... in the body:
\newgeometry{margin=1cm} % wide pages start here (a \clearpage is inserted)
% a big landscape table, an appendix, a fold-out figure ...
\restoregeometry % back to the preamble layout (another \clearpage)
% \loadgeometry{normal} % or recall a saved one by nameTo drop in a single landscape page, combine \newgeometry{landscape, ...}, or use the landscape environment of the purpose-built lscape / pdflscape packages (pdflscape also rotates the view in the PDF reader, which is what you want for a document read on screen). And if what you want to change is not the shape of the page but the appearance of headings, or the contents of the header and footer, those belong to titlesec and fancyhdr respectively. Multi-column layout has its own page too.