\Section{Input Format}
\SubSection{Control Sequences}
The \Troff/ input format with which the reader is familiar
consists of lines of text.  Some of these lines begin
with a command character (i.e., a period)
and are considered command lines;
these contain formatting directives.  The remaining lines
contain text to be formatted, with occasional escape
sequences (using a distinguished,
or
{\sl escape\/} character) for
particular formatting operations that cannot be easily
specified at a line-break (such as in the middle of a word),
or for special characters such as the Greek letter `$\alpha$'
(|\(*a|).

In contrast, \TeX\ input is ``stream-oriented'', i.e.,
the boundaries between input lines are
unimportant.  During normal
operations, there is no substantial difference between
a newline and a space (there are two exceptions to be noted
later).  \TeX\ commands (called
{\sl control sequences}) may occur anywhere in the input,
and are distinguished by beginning with an {\sl escape\/} character
(|\|, the backslash)\note
{This character has {\bf nothing} to do with the ASCII `ESC'
character (character code $036_8$) which is labeled {\tt ESC}
or {\tt ESCAPE}
on many terminals.}.
There are two varieties of control sequences.  The
first is called a {\sl control word} and consists of the
escape character followed by one or more alphabetic characters.
The end of a control word is the {\sl first non-alphabetic 
character encountered\/}.  Thus the control
sequence |\TeX|, which sets the word `\TeX,' could be
used in a phrase like |\TeX82| (which produces `\TeX82'),
because the non-alphabetic character `8' signifies the end
of the |\TeX| control word.
However, the phrase
|\TeXnical| would be considered an undefined control word.

The second kind of control sequence, like |\'|, is called a
{\sl control symbol}; it consists of the escape character
followed by a {\sl single nonletter}.  For example, the
escape sequence |\'| is used to accent letters: the input
|P\'olya| yields `P\'olya'.

When a space follows a control word, it is ignored.  For
example, to set the word `\TeX nical' into type, one would type
the input |\TeX  nical|; the space following the |\TeX| control
word ends
the control word, but is otherwise ignored. 
Multiple spaces are treated as a
single space.  So to set the phrase `\TeX\ ignores spaces
after control words' one must say:
\begintt
\TeX\ ignores spaces after control words
\endtt
using the control symbol |\|\] (i.e. an escape followed by a space)
to set an actual space.

There are about 300 {\sl primitive} control sequences built
into \TeX, and 600 more {\sl defined} control sequences (many
of them are {\sl macros}) are supplied as part of the default
version of \TeX.  These 900 definitions
constitute ``{\sl plain \TeX\/}.''  Plain \TeX{}
provides substantially more built-in support than \Troff/ does
without macros, but does not provide all the facilities
(section numbering, tables of contents) of a typical \Troff/ macro
package.  Thus, additional macros (probably supplied in
a macro package) are usually required to format
a complex document, but many simple documents with unnumbered
paragraphs, and even with footnotes, labeled sections,
and page headers,
can be formatted using only the facilities of plain \TeX.
\SubSection{Input lines}
As mentioned above, there are two exceptions to the rule
whereby a newline is treated the same as a space.  The
first case is {\sl comments\/}.  When \TeX\ encounters
a percent sign (|%|), the percent sign and all following
characters up to and including the next newline are ignored
(to set a percent in a document, use the control
symbol |\%|).

The second case is {\sl paragraphs\/}.  When two consecutive
newlines are encountered (i.e. an empty line), the effect is
the same as if a |\par| control word, which represents an
end-of-paragraph command, has occurred.  Thus, a user can set
up a simple document quite easily by simply leaving empty lines
between paragraphs.

One can also use a plain \TeX\ macro, |\obeylines|, to cause
each
newline character to begin a new paragraph,
just as two consecutive newlines normally do.  The
effect is similar to the |.na| request of \Troff/.
However, as there is no
macro to undo this effect, this should be done inside
a {\sl group\/,} to be described later.
\SubSection{Other Strange Characters}
Besides |\| and |%|, there are eight other characters that have
special significance for \TeX\ and should be avoided.  If
one must type them, there are control sequences that can be used to
prevent their special meanings:
$$\vbox{\halign {\hfil{\tt#}\hfil&\quad#\hfil&\quad#\hfil&\quad{\tt#}\hfil\cr
{\sl\quad Character\quad}&\hfil\sl Name\quad&
{\sl Significance\hfil}&{\sl\hfil Control Sequence}\cr
\noalign{\smallskip\hrule\smallskip}
\\&Backslash&Escape&\$\\backslash\$\cr
$\{$&Left Brace&Begin Group&\$\\$\{$\$\cr
$\}$&Right Brace&End Group&\$\\$\}$\$\cr
\$&Dollar Sign&Math Escape&\\\$\cr
\&&Ampersand&Alignment Tab&\\\&\cr
\#&Pound Sign&Parameter&\\\#\cr
|^|&Circumflex&Superscript&|\^|  {\it (accent)}\cr
|_|&Underscore&Subscript&|\_|\cr
|~|&Tilde&Tie&|\~|  {\it (accent)}\cr
\%&Percent&Comment&\\\%\cr
}
}$$
\SubSection{Groups}
The characters |{| and |}| deserve special attention.  These
braces delimit {\sl groups\/}.  Groups correspond, very roughly,
to \Troff/ environments (which most users don't see except
in the effects of such macros as the |.(b|~macro of the {\bf --me}
package).  Basically, any formatting change that occurs
within a group is undone when that group is closed.  For example,
the plain \TeX\ macro |\bf| changes the current font to {\bf bold
face}; to change one word to {\bf bold} in the middle of the
sentence, one says something like
\begintt
to change one word to {\bf bold} in the middle
\endtt
The change to boldface within the group is undone when that group
is closed.

Groups also serve a second function: they delimit parameters for
certain control sequences.  For example, the plain \TeX\ macro
|\centerline| requires a parameter comprising the text to be
centered.  Thus, the first title line of this document was
produced by the input
\begintt
\centerline{\titlefont A Guide to \TeX}
\endtt
as seen in the introduction.  Groups are not precisely analogous
to anything in \Troff/, but are an extremely important element
of \TeX\ syntax.
