Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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}

\Hy@setref@link #1#2#3#4#5#6\@nil #7->\begingroup \toks 0={\hyper@@link {#5}{#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
<to be read again>
share|improve this question
4  
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
1  
@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
add comment

closed as not a real question by Will Robertson, Andrew Stacey Feb 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.

1 Answer

I don't know what's causing your error; to even have a chance, I'd have to reproduce it, but I don't know what packages, etc., you're using.

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?

share|improve this answer
    
Problem solved: I had a look at how the hyperref package redefines \newlabel, and also at nameref and gettitlestring packages. –  Ahmed Musa Sep 9 '10 at 16:29
    
@Pluto: Great that you found it! In such cases it would also be great if you post it as answer instead of a comment, just for clarity. This helps readers finding your solution easier. You could even mark your own answer as accepted. –  Stefan Kottwitz Feb 4 '11 at 20:39
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.