How-to

How to Make a Landscape Page in LaTeX

The fix

To make one page landscape in LaTeX, load \usepackage{pdflscape} and wrap the content in \begin{landscape} ... \end{landscape}. The content is rotated and the PDF page is turned as well, so it reads the right way up on screen. For a document that is landscape throughout, use \usepackage[landscape]{geometry} instead.

Not sure it worked on your document? Paste it into LetX and compile it, free and in the browser.

Why it happens

LaTeX lays out every page at the same size and orientation. The landscape environment, from lscape, rotates the text block by 90 degrees on an otherwise portrait page, and pdflscape adds a rotation setting to that PDF page so viewers display it sideways. A page cannot be half portrait and half landscape, so the environment always ends the current page before it starts and again when it ends.

Example

\usepackage{pdflscape}
% in the document:
\begin{landscape}
\begin{table}
  \centering
  \caption{A wide table}
  \begin{tabular}{llll}
    Region & Q1 & Q2 & Q3 \\
  \end{tabular}
\end{table}
\end{landscape}

A complete example

Put the table or figure environment inside landscape, not the other way round. A landscape environment inside a table float gives no error, and no rotation either.

Inside the environment, \linewidth is the long side of the page, so a table or image sized to \linewidth spans the full rotated width. \textwidth keeps its portrait value, so use \linewidth there. Any figures still waiting to be placed are printed before the landscape page starts.

\documentclass{article}
\usepackage{pdflscape}
\usepackage{booktabs}
\begin{document}
Portrait text before the wide table.

\begin{landscape}
\begin{table}
  \centering
  \caption{Sales by region and year}
  \begin{tabular}{lrrrrrrrr}
    \toprule
    Region & 2017 & 2018 & 2019 & 2020 & 2021 & 2022 & 2023 & 2024 \\
    \midrule
    North  & 12.1 & 12.8 & 13.0 & 11.2 & 12.5 & 13.9 & 14.2 & 14.8 \\
    South  &  9.4 &  9.9 & 10.3 &  8.7 &  9.6 & 10.8 & 11.1 & 11.6 \\
    \bottomrule
  \end{tabular}
\end{table}
\end{landscape}

Portrait text continues on the next page.
\end{document}

Rotating only a table or figure

The rotating package offers sidewaystable and sidewaysfigure, which work like table and figure but rotate their content onto a page of their own. The PDF page itself stays portrait, which suits print better than a screen.

For a small element that should stay in the text flow, such as a rotated column heading or a narrow table, \rotatebox{90}{...} from graphicx turns any box in place, as long as the result fits the page.

\usepackage{rotating}
% in the document:
\begin{sidewaystable}
  \centering
  \caption{Wide results}
  \begin{tabular}{lll}
    Method & Accuracy & Time \\
  \end{tabular}
\end{sidewaystable}

The whole document in landscape

\usepackage[landscape]{geometry} swaps the paper width and height and sets the PDF page size to match. Name the paper size as well, as in [a4paper,landscape], because the article class defaults to US letter.

The class option \documentclass[landscape]{article} on its own is not enough. It swaps LaTeX's internal page dimensions, but unless geometry or another package writes the PDF page size, the PDF can come out portrait with the text laid out for landscape. Beamer slides are landscape already and need neither.

Page numbers, headers and engines

pdflscape rotates the text block only. Headers, footers and the page number stay where they are on the portrait page, so once the viewer turns the page, the number appears on one side, turned 90 degrees. That is expected behaviour, not an error.

pdflscape works with pdfLaTeX, XeLaTeX and LuaLaTeX. The original lscape package rotates the content but leaves the PDF page upright, so on screen the reader has to turn their head; there is little reason to prefer it today.

Frequently asked questions

What is the difference between lscape and pdflscape?

Both rotate the content. pdflscape also rotates the page in the PDF, so the viewer shows it the right way up. Prefer pdflscape for anything read on screen.

How do I make the whole document landscape?

Load \usepackage[a4paper,landscape]{geometry}, or letterpaper in place of a4paper. The class option [landscape] alone does not reliably set the PDF page size.

Why does the landscape environment start a new page?

A page cannot be part portrait and part landscape, so \begin{landscape} and \end{landscape} each end the current page. Pending floats are printed before the rotated page.

Can I rotate a table without giving it its own page?

Yes, with \rotatebox{90}{...} from graphicx, as long as the rotated table fits the portrait text height. sidewaystable and the landscape environment always use a full page.

Why is the page number on the side of my landscape page?

pdflscape rotates the body text but not the header and footer, which stay in their portrait positions. When the viewer turns the page, they appear along one side.

Related LaTeX fixes

Browse all LaTeX problems & fixes, or start with the LaTeX guide.

Try the fix in LetX

Open the editor, paste your code, and compile in seconds to see the error clear. Free, in your browser.

Open LetX Free