10

How can I achieve in the following MWE that the box surrounding the link gets coloured in blue?

\documentclass{article}
\usepackage{color}
\usepackage[linkcolor=blue]{hyperref}
\begin{document}
  \begin{equation}\label{a}
    x
  \end{equation}
  \ref{a}
\end{document}
13

You need to set the specific border colour. In your case, linkbordercolor={0 0 1} where the default is linkbordercolor={1 0 0} (or red in the RGB model).:

enter image description here

\documentclass{article}
\usepackage{color}% http://ctan.org/pkg/color
\usepackage[linkbordercolor={0 0 1}]{hyperref}% http://ctan.org/pkg/hyperref
\begin{document}
  \begin{equation}\label{a}
    x
  \end{equation}
  \ref{a}
\end{document}​

Alternatively, loading xcolor provides the regular "named" colours, allowing one to use

\usepackage[linkbordercolor=blue]{hyperref}% http://ctan.org/pkg/hyperref

Different colours can be used for different hyperlinks. hyperref provides

  • citebordercolor (RGB colour) with default {0 1 0}: The colour of the box around citations
  • filebordercolor (RGB colour) with default {0 .5 .5}: The colour of the box around links to files
  • linkbordercolor (RGB colour) with default {1 0 0}: The colour of the box around normal links
  • menubordercolor (RGB colour) with default {1 0 0}: The colour of the box around Acrobat menu links
  • urlbordercolor (RGB colour) with default {0 1 1}: The colour of the box around links to URLs
  • runbordercolor (RGB colour) with default {0 .7 .7}: Colour of border around ‘run’ links
  • allbordercolors (RGB colour): Set all border color options

See the hyperref documentation (specifically, section 3.6 PDF-specific display options).

  • Thanks. That's what I tried too but I didn't add blanks between the RGB code and hence got an error. By the way, is it also possible to have the box filled? – lpdbw Aug 16 '12 at 18:17
  • @lpdbw: This would most likely have to be set in the PDF specification, to which hyperref does not provide an interface, AFAIK. For example, there are many border-specific changes one can implement, as suggested in section 8.12 Entries in a border style dictionary (p 495) of the PDF Reference 3rd Ed. Don't know whether PDF specification provides a fill or not. Heiko Oberdiek might be able to elaborate on that. – Werner Aug 16 '12 at 18:21
  • If package xcolor is loaded, the normal color specifications can be used for the *bordercolors: linkbordercolor=blue (since hyperref 2007-04-09 6.76a). – Heiko Oberdiek Aug 16 '12 at 20:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.