Last Updated: February 25, 2016
·
2.941K
· lindsaybradford

Implementing "page x of y" as a footer to LaTeX documents.

The essence of supplying your own footer within LaTeX is to override the @oddfoot and/or @evenfoot commands with your own definition for them. The LaTeX code fragment below overrides the @oddfoot command to print "page x of <total pages>" within the centre of all odd pages. The @evenfoot command calls the @oddfoot command to ensure that footers for even and odd pages are the same.

Note that the command \pageref{LastPage} is made available via the lastpage package, which depending on your LaTex distribution may not come default.. For distributions that don't include LastPage, here's a link:

http://www.ctan.org/tex-archive/macros/latex/contrib/lastpage

\renewcommand*{\@oddfoot}{%
    \hspace*{\fill}%
    page \arabic{page} of \pageref{LastPage}}%
    \hspace*{\fill}%
 }
 \renewcommand*{\@evenfoot}{\@oddfoot}