I am trying to use the lastpage package in order to have footers with the page number given in the form "Page x of y", where y is the page number of the last page.
This should be straightforward, but I'm getting instead: "Page x of ??"; i.e., I'm getting a pair of question marks rather than a page number.
I've distilled the problem down in order to minimize dependencies, etc. to:
\documentclass{article}
\usepackage{lastpage}
\usepackage{fancyhdr}
\pagestyle{fancy}
\cfoot{\thepage\ of \pageref{LastPage}}
\begin{document}
text
\newpage
text
\newpage
text
\end{document}
Does anyone have any idea about what I could be missing to cause \pageref{LastPage} to give me "??"?