[Tex/LaTex] How to add “page # of ##” on the document

header-footerlastpagepage-numbering

I want to add a footer to my document displaying the current number out of total number of pages. How do I do that?

Best Answer

I have not tried, but I found this at some old .tex files:

\usepackage{lastpage}
\usepackage{fancyhdr}
\pagestyle{fancy} 
...
\cfoot{\thepage\ of \pageref{LastPage}}

enter image description here