Talk:LaTeX/Hyperlinks

Hyperref also works with plain 'latex', not only 'pdflatex'. One must specify the right driver instead of 'pdftex', though. I only tested it with 'dvipdfm' (dvi->pdf directly), so I don't know if the ps output has hyperlinks, but the pdf output does.

See for example the documentation at http://www.tug.org/applications/hyperref/manual.html

Addition
How about custom colours? Maybe you could add examples, like dark blue or teal (as in biblatex documentation for instance).

One can define custom colors for hyperref package by writing a small style file that adds to the predefined colors in the color.sty. Specifically create the following mycolor.sty file containing the following lines:

\RequirePackage{color}

\definecolor{bwgreen}{rgb}{0.183,1,0.5}

\definecolor{bwmagenta}{rgb}{1,0.169,0.909}

\definecolor{bwblue}{rgb}{0.317,0.161,1}

These particular colors provide a clear high contract result when printed in color or black and white. Therefore they are useful when making figures that need to be readable in color or monochrome.

To use the newly defined colors with hyperref in your LaTeX document:

\documentclass{article}

\usepackage{mycolor}

\usepackage{hyperref}

\hypersetup{linkcolor=bwmagenta}

[...]

Algorithms package
The following is stated in the end of the section named "Problems with links"

"The problem can also occur with the algorithms package: because each algorithm uses the same line-numbering scheme, the line identifiers for the second and follow-on algorithms will be duplicates of the first."

As I get around 300 errors due to this, any method for fixing it is much appreciated.

Problem with column separators
What if the url contains a symbol &amp; (ampersand)? How to use \href?
 * In the URL section of an href, it doesn't seem that the TeX processor much cares about ampersands. If the TeX processor gives you an error, escape the ampersand like "\&amp;".  If the link doesn't work as you expect it to in the final product, escape the ampersand for the browser by writing "&amp;amp;".  You may have to end up escaping the ampersand twice, writing "\&amp;amp;"
 * If it's the description that contains the ampersand, just use \&amp; instead of &amp; to escape the ampersand for the TeX processor.
 * 68.118.159.98 (talk) 06:53, 9 November 2008 (UTC)

Underlining?
Is there any way to automatically underline links in the final output using the hyperref package, as is common in the world wide web? Perhaps an "underline=true" configuration option? - 68.118.159.98 (talk) 06:55, 9 November 2008 (UTC)
 * The configuration option that works for me is "pdfborderstyle={/S/U/W 1}", but I've googled that some older pdf viewer may have problems rendering it.

Will table of contents be displayed as bookmarks (structured tree) in .pdf?
Hyperlinks will be in the pdf, but what about the bookmarks of the pdf? Kazkaskazkasako (talk) 10:32, 28 January 2009 (UTC)
 * everything that's included in the ToC will be included as bookmark. Because the Table of content isn't mentioned in the ToC itself it will not be included as a bookmark. Thijs(User talk:Thijs.de.meester) 9:58 14 july 2009 (UTC)

\hyperref example
It seems that including a \ref inside a \hyperref destroys its purpose: for the example given -- "\hyperref[mainlemma]{lemma \ref{mainlemma}}" -- only the lemma number is hyper-refed, and the "lemma " (sans quotes) part is not, whereas "\hyperref[mainlemma]{lemma blah}" would hyperref "lemma blah" (sans quotes). I will let someone more knowledgable than me correct it or correct me before changing it myself. Unco (talk) 23:08, 13 April 2009 (UTC)

\hyperlink and \hypertarget
I found it much more useful to use \hyperlink{labelname}{descriptive text about link} and \hypertarget{labelname}{} for referencing things in my document than \hyperref[labelname}{some text}. In fact, I couldn't get the \hyperref command to work in conjunction with a \label{labelname}, so I gave up and luckily found this little tidbit. Hope it helps.

ampersand problem
I need to have an ampersand in my url. I have to escape it by \& to be able to compile latex code. But in the url the whole \& is the shown and destroys the link. Anybody knows a workaround? Hm ok the problem only exists within a table where & is the column separator. --62.178.198.156 (talk) 20:48, 19 October 2009 (UTC)

I have the same problem. If there's a workaround for this, please let me know. Thanks.

Preventing a link?
I was wondering if there's a way to switch off the hyperlink for a particular thing. Eg I have "Page \thepage\ of \pageref{LastPage}" in my header, and each header has the last page number highlighted as a link. Of course, I could just wait until I was finished the document and replace it, but we all know that's not geek enough...Grj23 (talk) 04:10, 26 July 2010 (UTC)

Ah, of course. The starred form "\pageref*{LastPage}", does the trick! I wonder if this is worth incorporating into the main text, or is it too niche? It's of course in the manual...Grj23 (talk) 04:25, 26 July 2010 (UTC)

Acrobat question, or link depth
When I try to follow multiple links through Acrobat, say *click* *click*, links don't do anything. Exactly one link will work. I assume this is an Acrobat problem, but I have checked through every setting and nothing fixes it. Any ideas? 99.155.53.151 (talk) 08:35, 31 December 2010 (UTC)

Colors as rgb triples
From trial and error, I found out, that only the ...bordercolor values can be set as RGB triples. If this is true (and not, possibly, due to some other package clash or so), please state this explicitely in the article, and please give some information about the allowed colors for the others. This information seems to be completely omitted in the hyperref manual, by the way.--SiriusB (discuss • contribs) 12:57, 31 March 2011 (UTC)

Addition: I have inserted a note about RGB triples being only valid for bordercolors. Please correct this if it is wrong; but then please answer the question why rgb triples for non-border colors lead to an error message about unknown colors while the same works fine for bordercolors.--SiriusB (discuss • contribs) 13:04, 31 March 2011 (UTC)

It does too much!
Great, but what if I don't want to turn all my internal references into hyperlinks? Suppose I just want to create an ordinary pdf, with one or more links to webpages? The section on Hyperlinks ought to discuss that simpler question first.

Mistake in hypersetup?
I'm not a registered user, so I can't edit the book page, but I think there's a mistake in the section on using the \hypersetup command. The keyword attribute-value pair currently looks like: but I think there are missing brackets, and it should be: Can somebody change this?

"full link" is not defined
In the text

..."but will make the text link text a full link"...

the term "full link" is undefined, and to this naive user it is a mystery as to what is meant.