bart wrote:
Hi
I would like to have in the header the pagenumber and the total number of pages in the header in the format" page n of m". In the fancyheader manual I have found that I have to use the package "lastpage" so I've put in the preamble:

\usepackage{lastpage}

\fancyhf{}

\fancyhead[LE,RO]{\thepage\ of \pageref{lastpage}}


The result I get is: 2 of ?? (on page 2 for instance).

I don't get any error messages but it seems that it is unknown how many pages the document has. How can I solve this?

Hi,

I'm not an expert, but looking at the fancy header manual (e.g. section 16 on page 15, you should use
\pageref{LastPage}
instead of
\pageref{lastpage}

For me, this small change is sufficient to have a correct last page number.

Also, you do have warnings that could have pointed you to this:
In Documents->LaTeX Log you can access the log, in which you can see several warnings (in blue) from latex saying: "LaTeX Warning: Reference `lastpage' on page 1 undefined on input line 37." (the page number and line number can be different for you)

Best regards,

Olivier


Regards
Bart



Reply via email to