2

Links coming from ref or gls are accompanied by boxes (I know about colorlinks and the possibility to switch them off). I somehow like the idea of the boxes but the lines are way to thick in my opinion. Is there a way to make them thinner? I didn't find anything in hyperref, except pdfborder which seems to work for Sumatra but not Acrobat reader.

Just to clarify I mean the red box in this image:

enter image description here

  • 1
    Did you write \hypersetup{pdfborder={0 0 0.4}} to have a 0.4pt linewidth? For me, it works with Adobe Reader as well. – Bernard Dec 19 '14 at 12:48
  • @Bernard. Hm this didn't work for me. I had to but the border at 0.6 and make the link color brighter as explained in the answer from wipert – magu_ Dec 19 '14 at 13:03
4

This parameter is controlled by the attribute at PDF low level:

attr{/C[red green blue] /Border[0 0 thin]}

for example

attr{/C[1 0 0] /Border[0 0 .6]}

My experiences show that doing this lines thinner than .6 bp makes the lines invisible on some PDF viewers. Unfortunately. So, I advice to make the color less striking.

  • Ah, that's the thing. Thank you for pointing this out. In fact I tried something like pdfborder = {0 0 0.6 [0.1 0.1]}, which even resulted in crashing Acrobat... It's a shame that this reader is still a standard reader... – magu_ Dec 19 '14 at 13:01
5

Option pdfborder is the way to go with hyperref. The "exact" definition of the three values can be found in the PDF specification (units are bp):

  • First value: horizontal corner radius,
  • second value: vertical corner radius,
  • the third value is the line thickness,
  • as forth element, a dash array can be provided.
\documentclass{book}
\usepackage{hyperref}

\begin{document}
  \autoref{eq:einstein}\quad
  {\hypersetup{pdfborder=0 0 2}\autoref{eq:einstein}}\quad
  {\hypersetup{pdfborder=0 0 .5}\autoref{eq:einstein}}

  \newpage
  \setcounter{chapter}{5}
  \setcounter{equation}{1}
  \begin{equation}
  E=mc^2\label{eq:einstein}
  \end{equation}
\end{document}

However, the interpretation heavily depends on the PDF viewer. For example, the line thickness does not scale with the zoom level.

AR9/Linux, 100% and 200%:

AR9/Linux, 100% AR9/Linux, 200%

xpdf 3.03, 100% and 200%:

xpdf, 100% xpdf, 200%

The line thickness in AR remains constant regardless of zoom factor. A different way of interpreting the line thickness is done by xpdf. There the thickness follows the zoom level.

BTW, important note: Curly braces are needed around the value for pdfborder, if the option is given in \usepackage, because LaTeX would strip the spaces between the values otherwise. The curly braces are not necessary, when the values are set in \hypersetup.

\usepackage[pdfborder={0 0 1}]{hyperref}
  • I don't see any result on changing the first and/or second values to, say, 2. Ang I don't understand how to specify the fourth element to obtain a dashed frme (is that so?). – Bernard Dec 19 '14 at 13:22
  • @Bernard If you don't see change in line thickness, then you need a PDF viewer, which supports these settings. – Heiko Oberdiek Dec 19 '14 at 13:50
  • Oberdieck: You misunderstood me: I see the difference between pdfborder={0 0 0.5} and pdfborder={0 0 2}. But what about, say pdfborder={2 0 0.5}? I don't see any difference using 0 or 2 as first parameter. Btw, I use SumatraPDF, but also occasionally Adobe Reader or PDFXChange Viewer. – Bernard Dec 19 '14 at 13:55
  • @Bernard Each viewer is different, there might be rounding issues, or a viewer is using a minimal width (1 pixel). – Heiko Oberdiek Dec 19 '14 at 14:07
  • Oberdieck: maybe, but each of my three viewers give the same result. And wh – Bernard Dec 19 '14 at 14:31

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.