LaTeX reserved characters
Special characters can be divided into two categories: reserved characters and special characters in the broader sense, such as the character for paragraph ? and others.
Reserved characters
The reserved characters have, in addition to the pure representation of the character, an additional function. Therefore, they cannot be used simply because it is generally assumed first that the function and not the character is meant.
\ | masks special characters and initiates commands. |
{ } | Contains arguments, creates text blocks |
% | Comment character: The rest of the line is ignored. |
^ | Exponent in math mode |
_ | Index in math mode |
& | depending on context - Tabulator |
# | Parameters |
| |
~ | Protected space. |
[,] | Square brackets |
<,> | Lace braces |
" | Quotation marks |
- \
- The backslash (\) can be used to mask the special characters, i.e. they are interpreted as characters and not as functions.
- Note: \\ is already issued as a command, creates a line break, and therefore cannot be used to display a backslash.
- Within text, \textbackslash is used. Within mathematics, \backslash or the set operator without can be used with \setminus.
- { }
- The curly braces ({,}) are represented by \{ and \} respectively in both the text and math environments.
- %
- The percent sign (%) is represented by \% in both the text and math environment.
- ^
- The exponent character (^) is represented by \^ or \textasciicircum in the text.
- The typical example for using exponents in LaTeX $a^2$ = a2 has the disadvantage that this procedure does not work with two or more characters in the exponent. So $a^23$ then becomes a23 and not the desired a23, you have to use the following notation $a^{23}$.
- In this example, the incorrect use of double exponents would lead to a correct result, which is not intended.
- double exponents are also written in groups $a^{2^{3}}$
- _
- &
- The tabulator character(& sign) is represented by \& within text as well as within mathematics.
- #
- The hash sign or double cross is represented by \# both within text and within mathematics.
The following characters cannot be masked with a backslash (\), because the combination of the characters results in a command. Or the character is not available on the keyboard at all, such as the pointed brackets from mathematics, which are often mistakenly displayed with the smaller or larger character.
- ~
- The tilde (~) stands for a protected space. Since the tilde has a meaning in some languages, the command \nobreakspace and not ~ should be used for protected spaces.
- With \textasciitilde, \tilde{} and \~ the tilde can be displayed, whereby it is assumed that the tilde should be above the next character. If you want it before the next character and in (about) the same height as this one, then you can use the following: \raisebox{-0.9ex}{\~{ }} test respectively \raisebox{-0.9ex}{\textasciitilde } test
- [,]
- The square brackets ([,]) can be represented by [,] in both text and math mode. Within math environments, \lbrack and \rbrack can also be used.
- The command \[ or \] opens or closes the displaymath environment.
- <,>
- The lace braces (<,>) are marked \langle or \langle within the matheumatism. \rangle are shown. The use of the larger or smaller character as a replacement should not be used.
- "
- The quotation marks (") within the text can be set by \dq Test \dq{} = "Test"