描述环境中的 \ref{}(交叉引用)

描述环境中的 \ref{}(交叉引用)

继续提问这里,为什么

这不起作用(\ref{} 里面说明)

完成 MWE:

\documentclass[12pt, oneside, a4paper]{article}
\usepackage{xcolor}%                            for colors
\usepackage{enumitem}%                             Blue and bold numbers
\usepackage[colorlinks=true,
            urlcolor=VIARed,
            linkcolor=VIARed]{hyperref}%    Define clickable URL without boundaries around them

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%   Colour Declarations 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\definecolor{VIAGray}{HTML}{575759}
\definecolor{VIARed}{HTML}{C40F39}

\setlist[description,1]{font=\color{VIAGray}\MakeUppercase}
\setlist[description,2]{font=\color{VIAGray}\MakeUppercase}
\setlist[description,3]{font=\color{VIAGray}\MakeUppercase}

\begin{document}
\section{some section}\label{fn:onlyCol}
    \begin{description}
        \item[Activate brilliant feature\textsuperscript{\ref{fn:onlyCol}}] Activates the above mentioned brilliant feature.
    \end{description}
\end{document}

请问是为什么呢?

如果我可以提供更多详细信息,请告诉我。

编辑:

MWE 完成。当然,我也想知道“如何”让它发挥作用。不只是为什么?:P

答案1

现在你得到错误

LaTeX Warning: Reference `FN:ONLYCOL' on page 1 undefined on input line 21.

问题在于您将引用字符串变成了大写。

您可以使用尝试越过此类事情的包,或者简单地将其隐藏在宏\MakeTextUppercasetextcase

\documentclass[12pt, oneside, a4paper]{article}
\usepackage{xcolor}%                            for colors
\usepackage{enumitem}%                             Blue and bold numbers
\usepackage[colorlinks=true,
            urlcolor=VIARed,
            linkcolor=VIARed]{hyperref}%    Define clickable URL without boundaries around them

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%   Colour Declarations 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\definecolor{VIAGray}{HTML}{575759}
\definecolor{VIARed}{HTML}{C40F39}

\setlist[description,1]{font=\color{VIAGray}\MakeUppercase}
\setlist[description,2]{font=\color{VIAGray}\MakeUppercase}
\setlist[description,3]{font=\color{VIAGray}\MakeUppercase}

% would need \protect\foo when used
%\newcommand\foo{\textsuperscript{\ref{fn:onlyCol}}}

%LaTeX protect mechanism
%\DeclareRobustCommand\foo{\textsuperscript{\ref{fn:onlyCol}}}

%etex pfrotection mechanism
\protected\def\foo{\textsuperscript{\ref{fn:onlyCol}}}

\begin{document}
\section{some section}\label{fn:onlyCol}
    \begin{description}
        \item[Activate brilliant feature\foo] Activates the above mentioned brilliant feature.
    \end{description}
\end{document}

相关内容