LaTeX is actually a macro package based on Donald Knuth's typesetting
program, TeX. The basic constructions in LaTeX involve various
containers. For example, a paragraph is built up out of horizontal
boxes (in TeX lingo, these are hboxes, and they may
sometimes be overfull or underfull, which leads to warning messages,
which you can ignore at first). A more basic example is the container
begin{document} ... end{document}, which
frames your document. We are going to look at some smaller containers
that are useful for changing typefaces, etc.
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}. The problem with \emph
for a long passage is that you may forget the closing curly brace, and
then LaTeX will probably complain about a runaway argument.
The declaration \em is more flexible for a longer
passage. It's scope ends with either a curly brace or any
\end statement. For example, the scope would be ended by
\end{quote}.
These are not the best way to do change of typeface in longer passages, however, because of the likelihood of a forgotten brace every now and then.
By the way,
corresponding to the pair \emph and \em,
used for producing emphasized (usually, italic) text, 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.
To see how LaTeX handles emphasizing text, make a copy of the file you used for the first homework: if you called it einstein.tex you might make the copy einstein2.tex. You can do this by getting a UNIX shell prompt and using the UNIX command:
cp einstein.tex einstein2.texIn 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.What we just did is a simple use of LaTeX environments. These are the essential constructions for using LaTeX. In Chap. 3 of our textbook, Gratzer groups the text environments into three types:
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:
\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.
There are three environments for listing text.
\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.
\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.
\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.
Some useful URLs:
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).