Set paper size and orientation in LaTeX (A4, letter, landscape)

Pass the paper size to the geometry package, for example \usepackage[a4paper]{geometry}, and add landscape for a document in landscape format. geometry sets the layout and the page size of the PDF together.

Choose a standard size

The names are a4paper, a5paper, b5paper, letterpaper, legalpaper and executivepaper. Written as an option of \documentclass, the size also reaches every other package that reads it.

Complete document:

\documentclass[a4paper]{article}
\usepackage{geometry}
\begin{document}
A page in A4 format.
\end{document}
Result
The compiled example

Open in the editor

Landscape for the whole document

The landscape option swaps the width and the height of the paper. Keep geometry loaded: the class option alone changes the text area, but the PDF page stays upright.

Complete document:

\documentclass[a4paper, landscape]{article}
\usepackage[margin=2cm]{geometry}
\begin{document}
A page in A4 landscape format.
\end{document}
Result
The compiled example

Open in the editor

A custom size

paperwidth and paperheight take any length, for a poster, a card or a slide.

This goes into the preamble.

\usepackage[paperwidth=15cm, paperheight=20cm, margin=1.5cm]{geometry}

Open in the editor

KOMA-Script classes

The KOMA-Script classes take the size as paper=a5 and the orientation as paper=landscape. They set the PDF page size themselves, so this works without geometry.

Complete document:

\documentclass[paper=a5, paper=landscape]{scrartcl}
\begin{document}
A page in A5 landscape format.
\end{document}
Result
The compiled example

Open in the editor

Pitfalls

Compiled with pdfLaTeX from TeX Live 2023.

Related pages