\pageref 和 hyperref

\pageref 和 hyperref

请问有人能告诉我以下错误的来源吗?

我只是进入

\label{xlastpage} on last page

和电话

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

出现了以下有趣的错误。

%%%%%%%%% 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>

答案1

我不知道是什么导致了你的错误;为了有机会,我必须重现它,但我不知道你使用了什么软件包等。

但你有没有试过这样做,通过加载最后一页包装有\pageref{LastPage}

或者,\total{page}使用由总计数包裹?

或者\ref{TotPages}总页数包裹?

相关内容