0

In continuation of a question asked here, why is it that

This doesn't work (\ref{} inside the description)

Complete 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}

May I ask why?

Do let me know if I can provide any more details.

EDIT:

MWE complete. Of course I also want to know 'how' to make it work. Not just the why? :P

abyshukla
  • 411
  • MWE with all relevant data would be more helpful as you preamble is rather large. – Budo Zindovic Dec 19 '16 at 10:52
  • apologies. The complete MWE has been posted. Stripped of everything.... The previous comment was stupid. I will remove it. – abyshukla Dec 19 '16 at 10:57
  • You get the warning LaTeX Warning: Reference \fn:onlyCol' on page 1 undefined on input line 29.because you have a\refbut never set a\label` with that value. – David Carlisle Dec 19 '16 at 11:00
  • If I add aaaaaa\footnote{\label{fn:onlyCol}aaaaaaa} after \begin{document} the reference works as expected. – David Carlisle Dec 19 '16 at 11:04
  • Apologies. It works because the \ref{} was outside the \item[]. I have corrected the MWE. So the problem appears now... – abyshukla Dec 19 '16 at 11:06

1 Answers1

2

now you get the error

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

The problem is that you have uppercased the reference string.

You could use \MakeTextUppercase from the textcase package that tries to step past such things or simply hide it in a macro

\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}
David Carlisle
  • 757,742