Last Updated: February 25, 2016
·
2.581K

# 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}

89.94K
0

26.62K
0

### LaTex with Vim

22.58K
2

#### Have a fresh tip? Share with Coderwall community!

Best #Latex Authors
anupamaa
89.92K
honzacz
28.23K
itseranga
22.57K
michie1
14.43K
Related Tags
#latex
Awesome Job