
Como mudar a cor da referência cruzada, quero que a etiqueta fique em preto e o número em azul como na imagem
\documentclass{article}
\usepackage{graphicx}
\usepackage{hyperref}
\usepackage{caption}
\begin{document}
Insert cross reference \autoref{figure}
\begin{figure}%h!
\centering
\includegraphics[]{example-image-a}
\caption{Validation procedure for LR model}\label{figure}
\end{figure}
\end{document}
Responder1
Acho que você precisa fazer três coisas:
- Defina sua cor azul.
- Atribua à chave do hyperref
linkcolor
a cor azul definida. - Patch
\HyRef@testreftype
para recorrer à cor do texto atual antes de entregar o nome/tipo da referência.
\documentclass{article}
\usepackage{graphicx}
\usepackage{xcolor}
\definecolor{mylinkcolor}{rgb}{0.561, 0.667, 0.863}
\usepackage[colorlinks=true, linkcolor=mylinkcolor]{hyperref}
\makeatletter
\newcommand\MyAutoefPhrasecolorGroup[1]{%
\color@begingroup\color{MyCurrentcolor}#1\endgroup
}%
\def\HyRef@testreftype#1.#2\\{%
\colorlet{MyCurrentcolor}{.}%
\ltx@IfUndefined{#1autorefname}{%
\ltx@IfUndefined{#1name}{%
\HyRef@StripStar#1\\*\\\@nil{#1}%
\ltx@IfUndefined{\HyRef@name autorefname}{%
\ltx@IfUndefined{\HyRef@name name}{%
\def\HyRef@currentHtag{}%
\Hy@Warning{No autoref name for `#1'}%
}{%
\edef\HyRef@currentHtag{%
\noexpand\MyAutoefPhrasecolorGroup{%
\expandafter\noexpand\csname\HyRef@name name\endcsname
}%
\noexpand~%
}%
}%
}{%
\edef\HyRef@currentHtag{%
\noexpand\MyAutoefPhrasecolorGroup{%
\expandafter\noexpand
\csname\HyRef@name autorefname\endcsname
}%
\noexpand~%
}%
}%
}{%
\edef\HyRef@currentHtag{%
\noexpand\MyAutoefPhrasecolorGroup{%
\expandafter\noexpand\csname#1name\endcsname
}%
\noexpand~%
}%
}%
}{%
\edef\HyRef@currentHtag{%
\noexpand\MyAutoefPhrasecolorGroup{%
\expandafter\noexpand\csname#1autorefname\endcsname
}%
\noexpand~%
}%
}%
}%
\makeatother
\usepackage{caption}
\begin{document}
{\bfseries\verb|\autoref|-references with hyperlink:}
Textcolor unchanged: Insert cross reference \autoref{figure}
Textcolor sawitched to green: \textcolor{green}{Insert cross reference \autoref{figure}}
{\bfseries\verb|\autoref*|-references without hyperlink:}
Textcolor unchanged: Insert cross reference \autoref*{figure}
Textcolor sawitched to green: \textcolor{green}{Insert cross reference \autoref*{figure}}
\begin{figure}%h!
\centering
\includegraphics[]{example-image-a}
\caption{Validation procedure for LR model}\label{figure}
\end{figure}
\end{document}
Com \autoref
-referências com hiperlinks, a frase "Figura" ocorre na cor do texto ao redor e é clicável como o número que ocorre na cor indicada pela linkcolor
-chave do hiperref.