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?

  • I hope you don't insist to use \pagestyle{plain} and still want to get the desired result. Please see the solution below.
    – Masroor
    Jan 1, 2014 at 1:19

1 Answer 1


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.

  • You probably want to add \renewcommand{\headrulewidth}{0pt} unless using a header.
    – cfr
    Jan 1, 2014 at 1:19
  • Yes, all those tweakings are definitely possible. I left them for the end user. Please note that I did not reset the header-footer using \fancyhf{}. That was intentional, along with the rules.
    – Masroor
    Jan 1, 2014 at 1:21
  • 2
    Right but setting \pagestyle{fancy} adds a header rule which is not present with \pagestyle{plain} so if the idea is to show a solution which just does what's asked, I guess I thought you'd nullify the rule added by changing the pagestyle. But of course you're right that the user will need to read the documentation to tweak to their liking.
    – cfr
    Jan 1, 2014 at 1:31
  • @cfr Get your point and agreed upon. Added a few lines to the end of my answer.
    – Masroor
    Jan 1, 2014 at 1:34
  • \footrulewidth is 0pt by default though it does no harm to show how to change it, of course.
    – cfr
    Jan 1, 2014 at 1:38

Not the answer you're looking for? Browse other questions tagged .