# Trouble inserting “~” (not equivalent to \sim} [duplicate]

I need to include a url in my document, which includes this symbol: ~ Simply entering the url generates a space rather than the symbol, and replacing the symbol with $\sim$ is not equivalent, the url no longer works if copied and pasted into a browser. Is there a way to generate the exact symbol? The full url I want to use is http://www.its.caltech.edu/∼ph76a/pdh.pdf. Working example:

\documentclass[11pt]{amsart}
\usepackage[top=1in, bottom=1in, left=1.5in, right=1in]{geometry}              % See geometry.pdf to learn the layout options. There are lots.
\geometry{a4paper}
\usepackage{graphicx}
\usepackage{amssymb}
\usepackage{epstopdf}
\usepackage{subfigure}
\usepackage{setspace}
\usepackage{cite}
\usepackage{amsmath}
\usepackage{xfrac}
\usepackage{cleveref}
\usepackage{url}
\usepackage{breqn}
\usepackage[bitstream-charter]{mathdesign}
\usepackage[T1]{fontenc}
\begin{document}
http://www.its.caltech.edu/~ph76a/pdh.pdf
\end{document}


## marked as duplicate by yo', Thorsten, Werner, user2478, KurtAug 7 '13 at 16:55

You are already loading url package. Hence use \url{<url address>}:

\documentclass[11pt]{amsart}
\usepackage{url}
\begin{document}
\url{http://www.its.caltech.edu/~ph76a/pdh.pdf}
\end{document}


If you want to make it a clickable link, use hyperref. The url package is loaded by hyperref itself.

\documentclass[11pt]{amsart}
\begin{document}
\url{http://www.its.caltech.edu/~ph76a/pdh.pdf}
\end{document}


If you want a slightly lowered tilde, pass the option lowtilde to url package. i.e.,

\usepackage[lowtilde]{url}


if using url package and

\PassOptionsToPackage{lowtilde}{url}
\documentclass[11pt]{amsart}
..
..


for hyperref.

The font style can be set by the \urlstyle command. From url (documentation):

You can switch the style of printing using “\urlstyle{xx}”, where “xx” can be any defined style. The pre-defined styles are “tt”, “rm”, “sf” and “same” which all allow the same linebreaks but use different fonts — the first three select a specific font and the “same” style uses the current text font. You can define your own styles with different fonts and/or line-breaking by following the explanations below. The “\url” command follows whatever the currently-set style dictates.

Hence \urlstyle{tt} should give you the above style throughout.

• Thanks very much - this has solved my problem, do you know of a way to keep the same formatting as the rest of my document? I'd prefer that if possible. – Jennifer Aug 7 '13 at 14:33
• @Jennifer Use \urlstyle{same} to get the current text font. – marczellm Aug 7 '13 at 14:43