[pdftex] Underscore in URL using hyperref (very old issue?)

Barry McMullin mcmullin at eeng.dcu.ie
Tue Apr 16 10:20:40 CEST 2002


On Mon, 15 Apr 2002, Peter Ryder wrote:

> I reproduced your errors with this version..
[...]
> and found out by trial and error that the solution is just to type in the
> underscore from the keyboard, as if in a \verb environment:

Many thanks to everybody who responded on this question.

While it's clear that I probably need to upgrade my TeX
installation (and thanks for the recommendation of the TeX live
distribution), Peter's point above does seem to be accurate, and
gets me working in the short term.

For the record: things were actually a bit more complicated for
me: I had simplified the example I posted to get the "simplest"
test case.  But what I was "really" doing, was defining a macro
of my own, looking more or less like this:

  \newcommand{\hoturl}[1]{\href{#1}{#1}}

The idea being to expose the url and make it "hot" at the same
time. But this runs into problems because - as Peter rightly
suggests - special characters, such as underscore, should *not*
be escaped in the first argument to \href, but *should* be
escaped in the second.  So simply duplicating one argument into
both contexts messes up no matter what (i.e., whether that one
argument has escaped characters or not).  I briefly tried this:

  \newcommand{\hoturl}[1]{\href{#1}{\url{#1}}}

but that generated a cascade of other complaints, so I have given
up for now, and settled for just using \href directly (and having
to "manually" duplicate url arguments, and fine tune them, where
what I want is a "hot url").  Possibly there are better ways to
tackle this - any suggestions?

Thanks again,

- Barry.






More information about the pdftex mailing list