## 1. Introduction

In this tutorial, we’ll describe how to make custom page numbering in LaTeX. Mainly, we’ll describe some custom styles that can be used independently. Then, we’ll describe how to combine two different styles for page numbering.

## 2. Custom Page Numbering

LaTeX is a software used for preparing documents. Page numbering in LaTeX is the process of applying a sequence of numbers to a latex document. Custom page numbering refers to the ability to specify the numbering style and format in a LaTeX-generated document beyond the default numbering provided by the LaTeX document class. Custom page numbering allows us to provide a flexible and customizable way to number the pages of our document uniquely.

We can also combine two or more styles, especially in a large document.

### 2.1. The Need for Custom Page Numbering

By default, LaTeX uses the Arabic numerals of the form: 1,2,3,… to number the pages of a document. There are various reasons why we need to customize our document page numbering.

Custom page numbering allows:

1. Consistency: custom page numbering allows us to create a consistent numbering style throughout a document. For example, we can number the pages of each chapter of a document that differs from that of the appendix
2. clarity: we can specify the first and last pages of a chapter or document, making it easy for readers to navigate our document easily
3. personalization: custom page numbering allows us to add personal text to our document. We can add this custom text before or after a page number. For example, some scientific journals add a unique number to each page number of their published articles

## 3. Numbering Styles in LaTeX

To customize page numbering to LaTeX, we’ll need the \pagenumbering command and a style written in curly bracket { }. The style of page numbering can be specified with:

\pagenumbering{style}

The style can be specified as:

1. arabic
2. Roman
3. roman
4. alph
5. Alph

### 3.1. Page Numbering in arabic

To customize a page numbering with arabic style, Latex uses the arabic command for numerical numbers such as 1,2,3,. The LaTeX command to add a numerical page numbering is:

\pagenumbering{arabic}

As an example, the following line of code:

\begin{document}
\pagenumbering{arabic}
\section{Chapter One : Introduction}
\lipsum[1]
\end{document}

would generate:

This style is the most commonly used in LaTeX, as it has no limit. It’s suitable for both small and large documents. We can also bold this custom page numbering in LaTeX.

### 3.2. Page Numbering in Roman

In LaTeX, the Roman numerals can be in uppercase or lowercase. The Roman command is used to specify uppercase Roman numerals of the form:  I,II,III,. The LaTeX command to add an uppercase Roman numeral to our document is given as:

\pagenumbering{Roman}

Running the following lines of code:

\begin{document}
\pagenumbering{Roman}
\section{Chapter One : Introduction}
\lipsum[1]
\end{document}

would generate output:

### 3.3. Page Numbering in roman

We use the roman style to specify the lowercase Roman numerals, which are of form i, ii, iii, …. The LaTeX command to add a lowercase Roman numeral is:

\pagenumbering{roman}

Compiling these lines of code:

\begin{document}
\pagenumbering{roman}
\section{Chapter One : Introduction}
\lipsum[1]
\end{document}

would customize our page numbering with a lowercase Roman numeral as follows:

### 3.4. Page Numbering in alph

We can customize our page numbering with either lowercase or uppercase letters. The alph command is used to specify a lowercase letter, which is of form a, b, c, …. The following line of code:

\begin{document}
\pagenumbering{alph}
\section{Chapter One : Introduction}
\lipsum[1]
\end{document}

would customize a page numbering with lowercase letters to generate:

### 3.5. Page Numbering in Alph

We use the command Alph to customize page numbering with uppercase letters, which are of form A, B, C, … The following line code contains the Alph command:

\begin{document}
\pagenumbering{Alph}
\section{Chapter One : Introduction}
\lipsum[1]
\end{document}

would generate:

## 4. Showing Current and Last Page Numbers

To customize page numbering further, we can use \thepage command to display the current page in the form “Page X of Y” where X and Y represent the current and last pages, respectively. The last page (i.e., Y) can be obtained using the lastpage package in LaTeX.

Using both the fancyhr and lastpage packages, we can the following line of code:

\fancyfoot[C]{Page \thepage\ of \pageref{LastPage}}

to our document to generate a page numbering of the form “Page X of Y”. As a demonstration, the following lines of code:

\begin{document}
\section{Chapter One : Introduction}
\fancyfoot[C]{Page \thepage\ of \pageref{LastPage}}
\lipsum[1]
\end{document}

would generate a custom page numbering as:

Notice that we use Arabic numerals for numbering in this case for clarity, and it’s easily understandable. We can also customize the page numbering in the form “X of Y” without adding “Page” to it.

Furthermore, we can add numbers and text to the page numbering in the form “XPV234N—(Page X of Y)” using the command:

\fancyfoot[C]{XPV234N - (Page\thepage\ of \pageref{LastPage})}

Using the above command in our document would customize the page numbering in the form:

The advantage of showing the current over the last page number is to help readers know the number of pages remaining or left. Most scientific articles tend to add unique text or numbers to the pages of their document.

## 5. Using two Styles of Page Numbering

We can make two custom page numbering for a document with many pages. For example, in a thesis, pages before or after the main chapters can be customized in roman style and those of the main chapters in arabic style. To write a thesis in LaTeX, We’ll customize the numbering of pages before the main chapters with roman style and then arabic style for the main chapters.

As a demonstration, to use these custom styles in a thesis, we can use the following line of codes:

\pagenumbering{roman}
\begin{document}
\section*{Guest Foreword}
\newpage
\section*{Abstract}
\newpage
\tableofcontents
\newpage
\pagenumbering{arabic}
\section{Chapter One : Introduction}
\newpage
\section{Chapter Two : Literature Review}
\newpage
\section{Chapter Three : Model Formulation}
\end{document}

to generate a document with two styles. The table of content for the above code would be:

We can also use the alph or Alph styles in this case. When we customize our page numbering in two styles, it helps readers to know where the main document start or ends and where the appendix part of the document begins.

## 6. Conclusion

In this article, we describe the need for custom page numbering in LaTeX document. As a demonstration, we listed five styles that can be used independently in LaTeX. Some of these styles can also be combined.

Lastly, we describe the use of lastpage and how it helps readers to know the current number of pages in a document.