[pdftex] Tilde character in url.

Reinhard Kotucha reinhard.kotucha at web.de
Sat Apr 10 01:39:39 CEST 2010

On 9 April 2010 Wouter Bergmann Tiest wrote:

 > On 9 Apr 2010, at 20:25, John Culleton wrote:
 > > The problem is the tilde character.
 > Use the textcomp package and the symbol \textasciitilde. This  
 > produces a single tilde character in text mode, which adapt to the  
 > currently selected font. If you want a symbol that is not as high  
 > above the baseline (like what you get when you type ~ in a text  
 > editor), use $\sim$.

The \url macro takes two arguments.  One contains text which is
typeset in the PDF file, the other one contains an URL which is passed
to a web browser when people click on the link in the PDF file.

The first one can contain arbitrary TeX code, even math symbols, but
in the latter one everything, after macro expansion, has to be an
ASCII string.  Thus, my suggestion \~{} doesn't work because it
sttill treats the tilde as an accent.

John is using pbkl8r (obviously Bookman) and $\sim$ comes from
Computer Modern.  These fonts don't match very well.  I personally
prefer typewriter fonts for URLs, filenames, and computer code.  If
John needs \url more than once or twice, it's wortwhile to revise the
macro definition.  When \catcode`\~=12 is set locally within the macro,
the \url macro is easier to use.

I don't know whether it's worthwhile to lower the tilde when
typesetting URLs.  Sure, it looks a bit ugly because the glyph is
designed in order to be combined with others.  One could put it into a
box and \lower it.  It's quite inconvenient to do this within a macro
because some \catcode trickery is required, but it's possible at

At this point Klaus Lagally's words come to my mind:  "You can do
everything with TeX because TeX is a Turing machine.  But programming
TeX is as convenient as programming a Turing machine".

John, I'm wondering about the time stamp in your mail:

  Date: Fri, 9 Apr 2010 14:25:58 -0400

This means 18:25:58 UTC.  But I actually received your mail one hour
before you sent it.  I don't know what's wrong.  Could you check
whether the hardware clock is using UTC and the time zone is set

My mail client sorts mails by date:

 Thierry Bouche     "Re: [pdftex] Tilde character in url."
 Reinhard Kotucha   "Re: [pdftex] Tilde character in url."
 Wouter Bergmann T  "Re: [pdftex] Tilde character in url."
 John Culleton      "[pdftex] Tilde character in url."

I obviously received all the responses before your request.  The only
explanation I have is that you are living in the future. 


Reinhard Kotucha			              Phone: +49-511-3373112
Marschnerstr. 25
D-30167 Hannover	                      mailto:reinhard.kotucha at web.de
Microsoft isn't the answer. Microsoft is the question, and the answer is NO.

More information about the pdftex mailing list