1

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
\linespread{1.5}
\topmargin 0pt
\textwidth 6.5in
\textheight 8.5 in 
\usepackage[colorlinks = true,
            linkcolor = blue,
            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}.
\begin{equation}
\label{main}
A=B
\end{equation}

\section{Section 2}
\label{sec2}

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

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


\end{document}
Mico
  • 506,678
Star
  • 186
  • Why are you using explicit layout parameters -- use the geometry package for that! –  Mar 01 '17 at 13:01

1 Answers1

2

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.)

enter image description here

\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
    \hyper@linkstart{footnote}{\Hy@footnote@currentHref}%
    \@makefnmark
    \hyper@linkend
    \ifhmode\spacefactor\@x@sf\fi
    \relax
  }%
\makeatother

\hypersetup{colorlinks = true,
            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}.

\begin{equation} \label{main} 
A=B 
\end{equation}

\section{Second} \label{sec2}

\begin{thebibliography}{9}

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

\end{thebibliography}

\end{document}
Mico
  • 506,678
  • 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) ]... – Star Mar 01 '17 at 13:38
  • Also how can I get light blue instead of blue? – Star Mar 01 '17 at 13:48
  • Is there any solution without using the \cite machinery but the simpler \hyperlink/hypertarget? – Star Mar 01 '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 01 '17 at 14:02
  • @user3285148 - Since you're loading the xcolor package with the option dvipsnames, you could choose from Cerulean, CornflowerBlue, ProcessBlue, RoyalBlue, and SkyBlue, as well as Aquamarine, Cyan, Periwinkle, and TealBlue. I'm afraid I'm not a color consultant, and at any rate I don't know which shade of "light blue" is right for you. May I suggest you peruse pp. 38-40 of the user guide of the xcolor package for a longer list of predefined colors? Hopefully, you'll find a suitable shade of blue. – Mico Mar 01 '17 at 14:06
  • 1
    @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 01 '17 at 14:21