[pdftex] Tilde character in url.

John Culleton john at wexfordpress.com
Fri Apr 9 21:34:18 CEST 2010

On Friday 09 April 2010 14:08:02 Reinhard Kotucha wrote:
> On 9 April 2010 John Culleton wrote:
>  > In plain pdftex I am typing the following url:
>  > \url{http://www.tux.org/~milgram/bookland}
>  > {http://www.tux.org/~milgram/bookland}
>  >
>  > The problem is the tilde character.  TeX persists in treating it
>  > either as an unbreakable space or as an accent over the following
>  > character.  The tag \tilde only works in math mode and again it
>  > wants to be on top of the next character.
> The tilde is an active character.
> \bgroup\catcode`\~=12
>   \url{http://www.tux.org/~milgram/bookland}
>   {http://www.tux.org/~milgram/bookland}
> \egroup
> You can also try \~{}.  The empty group prevents TeX from putting it
> over the following character.
> Regards,
>   Reinhard 
First thanks to those who responded.  The problem is not just printing the 
character but also passing it on to the local web browser. Your first 
solution, with the \catcode change enclosed in \bgroup \egroup etc. is the 
one that works. The second suggestion  with  \~{}
prints OK but does not reproduce properly in the url. 

I did not try Wouter's suggestions, since yours came first, and works :<)

Now I have to republish the e-book wherever it exists :<(

John Culleton
"Create Book Covers with Scribus"
Printable E-book 38 pages $5.95

More information about the pdftex mailing list