# How does one insert a backslash or a tilde (~) into LaTeX?

• How does one insert a "\" (backslash) into the text of a LaTeX document?
• And how does one insert a "~" (tilde)? (If you insert \~, it will give you a tilde as an accent over the following letter.)

I believe \backslash may be used in math formulae, but not into text itself. Lamport's, Kopka's, and Mittelbach's texts have said as much (but no more), and so left me hanging on how to get a backslash into regular text.

-

## migrated from stackoverflow.comJan 20 '11 at 17:54

This question came from our site for professional and enthusiast programmers.

For the special case where a backslash or tilde must be written to an auxiliary file or shell escape see: How can I provide a verbatim (unescaped) commandline for executing with \write18? – Martin Scharrer Apr 13 '12 at 10:28
For future reference, this is a great resource for finding out what to do to accomplish a given character. – Parthian Shot Feb 12 '15 at 21:42

The Comprehensive LaTeX Symbol List is your friend.

\textbackslash and \textasciitilde are found in Table 2 of the list, and page 101 has some other options for the tilde:

$\sim$ and \texttildelow from the textcomp package, possibly using some font other than Computer Modern to get a nice vertically centered tilde

It also suggests using the url package if you are typesetting URL's or Unix file names.

-
This is pretty awesome and helped me a lot. I just want to add that in case you use these in a text, do like so: bar\textasciitilde{}foo. – Till May 14 '11 at 20:53

\usepackage{url}


near the beginning of the document, and enclose any web and email addresses in the document in \url{...}:

\url{http://www.math.drofnats.edu/~gauss}
\url{gauss@math.drofnats.edu}


..."

I hope this could help you in typewriting a regular tilde character.

-

## protected by Martin Scharrer♦Apr 5 '12 at 7:01

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).