[OS X TeX] Underlined links with hyperref

Thomas Schröder hydrochlorix at gmx.net
Sun Mar 20 15:24:55 CET 2005


Dear List,

I'm preparing my thesis with pdflatex and the hyperref package. As many  
others, I'm not very fond of the rectangle around  hyperlinks when  
previewing the resulting pdf in Adobe Reader and I'd rather have them  
underlined. I've been doing some googling and learned that the  
rectangle is produced by Adobe Reader and that there's nothing you can  
do about it, really. But then I came across this posting

http://groups.google.com/groups?hl=de&lr=&client=safari&rls=de- 
de&selm=991919386.946568%40newsmaster-04.atnet.at

which is in German and says that the PDF specifications state that  
there are also other styles next to the boxed style, specifically an  
underlined style, but that this person couldn't do it, not even in low  
level PDF. This intrigued me enough to go to someone who had Acrobat  
Professional 6 and open my thesis with it. With Acrobat 6 I changed the  
very first link in the document which is the enty of the first chapter  
in the table of contents to link type as visible rectangle and line  
style as underlined (sorry if the German translations don't excatly  
match with the original English menu entries). This gives a nicely  
underlined hyperlink.

I then compared the two links in TextMate. This is the link produced by  
pdflatex:

obj <<
/Type /Annot
/Border[0 0 1]/H/I/C[0.053 0.463 0.919]
/Rect [65.145 617.344 172.205 630.055]
/Subtype /Link
/A << /S /GoTo /D (chapter*.2) >>
 >> endobj

This is the same link that I changed in Acrobat 6 after cleaning it up  
to more resemble pdflatex's output:

obj <<
/H /I /Type /Annot
/Rect [65.145004 617.344055 172.205002 630.055054]
/Border[0 0 1]/BS<</W 1/Type/Border/S/U>>
/Subtype /Link
/A << /D (chapter*.2) /S /GoTo >> / C[0.053 0.463 0.919]
 >>endobj

The dimensions in the /Rect command have changed a little as has the  
order of some commands, but other than it's kind of clear I guess. The  
/C command defines my own IMO very nice blue color, BTW :-)

Therefore, after making a backup of course :-), I changed hpdftex.def's  
definition of all of its /Border commands from

/Border[\@pdfborder]%

to

/Border[\@pdfborder]/BS<</W 1/Type/Border/S/U>>%

And low and behold! I get nicely underlined links in my pdf!

pdflatex's output now looks like this:

obj <<
/Type /Annot
/Border[0 0 1]/BS<</W 1/Type/Border/S/U>>/H/I/C[0.053 0.463 0.919]
/Rect [65.145 617.344 172.205 630.055]
/Subtype /Link
/A << /S /GoTo /D (chapter*.2) >>
 >> endobj

I thought some of you might like this, too so, here it is. I don't  
really know if this is really correct and all, but if nobody finds a  
really bad error maybe I should get back to Heiko Oberdiek, the  
original author of hyperref, so he might work this in to make it an  
option in future releases? What do you guys think?

	Best wishes, Thomas

--------------------- Info ---------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
           & FAQ: http://latex.yauh.de/faq/
TeX FAQ: http://www.tex.ac.uk/faq
List Post: <mailto:MacOSX-TeX at email.esm.psu.edu>





More information about the macostex-archives mailing list