[l2h] Tilde problem

Ross Moore ross at ics.mq.edu.au
Wed Jan 4 01:47:22 CET 2006

Hi all.

On 04/01/2006, at 6:57 AM, jos wrote:

> Since we're on the topic of the classic tilde problem, I have not  
> yet found a solution that works also for PDF links.

> For years, I have been using "\~{}" within \htmladdnormallink{}{},  
> and that has worked fine for
> If there is a workaround in the LaTeX source, please let me know  
> what it is!

Modify your LaTeX preamble as follows:

> %&latex
> \documentclass{article}
> \usepackage{html}

> \begin{document}
> \begin{enumerate}
>  \item This
> \htmladdnormallinkfoot{link}{http://ccrma.stanford.edu/~jos/} uses
> tilde as if it would simply work.  The link works in PDF and HTML, but
> it is printed in PDF with a space in place of tilde.
>  \item This
> \htmladdnormallinkfoot{link}{http://ccrma.stanford.edu/\~{}jos/ 
> webpub/}
> uses the standard \verb!\~{}! construct.  The PDF link fails,  
> though it
> prints ok.  The HTML link works.
>  \item This
> \htmladdnormallinkfoot{link}{http://ccrma.stanford.edu/\~jos/ 
> pubs.html}
> uses \verb!\~! only.  The PDF link works, but it prints with the
> tilde omitted (no space).  The HTML link fails (tilde omitted).
> \end{enumerate}
> \end{document}

The 1st and 3rd examples now work in PDF, and moreover have become
active links there.

The 2nd example doesn't work however.
But that can be fixed too, by also including a redefinition of \~
that tests whether the argument is empty or not.

For example, using the following works for all 3 above examples...

    \edef\next{\egroup \def\noexpand\thisurl{#2}}\next

  ... but there are no guarantees of what it does when the URL
argument (that is, the #2) has active characters other than ~ .

Hope this helps,


Ross Moore                                         ross at maths.mq.edu.au
Mathematics Department                             office: E7A-419
Macquarie University                               tel: +61 +2 9850 8955
Sydney, Australia  2109                            fax: +61 +2 9850 8114

More information about the latex2html mailing list