Page numbers in LaTeX

LaTeX numbers pages automatically. Use \pagenumbering and \pagestyle to control style and position.

Quick answer

latex
% Remove page numbers:
\pagestyle{empty}

% Roman numerals (i, ii, iii):
\pagenumbering{roman}

% Arabic numerals (1, 2, 3):
\pagenumbering{arabic}

Page styles

latex
\pagestyle{plain}    % number at bottom center (default in article)
\pagestyle{headings} % number in header with section title
\pagestyle{empty}    % no header or footer
\pagestyle{myheadings} % custom header text

% Affects only the current page:
\thispagestyle{empty}   % common on title page

Numbering styles

latex
\pagenumbering{arabic}   % 1, 2, 3, ...   (default)
\pagenumbering{roman}    % i, ii, iii, ...
\pagenumbering{Roman}    % I, II, III, ...
\pagenumbering{alph}     % a, b, c, ...
\pagenumbering{Alph}     % A, B, C, ...

Thesis: front matter + main body

A common thesis pattern: roman numerals for the front matter (TOC, abstract), then arabic from Chapter 1.

latex
\begin{document}

\pagenumbering{roman}
\thispagestyle{empty}  % no number on title page

\tableofcontents
\newpage
\listoffigures
\newpage

% Switch to arabic at chapter 1:
\pagenumbering{arabic}
\setcounter{page}{1}

\chapter{Introduction}
...
\end{document}

Set starting page number

latex
% Start numbering from a specific value:
\setcounter{page}{5}

% Get the total number of pages (requires lastpage package):
\usepackage{lastpage}
Page \thepage{} of \pageref{LastPage}

Custom position with fancyhdr

For full control over header/footer placement, use the fancyhdr package.

latex
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}  % clear all fields

% Page number in bottom right:
\fancyfoot[R]{\thepage}

% Section name in header left:
\fancyhead[L]{\leftmark}

Related topics