Signup/Sign In
Ask Question
Not satisfied by the Answer? Still looking for a better solution?

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 in the 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.
by

2 Answers

sandhya6gczb
TL;DR
\textbackslash* produces a backslash in text-mode. The *math-mode $\sim$* and *\texttildelow* (from textcomp package) are options for a lower tilde (*while ~{}* and *\textasciitilde produce a raised tilde in text-mode)
RoliMishra
You can also use the "plain TeX" method of indexing the actual ascii character in the current font:

\char`\\
\char`\~

I often use the former for writing macros that need the backslash in the typewriter font; \textbackslash will sometimes still use the roman font depending on the font setup. Of course, if you're using these a lot you should define your own macro for them:
\newcommand\SLASH{\char`\\}

Login / Signup to Answer the Question.