1

Is there a way to reference things with \ref using a different color than with what \hypersetup assigns it? That is, I would like to reference a theorem with blue text in general, but at some point I'd like to reference it with red text. I've tried using \textcolor but that doesn't seem to override it.

0

1 Answer 1

6

You can switch colours mid-document using \hypersetup:

enter image description here

\documentclass{article}

\usepackage{hyperref,xcolor}

\hypersetup{
  colorlinks % Defaults to red
}

\begin{document}

\section{A section}\label{sec:section}

See Section~\ref{sec:section}.

\hypersetup{linkcolor=green}

See Section~\ref{sec:section}.

\hypersetup{linkcolor=red}

See Section~\ref{sec:section}.

\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .