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.

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}
...
\address{ Street \\ City, ST 00000 \\ \url{http://my.web.address/~blah} }
...

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{}.

share|improve this question
1  
Welcome to TeX.sx! –  hpesoj626 Apr 26 '13 at 15:31
1  
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

2 Answers 2

up vote 7 down vote accepted

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}
\address{ Street \\ City, ST 00000 \\ \url{http://my.web.address/~blah} }
\begin{document}
\begin{letter}{}
\opening{Dear xy,}
\closing{Yours sincerely}
\end{letter}
\end{document}

Result

share|improve this answer
    
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.

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.