Page numbers in LaTeX (roman, arabic, start value, remove)

\pagenumbering{roman} changes how the page number is printed and resets it to 1. \setcounter{page}{5} sets the number, and \pagestyle{empty} removes it.

Roman numbers at the front, arabic in the main part

The styles are arabic (1, 2, 3), roman (i, ii, iii), Roman (I, II, III), alph (a, b, c) and Alph (A, B, C). End the page with \clearpage before you switch, because the command acts on the page that is being filled.

Complete document:

\documentclass{article}
\begin{document}
\pagenumbering{roman}
\tableofcontents
\clearpage
\pagenumbering{arabic}
\section{Introduction}
The first page of the main part has the number 1.
\end{document}
Result
Page 1 of the compiled examplePage 1
Page 2 of the compiled examplePage 2

Open in the editor

Start at another number

\setcounter{page}{5} gives the current page the number 5. \addtocounter{page}{-1} lowers the number by one, for example after a page that should not count.

\setcounter{page}{5}
This page has the number 5.
Result
The compiled example

Open in the editor

Remove the page number

\pagestyle{empty} in the preamble removes header and footer from all pages. \thispagestyle{empty} does it for one page; after \maketitle it has to follow that command, because \maketitle sets the page style of the title page itself.

\title{Report}
\author{Anna Schmidt}
\maketitle
\thispagestyle{empty}
The title page has no number. It still counts as page 1.
Result
The compiled example

Open in the editor

Page 3 of 10

The lastpage package defines the label LastPage on the last page, so \pageref{LastPage} prints the total. The total is correct from the second run on.

This goes into the preamble.

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

Open in the editor

Pitfalls

Compiled with pdfLaTeX from TeX Live 2023.

Related pages