I'm trying to add a line in the header to be "Page X of Y", but only if there are multiple pages. My main problem is how to format the if statement. So far I have
\ifx \pageref{LastPage} 1
\relax
\else
\fancyhead[R]{Page \thepage\ of \pageref{LastPage}}
\fi
I think it's the first line that is problematic, as the rest seems to work.
etoolbox's\AtEndDocumentwith thelastpagepackage loaded. I kept getting Page 3 of 2. Thezref-totpagessolved my problem and seems more reliable. – jub0bs Nov 21 '13 at 12:55