# [Tex/LaTex] Add page number with total page number on each page?

page-numbering

I am using \pagestyle{plain} to add page number to each page in its bottom. If I want something like " page number / total page number" or " page number out of total page number", how shall I do that?

Solution Idea

1. Use package lastpage to define the label LastPage, allowing us to refer to the last page via \pageref{LastPage}.

2. Use fancyhdr to control your footer.

The Solution

\documentclass{article}

\usepackage{lastpage}

\usepackage{fancyhdr}

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

% Uncomment to remove the header rule

\pagestyle{fancy}

\usepackage{lipsum}

\begin{document}

\lipsum[1-10]

\end{document}


The Output

Further Tweaking


2. Use of fancyhdr actually gives you a ton of other controls which should be rewarding. Please see the package documentation for further details.