[l2h] Re: hyperref.sty vs. html.sty: "\textunderscore undefined"
Heiko Oberdiek
oberdiek@uni-freiburg.de
Thu, 12 Sep 2002 13:06:30 +0200
On Thu, Sep 12, 2002 at 12:21:34AM -0700, Julius Smith wrote:
> I often use the construct (from html.sty)
>
> \htmladdnormallinkfoot{description}{http://www.somewhere.org/\~{}name/file\_name.html}
>
> (Note the quoted '~' and '_'.) This has been working fine for some years.
>
> Today I tried using the hyperref package for the first time, and I ran
> into the error "\textunderscore undefined" at '\_'. After some Web
> searching and general futzing around, I seem to have come up with the
> following workaround:
>
> \htmladdnormallinkfoot{description}{\url{http://www.somewhere.org/~name/file_name.html}}
>
> (Note the use of \url{} and no more quoting of '~' and '_'.)
>
> While this seems to work, based on a test sample of one, I wonder if
> there is a better, more "correct" way to handle this problem?
I do not know, because I never used latex2html or html.sty.
Both html.sty and hyperref.sty look very nasty:
html:
\ifx\pdfunknown\relax
\html@new{\htmladdnormallinkfoot}[2]{#1\footnote{#2}}
\else
\def\htmladdnormallinkfoot#1#2{\footnote{\href{#2}{#1}}}
\fi
hyperref:
\def\htmladdnormallinkfoot#1#2{\href{#2}{#1}\footnote{#2}}
\href supports in the first argument ~, \~, _, but these
commands are wrong in the second one or inside footnote.
Perhaps \string~ and \string_ can be used in both cases, but
I cannot give a recommendation. But I have added some commands
(\_, \textunderscore, \textasciitilde) to \hyper@normalise,
so your example can work now (v6.72y).
(See README for download location.)
Yours sincerely
Heiko <oberdiek@uni-freiburg.de>