# [OS X TeX] OT: setting the look of hyperlinks with hyperref

Bruno Voisin bvoisin at mac.com
Mon Mar 29 05:57:00 EST 2004

Hi,

This is an OT posting in case some of the hyperref gurus on this list
are listening. I've looked _very_ briefly at FAQs and at a
comp.text.tex archive, but found no answer.

In short: is there an obvious interface for setting precisely the look
of hyperlinks with hyperref.sty, without having to redefine low-level
commands?

In all the gory details: I'm writing, in LaTeX, a PDF report calling
the hyperref package and inserting hyperlinks through \url (for
text). I've chosen the links to appear colored, which is achieved by
setting the option colorlinks to true:

\usepackage[dvipsnames]{color}
urlcolor=myblue,
bookmarks=true,
pdfstartview=FitH]{hyperref}

\definecolor{myblue}  {named}{MidnightBlue}
\definecolor{myred}   {named}{RedViolet}

At the same time, this option suppresses the box (invisible in Preview,

Alas, in the same report I'm also using text coloring as a way to
highlight different concepts:

\definecolor{mygreen} {named}{PineGreen}
\definecolor{myorange}{named}{Tan}

\newcommand{\field}[1]{<<~\textcolor{myorange}{#1}~>>}
\newcommand{\choice}[1]{<<~\textcolor{mygrey}{#1}~>>}

and I would like the hyperlinks to be visually different, so that no
ambiguity arises, for example, for somebody reading a printed version
of the report.

Hence I thought of having the hyperlinks colored _and_ underlined, as
is usual with web browsers. Spending some time in the guts of
hyperref.sty, and also getting the documented source code hyperref.dtx,
I finally came out for \url (built on \url@) with the replacement of:

by

and for \href (built on \href@ built on \href at split built on

\protected at edef\Hy at tempa{#2}%
\ifx\Hy at tempa\@empty
\else
\fi
}

by

\protected at edef\Hy at tempa{#2}%
\ifx\Hy at tempa\@empty
\else
\fi
}

It works, but I'm confused: is it really necessary to go to such
low-level commands (especially in the second case)? Is there an obvious
solution or interface that I've missed?

Bruno Voisin

-----------------------------------------------------