How to Put Page Numbers on the Left and Right Corners in LaTeX
At a glance
- 1. Enable two-sided pages
Use the twoside class option so LaTeX distinguishes odd and even pages.
- 2. Clear the page fields
Load fancyhdr, select the fancy page style, and clear its default header and footer fields.
- 3. Set the outer corners
Put the page number in LE and RO: left on even pages, right on odd pages.
- 4. Keep columns unchanged
The placement is relative to the physical page, so it works with one or two columns.
To place page numbers at opposite corners on facing pages, use fancyhdr and make the document two-sided. The standard outer-corner layout puts the number on the right of odd-numbered pages and on the left of even-numbered pages.
Minimal working example
\documentclass[twoside,twocolumn]{article}
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{} % Clear the default header and footer fields
\fancyfoot[LE,RO]{\thepage}
\renewcommand{\headrulewidth}{0pt}
\begin{document}
This is a two-column document. Page numbers are placed at the outer
bottom corners: right on odd pages and left on even pages.
\clearpage
The page number on this even page appears at the left corner.
\end{document}
The document class option twoside tells LaTeX to format pages as facing pages. In the fancyhdr field selectors, L, C, and R mean left, center, and right; E and O mean even and odd pages. Therefore, LE means the left field on even pages, while RO means the right field on odd pages.
The twocolumn option is included to show that the method also works with two columns. Page numbering belongs to the physical page, not to an individual column. If your document uses the multicol package instead, the same footer command applies.
Change the position or corner
To put the number in the top outer corners instead, change the footer command to:
\fancyhead[LE,RO]{\thepage}
For numbers at both the top and bottom outer corners, use both commands. To put numbers at the inner corners, use LO,RE instead: odd-page left and even-page right.
If you want the page number on the right on every page of a one-sided document, use a one-sided class and write:
\fancyfoot[R]{\thepage}
A one-sided layout does not distinguish left and right pages in the same way as a two-sided layout, so it is not the right choice for alternating numbers between outer corners.
First pages and other page styles
Some LaTeX commands and document classes switch particular pages to the plain page style. For example, \maketitle in the standard article class uses plain for its title page. If the page number on such a page does not follow your fancyhdr layout, define the same footer for plain as well:
\fancypagestyle{plain}{%
\fancyhf{}%
\fancyfoot[LE,RO]{\thepage}%
\renewcommand{\headrulewidth}{0pt}%
}
Place this definition in the preamble, after loading fancyhdr. It changes pages using plain without changing the layout on pages using fancy.
Common mistakes
- Leaving out
twoside: without it, the document does not use the intended even/odd facing-page layout. - Using
Ralone when you want alternating corners:\fancyfoot[R]{\thepage}puts the number on the right, not on the outer edge of both facing pages. - Using the wrong selector order:
LEis left-even;ROis right-odd. For inner corners, useLO,RE. - Expecting each column to have its own page number: columns share one page number, which appears once in the page header or footer.
References
Spotted an error? Send a correction. Read how we write and check articles in our editorial policy.