Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question

2 Answers 2

up vote 2 down vote accepted

If you

\usepackage{lmodern}

before

\usepackage[T1]{fontenc}

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

share|improve this answer

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}

Result

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}

Result ptm

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.