[l2h] hyperref.sty vs. html.sty: "\textunderscore undefined"

Julius Smith l2h@w3k.org
Fri, 13 Sep 2002 16:19:11 -0700

At 08:54 PM 9/13/2002 +1000, Ross Moore wrote:
>In which order did you load the packages ?
>If you do
>  \usepackage{hyperref}
>  \usepackage{html}
>Then it should work OK, since there is coding in  html.sty  to
>check whether hyperref has been loaded already, and act accordingly.

Aha! My ordering was in fact the opposite, as recommended in the hyperref 
documentation.  I have now interchanged the order, and the behavior is 
indeed different:

* The anchor text in \htmladdnormallinkfoot is no longer linked in the PDF 
(which I miss).  The cursor changes to a hand-index-finger-pointer when the 
mouse rolls over the footnote number itself, as if it were a link, but it 
doesn't seem to go anywhere.  Perhaps it just links to the page containing 
the footnote, which is usually the current page.

* The footnote from \htmladdnormallinkfoot is now linked in the PDF (an 
improvement, in my opinion).

* (The anchor text within \htmladdnormallink is PDF-linked as before.)

* The \url{} quoting solution I posted earlier no longer works.  Now, all 
footnote URLs (on one particular page in the PDF file, anyway) point to the 
same bogus URL:


which was apparently derived from the first footnote URL 
(http://www-ccrma.stanford.edu/~jos/intro320/Online_Reference.html).  All 
URLs look fine in the footnotes, and they look right in the PostScript file 
as well.  All links work correctly in the HTML.  Thus, only the PDF seems 
to be thrown off by something.

* URLs in the second argument of htmladdnormallinkfoot which are NOT 
enclosed by \url{} have the problem (in the PDF file) of empty boxes 
remaining quoted in the URL, e.g.,


As we all know, '\~' must be entered as '\~{}' to avoid being interpreted 
as calling for a tilde over the next character when processed by 
TeX.  (Note that this problem persists with either ordering of hyperref.sty 
html.sty.)  I presently have no workaround for this problem using the new 
ordering of the packages.

In summary, my only workaround at present (which seems complete, as far as 
I have tested) is to use the package order


as requested in the hyperref installation notes, and to quote all URLs 
using \url{} rather than trying to quote '~' "in the open", which fails 
because '\~{}' translates to '~{}' in the PDF URLs.

> > 
> \htmladdnormallinkfoot{description}{\url{http://www.somewhere.org/~name/file_name.html}}
>You don't need the  \url ; indeed it is just plain wrong,
>so I'm surprised to here you say that it works.

That's too bad, because presently it is the only thing that does work in 
all contexts that I've seen so far.  I will continue my testing and report 
any problems I discover.

It appears the "right" solution is for '{}' to be stripped out of URLs in 
the PDF.  I don't think it can work to simply define \~ (in hyperref) as 
having an argument (which would gobble up the '{}'), because then regular 
tildes would not work (unless the definition was somehow confined to URL 

By the way, the newest version of hyperref, does seem to fix the '\_' 
problem in all contexts that I've tested, so that's some real progress --- 
thanks to Heiko Oberdiek for that.  Perhaps he will have an idea about how 
to get rid of {} in URLs?