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}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}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}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}Pitfalls
- Without a paper option,
article,reportandbooklay out the text for US letter (8.5 in by 11 in). - A misspelled option such as
a4is not an error. LaTeX only warns about an unused global option and keeps the default size. - To turn one page with a wide table or figure, use Rotate a single page to landscape in LaTeX instead of changing the document.
Compiled with pdfLaTeX from TeX Live 2023.
Related pages
- Package
geometry - How-to Set page margins in LaTeX
- How-to Rotate a single page to landscape in LaTeX
- Package
pdflscape