Some commands are implicit, in that we don't have to do anything much extra. For instance, we command LATEX to end the present sentence by typing a period (that doesn't follow a capital letter). These are no so much commands as part of having to describe the logical structure of a document.
A control word is something of the form
\commandname
, where the command name
is a word made up only of the letters a to z and A to Z. A
control symbol consists of a \
followed by single symbol that is not a letter.
Here are some examples:
\
before,
\@
was a control symbol that told told LATEX that
the very next period did really end the sentence,
\LaTeX
is a control word that tell LATEX to insert
its own name at the current point,
\clubsuit
instructs that a ♣ be inserted,
\pounds
inserts a £ symbol,
\S
inserts a ¶ symbol,
\em
makes the ensuing text be emphasised,
These examples show that control sequences can be used to
access symbols not available from the keyboard,
do some typesetting tricks like setting the word
LATEX the way it does, and change the appearance of
whole chunks of text as with \em
. We'll be meeting
many more of these type of control sequences.
Another enormously powerful class of control sequences is those that accept arguments. They tell LATEX to take the parts of text you supply and do something with them—like make a fraction by setting the first argument over the second and drawing a line of the appropriate length between them. These are part of what makes LATEX so powerful, and here are some examples.
\chapter{The beginning}
causes LATEX to
start a new chapter with name ``The Beginning'', number
it in sequence, typeset the chapter heading in a suitable
font, and make an entry in the table of contents,
\overline{words}
causes
\frac{a+b}{c+d}
sets the given two argument as
a fraction, doing most of the dirty work for us:
\sqrt[5]{a+b}
typesets the fifth-root of a + b,
like this:
Mandatory arguments are given enclosed by braces, and optional arguments enclosed by square brackets. Each command knows how many arguments to expect, so you don't have to provide any indication of that.
We have actually jumped the gun a little. The above examples include examples of mathematical typesetting, and we haven't yet seen how to tell LATEX that it is typesetting maths as opposed to some other random string of symbols that it doesn't understand either. We'll come to mathematical typesetting in good time.
We need to dwell on a TEXnicality for a moment. How does
LATEX know where the name of a control sequence ends?
Will it accept both \pounds3
and \pounds 3
in order to set £3, and will \emWalrus
and \em Walrus
both be acceptable in order to
get Walrus? The answer is easy when you remember
that a control word consists only of alphabetic characters,
and a control symbol consists of exactly one nonalphabetic
character.
So to determine which control sequence you typed, LATEX does the following:
This has one important consequence: The character in the input file immediately after a control symbol will be ``seen'' by LATEX, but any space following a control word will be discarded and never processed. This does not affect one much if you adopt the convention of always typing a space after a control sequence name.
There is a rare circumstance where this necessitates a little extra work and thought, which we illustrate by example:
0.1
If we type a control word like \LaTeX in the running text then we must be cautious, because the string of spaces that come after it will be discarded by the \LaTeX\ system.which produces the output
0.10.8If we type a control word like LATEXin the running text then we must be cautious, because the string of spaces that come after it will be discarded by the LATEX system.