LaTeX Page Numbering: Roman Numerals to Page X of Y

November 11, 2026 · 10 min read

LaTeX Page Numbering: Styles, Positions, and Removing Numbers

LaTeX page numbering is on by default: the article, report and book classes number pages automatically in arabic numerals. You change the style with \pagenumbering, hide a number with \thispagestyle{empty}, and move it with the fancyhdr package. Below is a tested example for each job, plus the reasons a number shows up where you didn't expect it.

Here's the whole toolkit at a glance:

You wantWrite
A centered number in the footerNothing in article or report (the default), or \pagestyle{plain}
Roman numerals\pagenumbering{roman}
No number on one page\thispagestyle{empty}
No numbers anywhere\pagestyle{empty}
Start from a chosen number\setcounter{page}{10}
The number at the bottom rightfancyhdr with \fancyfoot[R]{\thepage}
Page X of Ylastpage with \pageref{LastPage}

How Do I Add Page Numbers in LaTeX?

Usually you don't have to. The article and report classes use the plain page style, which centers the number in the footer. The book class uses headings, which prints the number in the running head beside the chapter or section title.

\documentclass{article}
\pagestyle{plain}
\begin{document}
First page.
\newpage
Second page.
\end{document}

The PDF shows 1 and 2 centered at the foot of each page. The \pagestyle{plain} line repeats the article default, but spelling it out keeps the intent clear if you later switch classes. There are four built-in styles. plain gives a bare number, empty gives nothing, headings adds an automatic running head, and myheadings adds a head you set yourself.

Every page number in LaTeX comes from the page counter, and \thepage prints it in the current style. So each fix on this page does one of three things: changes the counter, changes the style, or changes where \thepage appears.

LaTeX Page Numbering Styles With \pagenumbering

\pagenumbering controls how the number looks. It takes one of six arguments, and every call also resets the page counter to 1.

ArgumentPages print as
arabic1, 2, 3 (the default)
romani, ii, iii
RomanI, II, III
alpha, b, c
AlphA, B, C
gobblenothing at all

The letter styles stop at z. Page 27 triggers a Counter too large error, so save alph and Alph for short appendices. To start at a number other than 1, set the counter after you pick the style:

\pagenumbering{arabic}
\setcounter{page}{10}

The current page prints as 10 and the count carries on from there. The LaTeX2e reference entry for pagenumbering lists the same six styles. It also warns that gobble doesn't work with the hyperref package, so \pagestyle{empty} is the safer way to hide numbers.

How to Give Roman Numbering in LaTeX for Front Matter

Theses and books traditionally number the front matter (title, abstract, contents) in lowercase roman, then restart at 1 in arabic for the body. Make the switch at a page break, because \pagenumbering relabels the page you're currently on.

\documentclass{report}
\begin{document}
\pagenumbering{roman}
\tableofcontents
\chapter*{Abstract}
A short summary of the work.
\clearpage
\pagenumbering{arabic}
\chapter{Introduction}
The body starts here.
\end{document}

After two compiles, the contents page prints as i, the abstract as ii, and the Introduction opens on page 1. The second run is there because the contents list always reads the page numbers saved on the previous one.

The book class has this built in. \frontmatter switches to roman, \mainmatter switches back to arabic, and each one starts a new right-hand page. Chapters inside the front matter also lose their numbers. We prefer these two commands whenever the class offers them, because they handle the blank pages a two-sided book needs. Report and article don't define them, so use the manual switch above.

How to Remove the Page Number From the Title Page

Order is the trap. \maketitle sets its own page to plain, so a \pagestyle{empty} placed before it does nothing for page 1. In our test, that setup still printed a 1 at the foot of the title page. Put \thispagestyle{empty} after the title instead:

\documentclass{article}
\title{Field Report}
\author{A. Writer}
\begin{document}
\maketitle
\thispagestyle{empty}
Body text starts on the title page.
\newpage
Second page.
\end{document}

Page 1 has no number and page 2 shows 2. If you'd rather the second page show 1, give the title its own page. The titlepage environment hides the number on that page and resets the counter, so the next page of a one-sided article starts at 1:

\begin{titlepage}
\centering
{\Huge Field Report}\par
\vspace{1cm}
A. Writer
\end{titlepage}
First numbered page.

The report and book classes already put \maketitle on a separate, unnumbered page. To strip numbers from a whole document, set \pagestyle{empty} in the preamble and still add \thispagestyle{empty} after any \maketitle or \chapter.

