Percent in LaTeX and Other Special Characters

To print a percent in LaTeX, write \%. A bare % starts a comment, so LaTeX silently drops everything after it on that line. Nine other characters are special too; most are printed by putting a backslash in front.

LaTeX
\# \$ \% \& \_ \{ \}

\textasciitilde{} \textasciicircum{} \textbackslash
OutputThe ten special characters printed correctly: hash, dollar, percent, ampersand, underscore, braces, tilde, caret and backslash.
Full document you can compile
example.tex
\documentclass{article}
\begin{document}
\# \$ \% \& \_ \{ \}

\textasciitilde{} \textasciicircum{} \textbackslash
\end{document}

Which characters need escaping, and what happens if you don't?

CharacterWriteUnescaped
%\%Starts a comment: the rest of the line disappears, with no error
$\$Starts or ends math mode
&\&! Misplaced alignment tab character &.
#\#! You can't use `macro parameter character #' in horizontal mode.
_\_! Missing $ inserted.
^\textasciicircum{}! Missing $ inserted.
{ }\{ \}Braces group text and vanish from the output
~\textasciitilde{}Prints a non-breaking space
\\textbackslash\\ is a line break, not a backslash

Why does a percent in LaTeX hide the rest of the line?

The comment character makes LaTeX ignore everything up to the end of the line, including the line break. That is why "15% growth" turns into "15" with no warning. It also joins the next line to this one without a space, a trick some templates use on purpose.

LaTeX
Sales rose 15\% to \$4.2 million at Smith \& Sons.
The file is \verb|my_data_2026.csv| and the tag is \#latex.
OutputA sentence with 15 percent, 4.2 million dollars and Smith and Sons, then a file name with _ characters and a hashtag.
Full document you can compile
example.tex
\documentclass{article}
\begin{document}
Sales rose 15\% to \$4.2 million at Smith \& Sons.
The file is \verb|my_data_2026.csv| and the tag is \#latex.
\end{document}

How do you write file names and URLs that contain _?

Escaping every _ gets tedious. \verb|my_data.csv| prints the text as is in typewriter type; the | can be any character that isn't in the text. For web addresses, \url{…} from hyperref or url handles _, % and # for you.

Why don't \~ and \^ print a tilde or a caret?

They are accent commands: \~{n} gives ñ and \^{o} gives ô. For the characters themselves, use \textasciitilde and \textasciicircum. A backslash in text is \textbackslash; in math, use \setminus for set difference or \backslash for the plain symbol.

LaTeX
Text: a\textbackslash b \quad Math: $A \setminus B$, $a \backslash b$

\~{n} is an accent, not a tilde: \textasciitilde{} is the tilde.
OutputA backslash in text, set difference A minus B and a backslash in math, then n with a tilde accent next to a plain tilde.
Full document you can compile
example.tex
\documentclass{article}
\begin{document}
Text: a\textbackslash b \quad Math: $A \setminus B$, $a \backslash b$

\~{n} is an accent, not a tilde: \textasciitilde{} is the tilde.
\end{document}

What about quotes, dashes and other punctuation?

Quotation marks need backticks and apostrophes, as the quotes guide shows. Math symbols such as ± and ° have their own pages in the symbols section. The HTML converter for LaTeX turns \%, \& and the rest into the right HTML characters. The keys < and > print ¡ and ¿ in text, as the greater than sign page shows.

Text drafted with AI from the cited reference; every example and error message produced with TeX Live 2026; checked by Cem Demir. See the editorial policy.