[Tex/LaTex] Specify Color for autoref Without Affecting Other Document Links

autorefcolorhyperref

I am creating a document to be used by people not familiar with TeX. I am using the autoref command throughout the document to refer to tables, figures, etc. I would like to clearly signal to my audience that these are clickable internal links by making the links a different color from the surrounding text. By configuring the hyperref package options in the preamble, I can change the color of all of the links in my document. E.g.

\usepackage{xcolor}
\usepackage[colorlinks = true,
            linkcolor = blue,
            urlcolor  = black,
            citecolor = black,
            anchorcolor = black]{hyperref}

But, this also results in my footnotes, table of contents entries, etc. turning colors and that creates a confused, "busy," and unhelpful appearance to my document. I would thus like a way to change only the color that appears for the links when I use the autoref command.

How can I accomplish this?

Best Answer

This can be accomplished by defining a new version of the autoref command that will have the desired formatting. For example, in the preamble, add:

\newcommand\colorAutoref[1]{{\hypersetup{linkcolor=blue}\autoref{#1}}}  %% allows for calls to \autoref{} that have a different color from other links.

Then, in the document, where you want to add your autorefs, just use:

As can be seen in \colorAutoref{fig:2} the presentation of this document is now more clear.
Related Question