Hypertext Help with LaTeX
Input to LaTeX

Input to LaTeX is plain text (ascii) which includes both the text of the document and also formatting commands. It is possible to split the input into several files using:

Space characters separate words. Two space characters in a row are equivalent to a single space character. The end of line is also equivalent to a space character. (However, a percent sign, %, can end a line without generating a space character.) Generally, space characters at the beginning of a line are ignored.

An empty or blank line between two lines of text defines a new paragraph. Two blank lines are equivalent to one.

Special Characters

The following ten characters are Special LaTeX Characters:
  $ & % # _ { } ~ ^ \ 
If entered directly in the input they cause LaTeX to do something special. You can get the following seven of them into your document by simply preceding them with a backslash (\):
      $ & % # _ { }  
To get the other three ( ~ ^ \ ) in your output requires more work.

LaTex Commands

Commands take one of two forms The second case is case-sensitive; \Gamma is different from \gamma. These commands are terminated by a nonletter, i.e., a blank, a number, a punctuation mark or special character.

Commands may have mandatory arguments, which are input in braces ({}). They may also have optional arguments, which are input in square brackets ([]).

For commands which produce text a trailing blank may be interpreted as the end of the command, which does not automatically create a space, so you may have to do something to create an interword space after this text.

Structure of Input

LaTeX input normally begins with a \documentstyle command. (In LaTeX2e this is replaced with a \documentclass command.)

The beginning of the document text follows a \begin{document} command.

Input between the \documentstyle and \begin{document} is called the preamble and typically contains new command definitions, information for the title, declarations which affect things like Typefaces, etc.

The document text (and generally also the LaTeX input) is terminated by a \end{document} command.

It is possible to obtain some of the input from external files, i.e., those which are not the main file input to the LaTeX program.


See also Back to the Table of Contents
Revised: Sheldon Green, 30 Oct 1995.