LaTeX sets aside the following characters for special purposes. For example, the percent sign %
is for comments. They are called reserved characters or special characters. They are all discussed elsewhere in this manual.
# $ % & { } _ ~ ^ \
If you want a reserved character to be printed as itself, in the text body font, for all but the final three characters in that list simply put a backslash \
in front of the character. Thus, typing \$1.23
will produce $1.23
in your output.
As to the last three characters, to get a tilde in the text body font use \~{}
(omitting the curly braces would result in the next character receiving a tilde accent). Similarly, to get a text body font circumflex use \^{}
. To get a backslash in the font of the text body, enter \textbackslash{}
.
To produce the reserved characters in a typewriter font use \verb!!
as below (the double backslash \\
is only there to split the lines in the output).
\begin{center} \# \$ \% \& \{ \} \_ \~{} \^{} \textbackslash \\ \verb!# $ % & { } _ ~ ^ \! \end{center}
© 2007–2018 Karl Berry
Public Domain Software
http://latexref.xyz/Reserved-characters.html