-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating

LaTeX Beginner's Guide
By :

Before we continue writing, let's look at how LaTeX understands what we type:
There are some characters with special meanings:
\
, starts a LaTeX command or a LaTeX macro.$
, starts and ends math mode, which we will explore in Chapter 9, Writing Math Formulas.%
, tells LaTeX to ignore the rest of the line.Let's expand upon that last point: the percent sign introduces a comment. Everything following a percent sign until the end of the line will be ignored by LaTeX and won't be printed out. This enables you to insert notes into your document. It's often used in LaTeX templates to inform the user of what the template does or requires the user to do at a certain point. Note that the end of the line, normally behaving as a space, will also be ignored after a percent sign.
Easing experimenting by trial and error
If you want to disable a command temporarily, it may be favorable to insert a percent sign instead of deleting the command. That way, you're able to undo this change easily by removing the percent sign.
If that is how the percent sign works, what should we do if we want to write 100% in our text? And what about the other special symbols? Let's figure out how to solve that issue in the next section.
Common text mostly contains uppercase and lowercase letters, digits, and punctuation characters that you can simply type into your editor. However, some characters are reserved for LaTeX commands and cannot be used directly. We already encountered such characters, including the percent sign and curly braces. To fix this issue, there are LaTeX commands to print such symbols.
We will write a very short example printing out an amount of dollars and a percent number, along with some other symbols:
\documentclass{article} \begin{document} Statement \#1: 50\% of \$100 equals \$50. More special symbols are \&, \_, \{ and \}. \end{document}
Figure 2.2 – Special symbols
By putting a backslash before a special symbol, we turned it into a LaTeX command. The only purpose of this commend is to print out that symbol.
Printing the backslash
You may be wondering how to print a backslash. The command for printing a backslash is \textbackslash
. If you would like to know what \\
might be used for, it is used as a shortcut for a line break. That may seem a bit odd, but line breaks occur frequently whereas backslashes are rarely needed in the output, therefore this shortcut has been chosen.
There's a wealth of symbols that we can use for math formulas, chess notation, zodiac signs, music scores, and more. We don't need to deal with those symbols for now, but we shall return to that subject in Chapter 9, Writing Math Formulas, when we will need symbols to typeset math formulas.
Now that we know how to enter pure text, let's find out how we can format it.