Specify Link Color Using LaTeX hyperref Package

Jun. 02, 2024

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
\documentclass{article}
\usepackage[margin=1in]{geometry}
\geometry{a4paper}
\usepackage[x11names]{xcolor}
\pagecolor{AntiqueWhite1}

\usepackage[
hyperfootnotes=true,
colorlinks=true,
linkcolor=violet,
anchorcolor=orange,
citecolor=green, 
filecolor=red,
runcolor=cyan,
urlcolor=blue 
]{hyperref}

\newcommand{\myhypertarget}[3][orange]{\hypertarget{#2}{\textcolor{#1}{#3}}}

\begin{document}
\tableofcontents

\section{Introduction}
\label{sec-introduction}
\begin{tabular}{ll}
	Website       & \href{www.wikipedia.com}{Wikipedia}\\
	File          & \href{readme.txt}{Open ``./readme.txt''}\\
	Run file      & \href{run:readme.txt}{Run ``./readme.txt''}\\
	Footnote      & footnote\footnote{This is a footnote.}\\
	Internal link & \hyperref[sec-introduction]{Introduction}\\
	\hypertarget{link}{Anchored by ``hypertarget"} & \hyperlink{link}{Link to tag ``link''.}\\
	\myhypertarget{mylink}{Anchored by ``myhypertarget"} & \hyperlink{mylink}{Link to tag ``mylink''.}\\
	Cite reference & \cite{b1}\\
\end{tabular}

\vspace{7em}

footnote\footnote{This is a footnote.}.

\vspace{7em}

\begin{thebibliography}{00}
\bibitem{b1} \href{https://tex.stackexchange.com/questions/478463/anchorcolor-in-hyperref-not-working}{anchorcolor in hyperref not working?}
\end{thebibliography}

\end{document}

img-1

As can be seen, the footnote in the table can’t be seen. This problem is discussed in detail in blog1.


References