LaTeX Special Characters (+Printing Commands)

Typically, normal text comprises a mix of uppercase and lowercase letters, digits, and punctuation marks that you can effortlessly input into your text editor. Nevertheless, certain characters are designated for specific LaTeX commands and cannot be directly utilized. We’ll see these special characters and learn how to print them.

List of LaTeX Special Characters with their Unique Functions

NameSpecial CharacterFunction in LaTeX
Hash#Used for parameters in macro definitions.
Example: \newcommand{\mycommand}[1]{Hello #1}
Dollar$A pair of $ creates a math mode within text mode.
Example: $a^2+b^2$
Percent%Used for comments. Anything following a % on a line is treated as a comment and ignored by LaTeX.
Ampersand&Used as a column separator in tables.
Tilde~Represents a non-breaking space. It prevents a line break at the space and ensures that the words on either side of it stay together.
Underscore_Used in math mode for subscripts.
Caret^Used in math mode for superscripts.
Backslash\Most of the LaTeX commands start with \.
Curly Braces{ }Used for grouping in LaTeX. They define the scope of commands or affect the behavior of certain commands.
Bar|Generates a vertical (column) line in a Table.

You perform a unique action when inserting any special characters into your document. It does not print that character. LaTeX provides specific commands for printing these reserved characters.

Printing out Special Character

Within LaTeX, if you intend to have a special character appear in your document exactly as it is, similar to any regular letter, you can achieve this by incorporating a backslash (\) before that character. For instance, to display the dollar sign ($) without invoking its special LaTeX functionality, you would use the sequence \$, resulting in the desired output of $ in your final document.

By adding a backslash (\) before a special character converts it into a LaTeX command. The primary function of this command is to render and display the specified character in the document output.

NameSpecial CharacterLaTeX Command
Hash#\#
Dollar$\$
Percent%\%
Ampersand&\&
Tilde~$\sim$
Underscore_\_
Caret^\^\
Backslash\$\backslash$ or \textbackslash
Left Curly Brace{\{
Right Curly Brace}\}
Bar|$|$
Greater than>$>$
Less than<$<$

Print backslash in LaTeX: However, there’s a crucial exception to this rule, and that exception is the backslash (\) itself. Due to its special significance in LaTeX, typing \\ in your file will not produce the backslash character as expected. Instead, you need to use a special command: $\backslash$ or \textbackslash.

If you’re wondering about the purpose of \\, it works as a shortcut for a line break. It might seem strange, but line breaks happen often, while backslashes are not usually needed in the final result. That’s why this shortcut was chosen.

Note: As the table above indicates, these special keyboard characters can be generated in text mode by employing the \verb| | command. For example, you can use \verb|$| to print the dollar sign ($) or \verb|~| to print the tilde symbol ˜. This \verb| | command prints exactly what is written within the corresponding | | in the input file.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.