# tilde in a url in the address portion of a letter

I am trying to include my website address in the address block of a letter.

My webaddress has a tilde character, and my usual solution, $\sim$, to the tilde formatting problem is not working.

The relevant code is

\documentclass[english]{letter}
...
...


This gives a bad-looking top-aligned tilde.

If I replace ~ with $\sim$, then "http://my.web.address/$\sim$blah" appears in the output PDF. Using \texttildelow gives a compilation error.

Edit: This is not a duplicate. Solutions for the referenced questions do not work inside \address{}.

-
Welcome to TeX.sx! –  hpesoj626 Apr 26 '13 at 15:31
Welcome to TeX.sx! Please complete your code sinppets to a complete minimal working example (MWE) so we can see which font and url packages you are loading. For some possibel approaches see also tex.stackexchange.com/q/312/15925 –  Andrew Swann Apr 26 '13 at 15:36
The question seems very similar to the one mentioned by Papiro; if that indeed solves your problem, please let us know so this question can be closed (just to keep information as tight as possible). Otherwise, please mention why by adding to your question. –  egreg Apr 26 '13 at 15:51
@egreg the question referenced by @Papiro does not solve my problem. The issue is that the solutions mentioned in that reference do not seem to be working when typeset as an \address{} in the letter documentclass. –  user1149913 Apr 26 '13 at 16:03

If you are using the default Computer Modern Fonts, then the Latin Modern fonts might be an alternative, because they are derived from the Computer Modern Fonts. The tilde is lower. Also there is a proportionally spaced typewriter variant that might look better than the mono-spaced font for URLs.

\documentclass{letter}
\usepackage{url}
\usepackage[T1]{fontenc}
\usepackage[variablett]{lmodern}
\begin{document}
\begin{letter}{}
\opening{Dear xy,}
\closing{Yours sincerely}
\end{letter}
\end{document}


-
This works! Thanks. –  user1149913 Apr 26 '13 at 16:05

I wanted to add another working solution here.

The href package seems to allow special characters within \address{} using the two-parameter href command.

For instance, \href{http://my.web.address/~blah}{http://my.web.address/$\sim$blah} works.

However, the single parameter version of the href command, \href{http://my.web.address/~blah}, does not typeset the tilde nicely.

-