[Tex/LaTex] Suppress link (or just the color) of a specific \nameref

colorhyperref

The links that I'm creating with the hyperref package (e.g., references to other sections/chapter) are all coming out with a color that I've defined. That's as intended and it's working fine.

But I need to suppress the color of a specific reference. One that was created with \nameref. I just need the text of the referred section to be included. I don't want it to be colored differently. Any way to achieve this?

If, instead, there's a way to turn the named reference into ordinary text (i.e., also remove the link) it would be ok too.

Best Answer

Package hyperref provides star forms of the referencing commands to get the reference without the link (and link color):

\documentclass{article}

\usepackage[colorlinks]{hyperref}

\begin{document}
  \section{Hello World}
  \label{hello}
  Name reference with link: \nameref{hello}\\
  Name reference without link: \nameref*{hello}\\
  Reference with link and without color:
    {\hypersetup{hidelinks}\nameref{hello}}
\end{document}

Result