Writing my thesis, I was faced with internet sources in my bibliography. By default, the url (or hypertex) package uses tt-fonts for the URLs, however, I didn’t want to mix in another typeface.

Consider the result that I got with \urlstyle{same}:

http: / / www.archives.gov / genealogy / census / soundex.html

I didn’t like the extreme spacing between the slashes (//), although it was obviously the same result as if I’d typed // directly somewhere in my document.

Finally, after studying the url.sty source for a while, I came up with the following hack:

\def\UrlBreaks{\do\.\do\\\do\/\do\!\do\_\do\|\do\;\do\>\do\]%no @
\def\UrlBigBreaks{\do\/\do@url@hyp}%add /
\def\UrlSpecials{\do\/{\Url@slash}\do\ {\Url@space}\do\%{\Url@percent}\do\^^M{\Url@space}%

That will use the \UrlSpecials variable to assign a special behaviour to the /-character, whereupon I manually do the necessary kerning for this result:


Obviously this doesn’t seem a very nice hack, so better suggestions are welcome. By the way, you could use \@gobble in the \@if-argument if you wanted to eat the next slash, for example directly typesetting them both at once, avoiding the \kern#\kern# in your document.