I assume this was done by design, seeing as the introduction of hyperlinks may clutter the user's view of the actual text. Moreover, not all hyperlink typesetting is printable - as you've mentioned, the PDF hyperlink is merely "a rectangular area of the page that is mouse-aware". However, if you want to do this, there are two options available
Manual
You deactivate the colorlinks
option so that hyperref
sets the link border:
\hypersetup{%
colorlinks=false,% hyperlinks will be black
linkbordercolor=red,% hyperlink borders will be red
pdfborderstyle={/S/U/W 1}% border style will be underline of width 1pt
}
and typeset the text manually using \color{<color>}
. For example:
...
\begin{document}
\section{To See}\label{tosee}
\hyperref[tosee]{\color{green}just to see}
\end{document}
Note that this is virtually the same as what hyperref
does internally, since the text colour is modified and will typeset this way even if the hyperlink is removed via printing to PDF (or flattening).
The advantage behind this approach (motivating to include it here) is that you can specify different colours for each hyperlink, if you so wish.
Automatic
You activate the colorlinks
option so that hyperref
sets the link colour in the text
\hypersetup{%
colorlinks=true,% hyperlinks will be coloured
linkcolor=green,% hyperlink text will be green
linkbordercolor=red,% hyperlink border will be red
}
and then add the following after the above \hypersetup{...}
:
\makeatletter
\Hy@AtBeginDocument{%
\def\@pdfborder{0 0 1}% Overrides border definition set with colorlinks=true
\def\@pdfborderstyle{/S/U/W 1}% Overrides border style set with colorlinks=true
% Hyperlink border style will be underline of width 1pt
}
\makeatother
Here is the pdfborderstyle
specification from Adobe:
Package hyperref
provides star forms of the referencing commands to get the reference without the link (and link color):
\documentclass{article}
\usepackage[colorlinks]{hyperref}
\begin{document}
\section{Hello World}
\label{hello}
Name reference with link: \nameref{hello}\\
Name reference without link: \nameref*{hello}\\
Reference with link and without color:
{\hypersetup{hidelinks}\nameref{hello}}
\end{document}
Best Answer
I don’t know
Lyx
, so I can only show you a pureLaTeX
solution:You can use
\hypersetup
several times:First I’ve defined red link colour inside the
hyperref
package options (the two others are for better recognizability). This could have been done in a first separate\hypersetup
, too.After the table of contents I’ve put one
\hypersetup
for blue link colour, and later I set another one, just to show you the opportunity.