The complete guide to LaTeX page layout — set paper size and margins with geometry, control page orientation, add professional headers and footers with fancyhdr, and build multi-column layouts.
\section{Paper sizes}
Choosing a paper size
Pass the paper size as an option to geometry or to \documentclass. Setting it in geometry is preferred because it guarantees the PDF viewer metadata and text block calculations all agree.
a4paper210 × 297 mm
ISO A4 — standard in Europe, Asia, and most of the world.
letterpaper8.5 × 11 in
US Letter — default in North American journals and offices.
a5paper148 × 210 mm
ISO A5 — half of A4. Good for booklets and small reports.
b5paper176 × 250 mm
ISO B5 — common in Japanese publications and some books.
legalpaper8.5 × 14 in
US Legal — legal documents and contracts.
executivepaper7.25 × 10.5 in
US Executive — business letters and presentations.
\usepackage{geometry}
Configuring margins
All margin dimensions are set through geometry's key-value options. Measurements can be in cm, mm, in, or pt.
top
Distance from the top of the page to the first line of text.
bottom
Distance from the last line of text to the bottom of the page.
left / inner
Left margin (or inner margin for two-sided layouts).
right / outer
Right margin (or outer margin for two-sided layouts).
headheight
Height reserved for the running header. Set to at least 14 pt when using fancyhdr.
headsep
Gap between the header baseline and the top of the text block.
\documentclass{article}\usepackage[ a4paper, % paper size top = 2.5cm, % top margin bottom = 2.5cm, % bottom margin left = 3cm, % left (inner) margin right = 2.5cm, % right (outer) margin headheight = 14pt, % reserve space for header]{geometry}\begin{document}This page uses A4 paper with custom margins. The geometry packagerecalculates the text block and all dependent dimensions automatically.\end{document}
\section{Orientation}
Page orientation
Orientation is controlled by passing landscape or portrait to geometry. Use \newgeometry{landscape} mid-document for a single rotated page.
portraitPortrait
Default orientation. Taller than wide. Use for most documents, articles, and books.
landscapeLandscape
Wider than tall. Pass landscape to geometry. Useful for wide tables, posters, and slides.
\usepackage{fancyhdr}
Headers and footers with fancyhdr
The fancyhdr package gives you full control over running headers and footers. Use \fancyhead[L/C/R]{...} and \fancyfoot[L/C/R]{...} to place content in the six slots (left, center, right for odd pages — double for two-sided documents with E/O variants).
\documentclass{article}\usepackage[a4paper, margin=2.5cm, headheight=15pt]{geometry}\usepackage{fancyhdr}\pagestyle{fancy}\fancyhf{} % clear all default header/footer fields% Header: left, center, right\fancyhead[L]{\small\textit{My Report}}\fancyhead[C]{}\fancyhead[R]{\small\thepage}% Footer: centered page number alternative% \fancyfoot[C]{\thepage}% Horizontal rule thickness below header\renewcommand{\headrulewidth}{0.4pt}\renewcommand{\footrulewidth}{0pt}\begin{document}\section{Introduction}The header appears on every page showing the document titleon the left and the page number on the right.\end{document}
Run this example
\usepackage{multicol}
Multi-column layouts
Two approaches exist for multi-column text: the twocolumn document class option for whole-document layouts, and the multicol package for inline column switching with balanced column heights.
Two-column document class
Pass twocolumn to \documentclass[twocolumn]{article}. Affects the entire document. Use \onecolumn and \twocolumn to switch mid-document.
multicol package
\usepackage{multicols} gives flexible column switching mid-page. \begin{multicols}{3} starts a three-column block; \end{multicols} returns to single column.
Column separation
Set \setlength{\columnsep}{20pt} to control the gap between columns. The default is 10 pt for twocolumn and adjustable with multicol.
\section{Common pitfalls}
Avoid these layout mistakes
Missing headheight warning with fancyhdr
fancyhdr writes a warning if headheight is too small for the content. Set headheight=15pt (or 14pt) in the geometry options to silence it.
geometry conflicts with other margin setups
Avoid mixing geometry with manual \setlength{\topmargin}{...} calls. Let geometry manage all page dimensions from one place.
Landscape and crop marks
Using the landscape option rotates the paper. If you also use crop or tcolorbox with size=tight, double-check that the bounding box reflects the rotated dimensions.
\oddsidemargin vs geometry
In older documents you may see \oddsidemargin and \evensidemargin. These are legacy approaches — replace them with a single \usepackage[left=..., right=...]{geometry} call.
\section{FAQ}
Frequently asked questions
What is the simplest way to set 2.5 cm margins on all sides?
How do I set different margins for odd and even pages?
Can I change the page layout mid-document?
How do I remove the page number?
Why does my fancyhdr header not appear on the first page?
How do I create a full-bleed A4 PDF with no margins?
\section{Related guides}
Keep learning LaTeX
Explore more guides and try every example live in the FormaTeX playground.
We track anonymous usage — page views, feature usage, compilation events — to understand what works and what doesn't. No ads, no personal data, no third-party sharing.