TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

The tutorial LaTeX/Hyperlinks shows that the following should be compilable.





However, I cannot compile it. Is it necessary to escape underscores in \href with a pair of $s or \?

Note that escaping the underscores with a pair of $ does not make sense in the above context, of course!

share|improve this question
up vote 15 down vote accepted

You need to escape the printed text (the second argument) since that is interpreted by LaTeX. The first argument is set according to the PDF specification which doesn't follow the same rules:

enter image description here





You could also use \textunderscore in place of \_.

share|improve this answer
Should this be edited in the Wikibook the OP linked to? Or could there be a case when the code as shown there would just work? – Jake Apr 26 '12 at 6:53
@Jake: It looks to me like a bad example, since \nolinkurl removes the requirement to escape the underscore. Perhaps if the example used my-address@wikibooks.org instead, it would be less error-prone. – Werner Apr 26 '12 at 6:59
I really miss an \email macro by hyperref which handles this itself. – Martin Scharrer Apr 26 '12 at 7:07

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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