Basic Syntax Create your first LaTeX Title Section Paragraph and Comments Text Processing Fonts Formatting List
Document type in Latex↓
Document Class Document Classes Comparison Document Classes Options
Command Table of Contents Page Numbering Footnotes Language Support
Bibliography ↓
Bibliography Management With Biblatex Bibliography Management With Natbib
Page Numbering

Setting a numbering style
In order to number the pages of a document, some numbering style needs to be specified. Using \pagenumbering{roman} will set the page numbering style to lowercase Roman.

CODE
\documentclass{article}
\pagenumbering{roman}

\begin{document}

\tableofcontents
\newpage
\section{Test 1}
\subsection{Subsection 1}

\newpage
\section{Test 2}
\subsection{Subsection 2}

\newpage
\section{Test 3}
\subsection{Subsection 3}

\end{document}


Numbering styles
The following styles are available for page numbering:
Let's have a look at another example:

CODE
\documentclass{article}
\pagenumbering{arabic}

\begin{document}

\tableofcontents
\newpage
\section{Test 1}
\subsection{Subsection 1}

\newpage
\section{Test 2}
\subsection{Subsection 2}

\newpage
\section{Test 3}
\subsection{Subsection 3}

\end{document}
Using multiple numbering styles in a single document
This is usually used in the book document class, where pages before the first chapter have Roman numerals.
The commands that control the page numbering style are \frontmatter, which numbers the pages between that command and the next with one particular style, and \mainmatter, which changes and resets the style.

CODE
\documentclass{book}
\begin{document}

\frontmatter

\newpage

\addcontentsline{toc}{chapter}{Preface}

\addcontentsline{toc}{chapter}{Entry}

\tableofcontents

\mainmatter

\newpage
\chapter{Chapter 1}
\newpage
\chapter{Chapter 2}
\newpage
\chapter{Chapter 3}

\end{document}

For other document classes, see the following example:

CODE
\documentclass{article}
\pagenumbering{roman}

\begin{document}

\tableofcontents

\newpage
\section{Test 1}
\setcounter{page}{2} %sets the page counter to 2 and the count starts from that one
\subsection{Subsection 1}

\newpage
\section{Test 2}
\subsection{Subsection 2}

\newpage
\section{Test 3}
\pagenumbering{arabic}
\subsection{Subsection 3}

\end{document}

Customizing numbering styles
If you want to display the current page number out of the total number of pages, you can use the package fancyhdr:

CODE
\documentclass{article}
\usepackage{fancyhdr}
\usepackage[english]{babel}
\usepackage{lastpage}

\pagestyle{fancy}
\fancyhf{}
\rfoot{Page \thepage \hspace{1pt} of
\pageref{LastPage}}

\begin{document}
\tableofcontents

\newpage
\section{Test 1}
\subsection{Subsection 1}

\newpage
\section{Test 2}
\subsection{Subsection 2}

\newpage
\section{Test 3}
\subsection{Subsection 3}

\end{document}