I'm trying to put the total page number in the footer of my Lyx-doxument (a la https://tex.stackexchange.com/a/235/89786) by putting in the preamble the following
\fancyhf{} % Clear fancy header/footer
\fancyfoot[C]{Page \thepage~of~\pageref{LastPage}} % Page number in center footer
\makeatletter
\let\ps@plain\ps@fancy % Plain page style = fancy page style
\makeatother
Somehow lyx only seems to do one pass of the page numbers and I get a footer (on the 5:th page) reading: "Page 5 of ??".
Any ideas?
I can add a label at the last page called LastPage
, but this creates a hyperlink label as
which is really ugly.
\usepackage{lastpage}
. That package will automatically define theLastPage
label. Without a label, it doesn't matter how many times the document is generated, the reference will always just show??
.