# \pageref and hyperref [closed]

Please can anyone tell me the source of the following error?

I simply entered

\label{xlastpage} on last page


and the call

\setkeys[KV]{fam}{lhead={Page \thepage of \pageref{xlastpage}}}


gave the following funny errors.

%%%%%%%%% Trace log %%%%%%%%%%

\T@pageref #1->\NR@setref {#1}\@secondoffive {#1}
#1<-xlastpage

\NR@setref #1->\begingroup \@safe@activestrue \expandafter \endgroup \expandaft
er \NR@@setref \csname r@#1\endcsname
#1<-xlastpage
{\begingroup}
{entering semi simple group (level 19) at line 141}

\@safe@activestrue ->\let \if@safe@actives \iftrue
{\let}
{changing \if@safe@actives=\iffalse}
{into \if@safe@actives=\iftrue}
{\expandafter}
{\expandafter}
{\csname}
{\endgroup}
{restoring \if@safe@actives=\iffalse}
{leaving semi simple group (level 19) entered at line 141}

\NR@@setref #1->\ifx \@undefined #1\let #1\relax \fi \@setref #1
#1<-\r@xlastpage
{\ifx}
{false}

\@setref #1#2#3->\ifx #1\relax \protect \G@refundefinedtrue \nfss@text {\reset@
font \bfseries ??}\@latex@warning {Reference #3' on page \thepage \space undef
ined}\else \expandafter \Hy@setref@link #1\@empty \@empty \@nil {#2}\fi
#1<-\r@xlastpage
#2<-\@secondoffive
#3<-xlastpage
{\ifx}
{false}
{\expandafter}

\r@xlastpage ->{2}{4}

}}\toks 1=\expandafter {#7{#1}{#2}{#3}{#4}{#5}}\edef \x {\endgroup \the \toks 0
{\the \toks 1 }}\x
#1<-2
#2<-4
#3<-\@empty
#4<-\@empty
#5<-\@nil
! Argument of \Hy@setref@link has an extra }.
<inserted text>
\par

-

## closed as not a real question by Will Robertson, Loop SpaceFeb 8 '11 at 9:26

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. If this question can be reworded to fit the rules in the help center, please edit the question.

Please supply a minimal working example. We can't debug this without knowing what exactly you are doing. –  Lev Bishop Sep 8 '10 at 23:50
@Lev: Are you sure you don't mean a minimal failing example? –  SamB Oct 1 '10 at 15:57
@SamB: Minimal working example is a standard term, where "working" means "working just enough to show the problem". –  Lev Bishop Oct 2 '10 at 20:01
@Lev, @SamB — I've never understood where the ‘working’ term came from, myself. I just call them ‘minimal examples’ ;) –  Will Robertson Feb 7 '11 at 23:30
More seriously, I've flagged this question because it's largely useless to keep around, considering it's all but been retracted as a question by its author in a comment below. –  Will Robertson Feb 7 '11 at 23:33

But have you tried doing what you're doing by loading the lastpage package with \pageref{LastPage}?
Or alternatively, with \total{page} provided by the totcount package?
Or with \ref{TotPages}` from the totpages package?