# tilde in hyperref url with \usepackage[T1]{fontenc}

By default, LaTeX typesets tildes "too high", but the hyperref package ordinarily corrects this behaviour for URLs (it vertically centers tildes, as expected). However \usepackage[T1]{fontenc} seems to break this, and the tilde is "too high" again.

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{hyperref}
\begin{document}
\url{http://lyle.smu.edu/~tspell/jaws}
\end{document}


any idea how to fix this?

-

If you

\usepackage{lmodern}


before

\usepackage[T1]{fontenc}


It will work as you expect. (see Correctly typesetting a tilde)

-

Package hyperref only uses package url. There the tilde can be changed via option lowtilde:

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[lowtilde]{url}
\usepackage{hyperref}

\begin{document}
\url{http://lyle.smu.edu/~tspell/jaws}
\end{document}


Also a tilde from a different font can be used. The following example takes the tilde from Times Roman (ghostscript's clone), e.g.:

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{hyperref}

\makeatletter
\renewcommand*{\UrlTildeSpecial}{%
\do\~{%
\mbox{%
\fontfamily{ptm}\selectfont
\textasciitilde
}%
}%
}%
\let\Url@force@Tilde\UrlTildeSpecial
\makeatother

\begin{document}
\url{http://lyle.smu.edu/~tspell/jaws}
\end{document}


-