Special Characters
We said that the majority of text can be typed as usual in LaTeX. Before moving on, we'll go over the parts that can't.
Paste the following text into your document, then compile the preview.
What happens to $ and % in LaTeX?
A screenshot of the result is shown below.
In the Source editor, the $ (dollar sign) and all that follows is highlighted in red. The % (percent sign) and all that follow are italicized and grey.
In the Preview, “and” is italicized, and the percent sign and everything that follows it do not appear.
This is because both $ and % have roles in LaTeX.
The dollar sign $ begins math mode (which we will see in the next section). The percent sign % begins a comment in the code (which does not print in the document).
Since these particular characters come up often in math word problems, it is good to know how to type them. Both are typed by adding a backslash immediately before.
Type a dollar sign with \$
Type a percent sign with \%
Exercise 3.2.1
Edit the sentence
What happens to $ and % in LaTeX?
so that both symbols appear and the entire sentence is visible in the PDF preview.
Solution 3.2.1
Add a backslash before each special character:
What happens to \$ and \% in LaTeX?
so that both symbols appear and the entire sentence is visible in the PDF preview.
Bonus: try adding a backslash before LaTeX!
There are seven other special characters that cannot be typed as usual. Fortunately, they are less common in writing. All of these characters are listed in the table below, for reference. We will eventually use all of them in this lesson, except for the last two.
Now that we know how to type text in LaTeX, let's review our new skills with a short quiz.