I would like the internal hyperlinks generated by hyperref
to be colored and underlined.
Reading some of the package documentation, I know that these \hypersetup
keys exist:
colorlinks
: whentrue
, color the link; whenfalse
, draw a border around the link and color that.linkcolor
: the color of the link (requirescolorlinks=true
to have any effect)linkbordercolor
: the color of the link border color (requirescolorlinks=false
to have any effect)pdfborderstyle
: keys for the pdf borderstyle dictionary. I don't know what keys and values exist for this dictionary, but I do know thatpdfborderstyle={/S/U}
orpdfborderstyle={/S/U/W 1}
can change the link border from a box to an underline.
But it seems impossible with this key structure to have colored links (requiring colorlinks=true
) and colored borders (requiring colorlinks=false
).
Here is a minimal (non-)working example (via):
\documentclass{article}
\usepackage{xcolor}
\usepackage{hyperref}
\hypersetup{colorlinks=false,%
linkbordercolor=red,linkcolor=green,pdfborderstyle={/S/U/W 1}}
\begin{document}
\section{To See}\label{tosee}
\vskip2cm
\hyperref[tosee]{just to see}
\end{document}
With colorlinks=false
(the default) the text is black and the border is red.
With colorlinks=true
the text is green and there is no border.