# Changing the colours used in hyperlinked cross-references

This is a simplified example of the Latex code for my document. I want to change the colours of the different links (made through \ref and \hyperlink).

Specifically, I want to have

-equations: black (not blue)

-sections: black (not blue)

-authors: blue but lighter than the one I have now

-footnote: red (not black). (Also, the link for the footnotes does not seem to work. I think it is because of the multiple option of footmisc. Any idea on how to fix this?)

\documentclass[10 pt,a4paper,oneside,openany, notitlepage]{article}
\usepackage[usenames,dvipsnames]{xcolor}
\usepackage{amsmath, amssymb, graphics}
\marginparwidth 0pt
\oddsidemargin 0pt
\evensidemargin 0pt
\marginparsep 0pt
\topmargin 0pt
\textwidth 6.5in
\textheight 8.5 in
urlcolor  = blue,
citecolor = blue,
anchorcolor = blue]{hyperref}
\usepackage[multiple]{footmisc}

\begin{document}
\section{Section 1}
\label{sec1}
This main result\footnote{There are other minor results.} of \hyperlink{Tom}{Tom (2017)} is summarised by equation (\ref{main}). Similar arguments are discussed in Section \ref{sec2}.
$$\label{main} A=B$$

\section{Section 2}
\label{sec2}

\newpage
\begin{center}
\section*{References}
\end{center}

\begin{description}
\item \hypertarget{Tom}{ } Tom, 2017, Journal.
\end{description}

\end{document}

• Why are you using explicit layout parameters -- use the geometry package for that! – user31729 Mar 1 '17 at 13:01

I suggest you make use of this answer by Marco Daniel to define a hyperref parameter called "footnotecolor". I further suggest you use the \cite machinery of the natbib package to create citation call-outs. (Better yet, learn how to use BibTeX -- and let BibTeX and LaTeX create both the formatted bibliography and all citation call-outs.)

\documentclass[10pt,a4paper,oneside,openany,notitlepage]{article}
\usepackage[usenames,dvipsnames]{xcolor}
\usepackage{amsmath,amssymb,graphics}
\usepackage[multiple]{footmisc}
\usepackage[textwidth=6.5in,textheight=8.5in]{geometry}
\usepackage[authoryear,round]{natbib}

\usepackage{hyperref}
%% The following code is from a posting by Marco Daniel;
%% see https://tex.stackexchange.com/a/117959/5001.
\makeatletter
\def\@footnotecolor{red} % default color to use: 'red'
\define@key{Hyp}{footnotecolor}{%
\HyColor@HyperrefColor{#1}\@footnotecolor%
}
\def\@footnotemark{%
\leavevmode
\ifhmode\edef\@x@sf{\the\spacefactor}\nobreak\fi
\stepcounter{Hfootnote}%
\global\let\Hy@saved@currentHref\@currentHref
\hyper@makecurrent{Hfootnote}%
\global\let\Hy@footnote@currentHref\@currentHref
\global\let\@currentHref\Hy@saved@currentHref
\@makefnmark
\ifhmode\spacefactor\@x@sf\fi
\relax
}%
\makeatother

allcolors  = black, % default color
citecolor  = blue,
footnotecolor = red}

\begin{document}
\section{First} \label{sec1}

This main result\footnote{There are other, minor results.} of \citet{Tom} is summarised by equation \eqref{main}. Similar arguments are discussed in Section~\ref{sec2}.

$$\label{main} A=B$$

\section{Second} \label{sec2}

\begin{thebibliography}{9}

\bibitem[Tom(2017)]{Tom} Tom, 2017, Journal.

\end{thebibliography}

\end{document}

• Thanks. Suppose that I have authors with long names for a paper. Usually, what I write is: "the paper by Tom and Michael (2016) (hereafter TM) is ....". How can I link to the reference also "TM"? From your example it seems that I can specify only one way in which a paper can appear, in this case e.g. \bibitem[Tom and Michael (2016) ]... – user3285148 Mar 1 '17 at 13:38
• Also how can I get light blue instead of blue? – user3285148 Mar 1 '17 at 13:48
• Is there any solution without using the \cite machinery but the simpler \hyperlink/hypertarget? – user3285148 Mar 1 '17 at 13:56
• @user3285148 - Please familiarize yourself with the natbib citation management package. Among other things, it lets you set up citation aliases, precisely so that you can set up TM as call-out alias for Tom and Michael (2016). – Mico Mar 1 '17 at 14:02
• @user3285148 - More on citation aliases: Suppose you have a formatted bib entry that says "\bibitem[Tom and Michael(2016)]{TM:2016}Tom and Michael, 2016, Title.". Then issue the directive \defcitealias{TM:2016}{TM} in the preamble (after loading natbib, of course) and write something like As argued by \citet{TM:2016} (hereafter: \citetalias{TM:2016}), ... in the body of the document. That way, "TM" will also be hyperlink to the formatted entry. – Mico Mar 1 '17 at 14:21