[Tex/LaTex] How to make \autoref keep the surrounding color

autorefcolorhyperref

\autoref's link color is set using the linkcolor=black parameter of the \hypersetup command of package hyperref. This implies that the link color does not regard the color of its surrounding text. How do I make \autoref create links whose text color does regard the surroundings? At least in the sense of having the same color as the surrounding text?

Best Answer

An empty value disables the color, the example of egreg, simplified without the need for xcolor and without explicit color settings for links:

\documentclass{article}
\usepackage{color}

\usepackage[colorlinks,linkcolor={}]{hyperref}

\begin{document}

\section{Section title}\label{test}

This is an autoref to \autoref{test}

\textcolor{red}{This is an autoref to \autoref{test}}

\end{document}

If you do not want to have colors or borders for all kind of links, then option hidelinks is, what you are looking for:

\documentclass{article}
\usepackage{color}

\usepackage[hidelinks]{hyperref}

\begin{document}

\section{Section title}\label{test}

This is an autoref to \autoref{test}

\textcolor{red}{This is an autoref to \autoref{test}}

\end{document}
Related Question