Math on the Web: Class 2
Text Environments in Latex

If you wish to change the typeface in a short passage of text, there are two ways to do it in LaTeX. For example, to emphasize a few words, you can type {\em some text}. In this example, \em is a declaration. You could instead use the command \emph, which takes an argument, as follows: \emph{some text}. These are not the best way to do change of typeface in longer passages, however, as we shall see. A common error is to forget the right hand curly brace, which results in TeX complaining about a runaway argument.

Corresponding to the pair \emph and \em, there are pairs consisting of a command and a declaration for roman type, sans serif, typewriter type, bold type, and several others. These are listed conveniently on p. 9 of the document Essential LaTeX.

If you want to emphasize a longer passage, and you wish to have it appear as a separate paragraph, you should use one of the standard environments of LaTeX. These are used as follows:

\begin{environment-name}
      some text goes here
\end{environment-name}

For example, to set a whole paragraph in emphasized text, use:

\begin{em}
      some text goes here
\end{em}

Notice that the backslash is not used in front of the command em when the command is used as the argument in the \begin command.


Exercise on changing typeface in text: hand in during class.

To see how LaTeX handles emphasizing text, make a copy of the file you used for the first homework: if you called it feynman.tex you might make the copy feynman2.tex. You can do this by getting a UNIX shell prompt and using the UNIX command:

   cp feynman.tex feynman2.tex
In the first paragraph, choose two short passages, and emphasize one with \em and the other with \emph. Then put the second paragraph inside a \begin{em} ... \end{em} environment.
Process and print your new file.

What we just did is a simple use of LaTeX environments. These are the essential constructions for using LaTeX. In Chap. 3 of his book Math into LaTeX,George Grätzer groups the text environments into three types:

  1. displayed: the text in the environment is displayed, usually set off from the text above and below by some vertical white space;
  2. those that create a large symbol;
  3. style and size environments.

The example of emphasized text is of the third type, of course. We now consider displayed text environments.

Here is one environment that you may need for making certain displays, such as headers:

For Centered Text

 \begin{center}
 Text on line 1 \\
 Text on line 2 \\
 .
 .
 .
 \end{center}

The center environment allows you to create a paragraph consisting of lines that are centred within the left and right margins on the current page. Each line must be terminated with the string \\, which is the short form of the command \newline, and gives a line which is not justified to the right.

Environments for Listing Text

There are three environments for listing text.

For numbered lists

 \begin{enumerate}
 \item First item
 \item Second item
 .
 .
 .
 \end{enumerate}

The enumerate environment produces a numbered list. Enumerations can be nested within one another, up to four levels deep. They can also be nested within other paragraph-making environments.

Each item of an enumerated list begins with an \item command. There must be at least one \item command within the environment.

Labelled lists

 \begin{description}
 \item [label] First item
 \item [label] Second item
 .
 .
 .
 \end{description}

The description environment is used to make labelled lists. The label is bold face and flushed right.

Bulleted lists

 \begin{itemize}
 \item First item
 \item Second item
 .
 .
 .
 \end{itemize}

The itemize environment produces a "bulleted" list. Itemizations can be nested within one another, up to four levels deep. They can also be nested within other paragraph-making environments.



In-Class Exercise:

Go to the Quick start page of Tony Roberts's excellent tutorial on LaTeX, download and typeset the sample documents Src/fractals01, Src/fractals02, etc, in succession to see a document's format being applied in stages.

Some useful URLs:

  • Help on LaTeX commands: This contains the above information plus much, much more.
  • A tutorial by Tony Roberts : highly recommended.
  • A tutorial from Harvard.


  • Homework on Text Environments

    Create a LaTeX document (article class with the 12pt option) to demonstrate the use of the three list types just given as well as the center environment. For example, you might make a short bulleted shopping list, a numbered list of LaTeX environments, and a short captioned list of terms taken from the index of a book, with a definition given for each term. See if you can use the spell checker ispell with emacs. Process the file with latex and view it with xdvi before printing it out and emailing me a copy of the tex file (not the .dvi or .ps file).


    email: Martin Karel