LaTeX modes



Last revision August 3, 2004

Table of Contents:
  1. Features of LaTeX
  2. Basic layout of a LaTeX document
  3. Required parts of a LaTeX input file
  4. Basic LaTeX topics
    1. LaTeX environments
    2. LaTeX modes
    3. Special symbols in the input file.
    4. Running LaTeX
  5. LaTeX by example
  6. LaTeX Frequent Questions

There are three possible modes that LaTeX can be in when typesetting text:

  • LR
  • paragraph
  • math

LR mode refers to "left-right" mode. In this mode, LaTeX is simply setting a section of text from left to right, without line breaks. The typeset section of text may be part of a line or a line by itself. This mode is used only in certain restricted circumstances since you have to be careful not to set a line longer than the width of the paper.

Paragraph mode is the normal mode for typesetting text. In this mode, LaTeX reads and stores input text into an area of memory until it comes to the end of a paragraph. "Input" can consist of letters of text, or the "boxes" of typeset math, tables, etc. that are embedded within the paragraph.

The end of a paragraph can be signaled by several methods. A blank line in the input file means the end of a paragraph (it does not add extra vertical space in the output). The \par command can be used to explicitly signal end of a paragraph. Also, if you have paragraphs within an environment delimited by \begin and \end commands, the final paragraph can be ended by the \end command itself.

LaTeX (and TeX) attempts to format the entire paragraph at once, selecting line breaks or hyphenation in a way that will give the most pleasing overall result. This differs from most text processors that try to fill out and adjust lines one by one as they go.

One important consequence of the fact that entire paragraphs are set as a unit is that the paragraph will be set according to the environmental parameters that are in effect when LaTeX gets to the end of the paragraph in the input file. If you put in a command to change the left indentation, for example, and end its scope before you end the paragraph, it will have no effect.

Example:

{\addtolength{\leftskip}{1in}
a line of text
some more text}

Next paragraph.

In this example, the \addtolength command was trying to indent the left margin of text by one inch. It was enclosed in braces to limit its scope to a few lines of text, also within the braces. However, the scope (right brace) ended, and the previous environment indentation was restored, BEFORE the end of paragraph (blank line) was signaled, so the \addtolength command did not have any effect. To get the desired effect in this case, the closing right brace should be put on a line by itself after the blank line, or the explicit \par command (to force end of paragraph) should be inserted just before the right brace.

Finally, LaTeX has a special mode for typesetting mathematical formulas. In math mode, there are special fonts and symbols available. In math mode characters are assumed to be variable names, not letters of words, so that

the

means the product of the variables t, h, and e, not the word "the".

To enter math mode and put the typeset output right into the current line (not on a line by itself), use a pair of enclosing dollar signs ($). That is, the first dollar sign switches to math mode without breaking the current line or paragraph, and the second dollar sign goes back to normal paragraph mode. Everything in between is set as a formula (the dollar signs themselves do not appear in the output).

To create a formula or equation that is displayed by itself on a separate line, centered, with extra vertical space to set it off, change to the displaymath environment, for example:

\begin{displaymath}
formula to be set
\end{displaymath}

A short-cut way to begin and end displaymath environment is by the \[ and \] delimiters.

An "equation" environment can be used instead of displaymath if you want your formulas to be automatically numbered in the document.

Comments or Questions?