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}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.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.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}}Pitfalls
- The
titlepageenvironment resets the page number, so the title page and the page after it are both page 1. Withhyperrefthis produces the warning about a destination with the same identifier, see destination with the same identifier (name{page.1}) has been already used, duplicate ignored. - To move the number to another position, for example to the top right, define the header and footer yourself, see Headers and footers in LaTeX.
Compiled with pdfLaTeX from TeX Live 2023.