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


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?

Best Answer

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




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

% Uncomment to remove the header rule
% \renewcommand{\headrulewidth}{0pt} 






The Output

enter image description here

Further Tweaking

  1. If you really like it plain, perhaps you will want to use \renewcommand{\headrulewidth}{0pt} (and may be \renewcommand{\footrulewidth}{0pt}) as well to get rid of the rules.

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