\ref 没有输出好的参考

\ref 没有输出好的参考

我有一个大.aux文件(850行),其中包含以下行:

\newlabel{aumilieudesalarmes}{{6}{\pageref  {86testpage}}}

当我设定时\ref{aumilieudesalarmes},我希望看到6

但是,在这种情况下,我明白了55

ref除了获取文件中指示的值之外还执行其他操作吗.aux

最奇怪的是,如果我创建 MWE,就不会遇到这个问题……

例如:

\documentclass[9pt]{extbook}    
%pdfLaTeX
\usepackage[TS1,T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{ebgaramond}

\usepackage[french]{babel}


\newcommand\titre{%
\vspace{1em}%
{\centering%
AMAZING POEM\par%
}%
}

\usepackage{ifthen}% provides \ifthenelse
\usepackage{xifthen}% provides \isempty test
\newcounter{NumberNote}
\setcounter{NumberNote}{0}
\newcounter{nbrefpage}
\setcounter{nbrefpage}{0}
\newcommand\note [2][]{%
    \stepcounter{nbrefpage}%
    \def\tmpnbrefpage{\arabic{nbrefpage}testpage}%
    \mbox{\label{\tmpnbrefpage}}%
    \stepcounter{NumberNote}%
    \footnote{#2}%
    \ifthenelse{\isempty{#1}}{}%
    {%
        \customlabel{#1}{\arabic{NumberNote}}{\pageref{\tmpnbrefpage}}%
    }%
}

\makeatletter%
\newcommand{\customlabel}[3]{%
\protected@write \@auxout {}{\string \newlabel {#1}{{#2}{#3}}}%
}%
\makeatother%


\begin{document}
see the (savant!) note~\ref{a_savant_note}, page~\pageref{a_savant_note}

\titre{}
\begingroup
\obeylines
I'm an amazing poem\note[a_simple_note]{a simple note}
I'm an amazing poem
I'm an amazing poem\note{an anoter simple note}
I'm an amazing poem
I'm an amazing poem
I'm an amazing poem
I'm an amazing poem\note{an anoter simple note}
I'm an amazing poem\note{an anoter simple note}
I'm an amazing poem
I'm an amazing poem
I'm an amazing poem\note{an anoter simple note}
I'm an amazing poem\note{an anoter simple note}
I'm an amazing poem\note[a_savant_note]{a SAVANT note}
I'm an amazing poem\note{an anoter simple note}
\endgroup

\end{document}

使得这种.aux

\relax 
\catcode `:\active 
\catcode `;\active 
\catcode `!\active 
\catcode `?\active 
\babel@aux{french}{}
\newlabel{1testpage}{{}{1}}
\newlabel{a_simple_note}{{1}{\pageref  {1testpage}}}
\newlabel{2testpage}{{}{1}}
\newlabel{3testpage}{{}{1}}
\newlabel{4testpage}{{}{1}}
\newlabel{5testpage}{{}{1}}
\newlabel{6testpage}{{}{1}}
\newlabel{7testpage}{{}{1}}
\newlabel{a_savant_note}{{7}{\pageref  {7testpage}}}
\newlabel{8testpage}{{}{1}}

并且从逻辑上讲,当我调用\ref{a_savant_note}该示例时,我得到了好的数字7

我不知道为什么在实际工作中,我得到的数字与实际写的数字完全不同.aux......

抱歉,这个问题可能太开放了。

编辑

我必须明确一点,在实际工作中,当我输入时\ref{aumilieudesalarmes},我会得到良好的页面引用值,在这种情况下\pageref {86testpage},它引用了另一个经过正确评估的标签。

相关内容