Why Is My LaTeX Page Number Still Showing (or Missing)?

Most surprises with page numbering in LaTeX trace back to a few rules in the standard classes:

  • Opening pages force plain. \maketitle in article, plus \chapter and \part in report and book, call \thispagestyle{plain}. With \pagestyle{empty} or a custom footer, those pages still get a centered number. Add \thispagestyle{empty} right after the command, or redefine plain as shown in the next section.
  • A switch without a page break hits the current page. \pagenumbering{roman} halfway down page 1 relabels that page as i. Put \clearpage before every style change.
  • Numbers vanish after a template edit. Look for a stray \pagestyle{empty} or a leftover \pagenumbering{gobble}. A fancyhdr setup can also clear every slot with \fancyhf{} and never put \thepage back.

One limitation: these rules describe article, report and book. KOMA-Script and memoir define their own page styles and commands, so check their manuals if your template loads one of them.

Moving Page Numbers in LaTeX With fancyhdr

The fancyhdr package is the usual way to place LaTeX page numbers anywhere other than the center of the footer. It splits the header and the footer into left, center and right slots. Clear them all with \fancyhf{}, then place \thepage where you want it:

\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}
\fancyfoot[R]{\thepage}
\renewcommand{\headrulewidth}{0pt}

Numbers now sit at the bottom right. Swap in \fancyhead[R]{\thepage} to move them to the top right. The last line removes the thin rule fancyhdr draws under the header.

Chapter openings still show a centered number, because \chapter asks for plain. Redefine plain so those pages match the rest:

\fancypagestyle{plain}{%
  \fancyhf{}%
  \fancyfoot[R]{\thepage}%
}

For printed two-sided documents, put the number on the outer edge. Load the class with the twoside option and use the E (even) and O (odd) selectors:

\documentclass[twoside]{article}
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}
\fancyfoot[LE,RO]{\thepage}

Odd pages show the number at the bottom right and even pages at the bottom left. Without twoside, fancyhdr prints a warning and treats every page as odd, so all the numbers land on the right.

Page X of Y and the LaTeX Number of Pages

A footer like "Page 3 of 12" needs the number of the final page. The lastpage package writes a LastPage label that you can reference anywhere:

\usepackage{fancyhdr}
\usepackage{lastpage}
\pagestyle{fancy}
\fancyhf{}
\fancyfoot[C]{Page \thepage\ of \pageref{LastPage}}
\renewcommand{\headrulewidth}{0pt}

Compile twice. The first run saves the label to the .aux file and prints ?? in its place, and the second run fills in the number. If you also load hyperref, write \pageref* to stop the total from becoming a link. Equation references follow the same two-pass rule, as our LaTeX equation numbering guide explains.

Roman front matter breaks the arithmetic. LastPage holds the printed number of the last page, so a thesis with 6 roman pages and 36 arabic ones reads "of 36", not "of 42". For the physical page count, current LaTeX kernels provide \PreviousTotalPages, with no package needed:

\fancyfoot[C]{Page \thepage\ of \PreviousTotalPages}

In our test with 2 roman and 3 arabic pages, the second compile printed "Page 1 of 5" on the first arabic page. The first compile showed "of 0". Pick whichever total your readers expect.

Page Numbering in Beamer Slides and Pandoc PDFs

Beamer counts frames rather than pages, and its default theme shows no number at all. One line in the preamble adds it:

\setbeamertemplate{footline}[frame number]

Each slide then shows its frame number and the total, such as 1/2, in the bottom-right corner.

If you write in Markdown and build PDFs through Pandoc, the pagestyle variable feeds \pagestyle. The Pandoc manual lists plain as the default and empty for no numbers:

pandoc notes.md -V pagestyle=empty -o notes.pdf

There's a catch we hit in testing with Pandoc 3.8: when the YAML block sets a title, \maketitle still puts a 1 on the first page. To move numbers instead, save the fancyhdr lines from above in numbering.tex and pass -H numbering.tex. Our Pandoc Markdown guide covers the other flags, and converting Markdown to LaTeX walks through the full route. Forced breaks have their own Markdown page break guide.

Good LaTeX page numbering comes down to three moves. Pick a style with \pagenumbering, hide numbers with \thispagestyle{empty} after any command that forces plain, and place them with fancyhdr. If your source starts as Markdown, draft it in the editor, then run it through the Markdown to LaTeX converter for a .tex file. The converter doesn't compile a PDF, so add these commands and build it with your own TeX setup.