Thursday, July 23, 2009

Typesetting tilde or backslash

Typesetting a tilde in Latex or Xetex is not so easy. It's a reserved character (non breakable fixed width space) and \~ produces a diacritic. Typing this diacritic alone, i.e. \~{} still produces a tilde which is small and high above the base line. When you follow most of the recommendations in Latex books, you probably write tilde by $\sim$ or any other more complicated variant thereof to work in both text and math environment. This produces a tilde nice and big, not too high above the baseline. What you also see is the recommendation to write tilde in the verbatim mode. For me these two are still not acceptable because they usually switch the font and you really see that the font of it looks alien to the surrounding text. Why should I switch the font when I want to write a tilde in the text mode? I want to get a nice tilde in the normal font which is not a diacritic. Font designers strived to match the appearance of the tilde glyph to the rest of the font so why shouldn't I use it?

Fortunately, there is a macro for typing the kind of tilde I need: \textasciitilde{}. It is just not generally known. This produces a tilde in the text mode which uses the tilde glyph from the font just as the font designers shaped it. It's similar to the command \textbackslash{} which is more widely known for typsetting backslash in text mode.

When you are in text mode, use these commands and spread the word.

11 comments:

a. said...

although you've already found what you were looking for you might still want to try out this handy little tool: http://detexify.kirelabs.org/classify.html

Sven Siegmund said...

Thanks, anyway.

Aric said...

For my thesis (set using XeLaTeX) I needed a tilde in the same font as my body text, and here I find post telling me just how to produce one. Vielen Dank!

Joseph Zitt said...

Turns out I mistyped it. Never mind. And thanks for the tip.

kimberly said...

This whole information is absolutely interesting. i like this blog because is easily understandable, and that is invaluable to the readers. Beyond all doubt La Tex will be very useful for everybody who want to prove it.
buy viagra

Benjamin said...

Thanks for the tip. I've been XeLaTeXing for years and never knew this. The font change the other work around cause is not acceptable to me! Thanks again.

uk theses said...

Thank you! The site simply super! Many thanks to all for help, advice and promotion.

research writing services said...

The site was not a very long time to come. When I started to search the web material to use html, xml, creating websites.

Forum hosting said...

Great explanation about it.thanks.

bathroom said...

Hello
XeTeX and LaTeX
Brilliant post, I went through the post ,I found it very informative
Thank you!

Evolve said...

I recently came across your blog and have been reading along.I'm impressed. You're truly well informed and very intelligent. You wrote something that people could understand and made the subject intriguing for everyone. I'm saving this for future use.
Led Outfitters
Led Outfitters
Led outfitters reviews
led outfitters reviews
led outfitters complaints
led outfitters complaints
led outfitters complaints