\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.
ISO A4 — standard in Europe, Asia, and most of the world.
US Letter — default in North American journals and offices.
ISO A5 — half of A4. Good for booklets and small reports.
ISO B5 — common in Japanese publications and some books.
US Legal — legal documents and contracts.
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 package
recalculates 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.
Default orientation. Taller than wide. Use for most documents, articles, and books.
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 title
on the left and the page number on the right.
\end{document}\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
\section{Related guides}
Keep learning LaTeX
Explore more guides and try every example live in the FormaTeX playground.
Try custom page layouts in the playground
Compile LaTeX in the browser with instant PDF preview. Free tier, no credit card required.

