From: gmaltby@unpcs1.cs.unp.ac.za (Gavin Maltby)
Newsgroups: comp.text.tex
Subject: latex notes: 2 of 4
Summary: part 2 of 4
Keywords: latex notes
Date: 27 Jan 93 06:53:09 GMT
Organization: University of Natal, Pietermaritzburg, South Africa
NNTP-Posting-Host: pc038.cc.unp.ac.za

% part 2 of 4
\begin{table}[ht]
\centering
\begin{tabular}{l|r|r|r|}
\multicolumn{1}{l}{size} &
\multicolumn{1}{c}{default (10pt)} &
        \multicolumn{1}{c}{11pt option}  &
        \multicolumn{1}{c}{12pt option}\\
\cline{2-4}
\verb|\tiny|       & 5pt  & 6pt & 6pt\\
\cline{2-4}
\verb|\scriptsize| & 7pt  & 8pt & 8pt\\
\cline{2-4}
\verb|\footnotesize| & 8pt & 9pt & 10pt \\
\cline{2-4}
\verb|\small|        & 9pt & 10pt & 11pt \\
\cline{2-4}
\verb|\normalsize| & 10pt & 11pt & 12pt \\
\cline{2-4}
\verb|\large|      & 12pt & 12pt & 14pt \\
\cline{2-4}
\verb|\Large|      & 14pt & 14pt & 17pt \\
\cline{2-4}
\verb|\LARGE|      & 17pt & 17pt & 20pt\\
\cline{2-4}
\verb|\huge|       & 20pt & 20pt & 25pt\\
\cline{2-4}
\verb|\Huge|       & 25pt & 25pt & 25pt\\
\cline{2-4}
\end{tabular}
\caption{\LaTeX\ size-changing commands.}\label{tab:styles}
\label{tab:sizes}
\end{table}

The point-size option referred to in table~\ref{tab:sizes} is that
specified in the \verb@\documentstyle@ command issued at the
beginning of the input file.  Through it you select that base
(or default) font for your document to be 10, 11, or~12 point Roman.
If no options are specified, the default is 10-point Roman.  The
table shows, for instance, that if I issue a \verb@\large@ in
this document for which I chose the {\tt 12pt} document style
option the result will be a {\large 14-point Roman typeface}.

We mentioned that to restrict the scope of a type-changing
command we will set the text to be affected off in a group.
Let's look at an example of this.

\moveright0.1\textwidth\vbox{%
\footnotesize\begin{verbatim}
When we want to {\em emphasise\/} some text we
use the {\tt em} command, and use grouping to
restrict the scope.  We can change font {\large sizes}
in much the same way.  We can also obtain {\it italicised},
{\bf emboldened}, {\sc Capitals} and {\sf sans serif} styles.
\end{verbatim}
}

\result{%
When we want to {\em emphasise\/} some text we
use the {\tt em} command, and use grouping to
restrict the scope.  We can change font {\large sizes}
in much the same way.  We can also obtain {\it italicised},
{\bf emboldened}, {\sc Capitals} and {\sf sans serif} styles.
}

Notice how clever grouping allows us to do all that without
once having to use \verb@\rm@ or \verb@\normalsize@.

One more thing slipped into that example---and {italic correction\/}
\verb@\/@.  This is a very small amount of additional space that
we asked to be inserted to allow for the change from sloping
{\em emphasised} text to upright text, because the interword
space has been made to look less substantial from the terminal
sloping character.  One has to keep an eye open for circumstances
where this is necessary.  See the effect of omitting an italic correction
after the emphasised text earlier in this paragraph.

One might expect, by now, that \LaTeX\ would insert an italic correction
for us.  But there are enough occasions when it is not wanted, and there
is no good rule for \LaTeX\ to use to decide just when to do it for us.
So the italic correction is always left up to the typist.

\subsection{Accents}
\LaTeX\ provides accents for just about all occasions.  They are
accessed through a variety of control symbols and single-letter
control worlds which accept a single argument---the letter to be
accented.  These control sequences are detailed in table~\ref{tab:accents}.

\begin{table}[ht]
\centering
\begin{tabular}{lll}
\verb@\`{o}@ & \`{o} & (grave accent)\\
\verb@\'{o}@ & \'{o} &(acute accent)\\
\verb@\^{o}@ & \^{o} & (circumflex or ``hat'')\\
\verb@\"{o}@ & \"{o} & (umlaut or dieresis)\\
\verb@\~{o}@ & \~{o} & (tilde or ``squiggle'')\\
\verb@\={o}@ & \={o} & (macron or ``bar'')\\
\verb@\.{o}@ & \.{o} & (dot accent)\\
\verb@\u{o}@ & \u{o} & (breve accent)\\
\verb@\v{o}@ & \v{o} & (h\'{a}\v{c}ek or ``check'')\\
\verb@\H{o}@ & \H{o} & (long Hungarian umlaut)\\
\verb@\t{oo}@ & \t{oo} & (tie-after accent)\\
\verb@\c{o}@ & \c{o} & (cedilla accent)\\
\verb@\d{o}@ & \d{o} & (dot-under accent)\\
\verb@\b{o}@ & \b{o} & (bar-under accent)
\end{tabular}
\caption{Control sequences for accents}
\label{tab:accents}
\end{table}

Thus we can produce \'{o} by typing \verb@\'{o}@,
\v{a} by typing \verb@\v{a}@, and P\'{a}l Erd\"{o}s
by typing \verb@P\'{a}l Erd\"{o}s@.  Take special
care when accenting an $i$ or a $j$, for they should
lose their dots when accented.  Use the control
words \verb@\i@ and \verb@\j@ to produce dotless
versions of these letters.  Thus the best way to type
to type \u{e}x\u{\i}gent is \verb"\u{e}x\u{\i}gent".

\subsection{Over-ruling some of \TeX's choices}
We've seen that ties can be used to stop linebreaks
occurring between words.  But how can we stop
\LaTeX\ from hyphenating a particular word?
More generally, how can we stop it from splitting
any given group of characters across two lines.
The answer is to make that group of characters
appears as one solid {\em box\/}, through
use of an \verb@\mbox@ command.

\moveright0.1\textwidth\vbox{%
\footnotesize\begin{verbatim}
For instance, if we wanted to be sure that the word
{\em currentitem\/} is not split across lines
then we should type it as \mbox{\em currentitem}.
\end{verbatim}
}

If for some reason we wish to break a line\\
in the middle of nowhere, preventing \LaTeX\
from justifying that line to the prevailing right
margin, the we use the \verb@\newline@
command.  One can also use the abbreviated
form \verb@\\@.

\moveright0.1\textwidth\vbox{%
\footnotesize\begin{verbatim}
We start with a short line.\newline
And  now we continue with the normal
text, remembering that where we press
Return in the input file probably won't
correspond to a line break in the final
document.  More short lines\\
are easy, too.
\end{verbatim}
}
\noindent will produce the line breaks we want

\result{%
We start with a short line.\newline
And  now we continue with the normal
text, remembering that where we press
Return in the input file probably won't
correspond to a line break in the final
document.  More short lines\\
are easy, too.
}

A warning is in order:  \verb@\newline@
must only end part of a line that is ``already
set''.  It cannot be used to add additional
space between paragraphs, nor to leave
space for a picture you want to paste in.
This is not to be awkward, but is just part
of \LaTeX\ holding up its end of the deal
by making you have to specially request
additional vertical space.  This prevents
unwanted extra space from entering
your document.

Later we shall see how to impose our own choice
of page size, paragraph indentation, etc.  For now
we will continue to accept those declared for
us in the document style.

\subsection{Commenting your document}
It is handy to be able to make comments
to yourself in the source file for a document.
Things like ``I must rewrite this section'' and
``This is version 3 of the document'' are likely.
It would also be useful to be able to make
the compiler ignore certain parts of the
document at times.  For this purpose
we can use the \verb@%@ character, for
all text on an input line that is
after a \verb@%@  which is not part of
an occurrence of the control symbol
\verb@\%@ is discarded by the compiler.
Here is an example:

\moveright0.1\textwidth\vbox{%
\footnotesize\begin{verbatim}
There was a 100\% turnout today,
an all-time record.  %perhaps I should check this claim!
%Indeed, there are lots of unsubstantiated claims here!
This made for an extremely productive session.
\end{verbatim}
}
\noindent will yields

\result{%
There was a 100\% turnout today,
an all-time record.  %perhaps I should check this claim!
%Indeed, there are lots of unsubstantiated claims here!
This made for an extremely productive session.
}

\subsection{Footnotes}
Inserting footnotes is easy---\LaTeX\ will position and
number them for you.  You just indicate {\em exactly\/}
where the footnote marker should go, and provide the
text of the footnote.  The footnote text will be
placed at the bottom of the present page in a somewhat
smaller font, and be separated from the main text by
a short horizontal rule\footnote{See for yourself!  It's
easy when you don't have to do any work.} to conform with
convention.  The footnote in the last line was typed
like this:

\moveright0.1\textwidth\vbox{%
\footnotesize\begin{verbatim}
...rule\footnote{See for yourself! It's easy ...work.} to conform
\end{verbatim}
}
No space was typed between the {\tt rule} and the
\verb@\footnote@, because we want the footnote
marker to appear right next to the last letter of the word.

Multiple footnotes\footnote{Here is another footnote} are
obtained just by using the \verb@\footnote@ command
again and again.

\subsection{Topmatter}
We declare the title and author information using the
\verb@\title@ and \verb@\author@ commands, each of
which accept a single argument.  Multiple authors
are all listed in the argument of \verb@\title@,
separated by \verb@\and@'s.  The \verb@\date@
command can be used to date a document.  After
we have declared each of these, we issue a
\verb@\maketitle@ command to have them typeset for
us.  In the \verb@book@ and \verb@article@ document
styles this will result in a separate page; in
the \verb@article@ style the ``top matter'' will
be placed at the top of the first page.  The style
files determine the placement and the choice of font.

\moveright0.1\textwidth\vbox{%
\footnotesize\begin{verbatim}
\title{A Thought for the Day}
\author{Fred Basset \and Horace Hosepipe}
\date{November 1992}
\maketitle
\end{verbatim}
}
\noindent will produce something along the lines of

\result{%
\begin{center}
{\Large A Thought for the Day}\\
\smallskip Fred Basset\quad Horace Hosepipe\\
\smallskip November 1992
\end{center}
}

This topmatter must appear {\em after\/} the 
\verb"\begin{document}" and before any other printing material.

\subsection{Sectioning commands}
As part of our task of describing the logical structure of
the document, we must indicate to \LaTeX\ where to start sectional
units.  To do this we make use of the sectioning commands shown
in table~\ref{tab:sectioning}.

\begin{table}[ht]
\centering
{\tt
\begin{tabular}{lll}
\bs part & \bs subsection & \bs paragraph\\
\bs chapter & \bs subsubsection & \bs subparagraph\\
\bs section & & \\
\end{tabular}
}
\caption{\LaTeX\ sectioning commands}
\label{tab:sectioning}
\end{table}

Each sectioning command accepts a single argument---the section
heading that is to be used.  \LaTeX\ will provide the section
numbering (and numbering of subsections within sections, etc.)\
so there is no need to include any number in the argument.
\LaTeX\ will also take care of whatever spacing is required to
set the new logical unit off from the others, perhaps through
a little extra space and using a larger font.  It will
also start a new page in the case that a new chapter is
begun.

The \verb@\part@ command is used for major subdivisions of
substantial documents.  The \verb@\paragraph@ and
\verb@\subparagraph@ commands are, unfortunately
confusing.  They are used to section off a modest number of
paragraphs of text---they don't start new paragraphs (remember that
that was done by leaving a blank line in our input file).
The names were retained for historical reasons.

It is always a good idea to {\em plan\/} the overall
sectional structure of a document in advance, or at least
give it a little thought.  Not that it would be difficult to
change your mind later (you could use the global replace
feature of an editor, for instance), but so that you have
a good idea of the structure that you have to describe to
\LaTeX.

The sectioning command that began the present sectional unit
of this document was

\moveright0.1\textwidth\vbox{%
\begin{verbatim}
\subsection{Sectioning commands}
\end{verbatim}
}
\noindent and that was all that was required to get the numbered
section name and the table of contents entry.

There are occasions when you want a heading to have all the
appearance of a particular sectioning command, but shouldn't
be numbered as a section in its own right or produce a table
of contents entry.  This can be achieved through using the
{\em *-form\/} of the command, as in \verb@\section*{...}@.
We'll see that many \LaTeX\ commands have such a *-form
which modify their behaviour slightly.

Not only will \LaTeX\ number your sectional units for you,
it will compile a table of contents too.  Just include the
command \verb@\tableofcontents@ after the 
\verb@\begin{document}@ command and after the topmatter that
should precede it.


\subsection{\LaTeX\ environments}
Perhaps the most powerful and convenient concept in the \LaTeX\
syntax is that of an {\em environment}.  We will see most of
the ``heavy'' typesetting problems we will encounter can be best
tackled by one or other of the \LaTeX\ environments.

Some environments are used to {\em display\/} a portion of text,
i.e.\ to set it off from the surrounding text by indenting it.
The {\tt quote} and {\tt verse} environments are examples of
these.  The {\tt center} environment allows us to centre
portions of text, while the {\tt flushright} environment
sets small portions of text flush against the right margin.

But the true power of \LaTeX\ begins to show itself when
we look at environments such as those that provide facilities
for itemised or enumerated lists, complex tabular arrangements,
and for taking care of figure and table positioning and captioning.
What we learn here will also be applicable in typesetting some
complicated mathematical arrangements in the next chapter.

All the environments are begun by a {\tt \bs begin{\{{\em name}\}}}
command and ended by an {\tt \bs end{\em \{name\}}}, where
{\em name\/} is the environment name.  These commands also
serve as begin-group and end-group\footnote{See section \ref{sec:groups}}
markers, so that all commands are local to the present environment---they
cannot affect text outside the environment.

We can also have environment embedded within environment within
environment and so on, limited only by memory available on the
computer.  We must, however, be careful to check that each of
these {\em nested\/} environments is indeed contained within
the one just outside of it.

\nsubsubsection{{\tt em} environment}
We start with a very simple environment, one which provides
an alternative to the \verb@\em@ command.  Remember that
\verb@\em@ does not accept an argument; it applies to
everything within its scope as dictated by the group
within which it is used.  This can be tricky if we wish
to emphasise a large amount of text, for we may forget
a group-delimiting brace and so upset the entire grouping
structure of our document.  In cases where we fear this might
happen, we can proceed as follows.

\moveright0.1\textwidth\vbox{%
\footnotesize\begin{verbatim}
\begin{em}
We must always be careful to match our group-delimiting
braces correctly.  If the braces in a document are unevenly
matched then \LaTeX\ will become confused because we will
have, in effect, indicated different scopes than we
intended for commands.
\end{em}
\end{verbatim}
}
\noindent which will give

\result{%
\begin{em}
We must always be careful to match our group-delimiting
braces correctly.  If the braces in a document are unevenly
matched then \LaTeX\ will become confused because we will
have, in effect, indicated different scopes than we
intended for commands.
\end{em}
}

Although \LaTeX\ doesn't care too much for how we format
our source file, it is obviously a good idea to lay it
out logically and readably anyway.  This helps minimise
errors as well as aids in finding them.  For this reason
I have adopted the convention of always placing the
environment \verb@\begin@ and \verb@\end@ commands on
lines by themselves.

\nsubsubsection{{\tt quote} and {\tt quotation} environments}
This environment can be used to display a part
of a sentence or paragraph, or even several
paragraphs, in such a manner that the material
stands out from the rest of the text.  This can
be used to enhance readability, or to simply
emphasise something.  Its syntax is simple:

\moveright0.05\textwidth\vbox{%
\footnotesize\begin{verbatim}
Horace smiled and retaliated:
\begin{quote}
\em You can mock the non-WYSIWYG nature of \TeX\
all you like.  You don't understand that that is
precisely what makes \TeX\ enormously more powerful
than that lame excuse for a typesetter you use.
And I'll bet that from start to finish of preparing
a document I'm quicker than you are, even if you
do type at twice the speed and have the so-called
advantage of WYSIWYG.  In your case, what you see
is {\em all\/} you get!
\end{quote}
and then continued with composing his masterpiece of the
typesetting art.
\end{verbatim}
}
\noindent produces the following typeset material:

\moveleft0.05\textwidth\vbox{\result{%
\noindent Horace smiled and retaliated:
\begin{quote}
\noindent\em You can mock the non-WYSIWYG nature of \TeX\
all you like.  You don't understand that that is
precisely what makes \TeX\ enormously more powerful
than that lame excuse for a typesetter you use.
And I'll bet that from start to finish of preparing
a document I'm quicker than you are, even if you
do type at twice the speed and have the so-called
advantage of WYSIWYG.  In your case, what you see
is {\em all\/} you get!
\end{quote}
and then continued with composing his masterpiece of the
typesetting art.
}
}

That is a much more readable manner of presenting Horace's
piece of mind than embedding it within a regular paragraph.
The {\tt quote} environment was responsible for the margins
being indented on both sides during the quote.  This example
has also been used to show how the commands that begin and
end an environment restrict the scope of commands issued within
that environment: The \verb@\em@ at the beginning of the
quote did not affect the text following the quote.  We have
also learned here that if we use \verb@\em@ within already
emphasised text, the result is roman type---and we don't
require an italic correction here because the final letter
of `all' was not sloping to the right.

The {\tt quotation} environment is used in just the same way
as the {\tt quote} environment above, but it is intended
for setting long quotations of several paragraphs.  It would
be suitable for quoting a few paragraphs from the text of
some speech, for instance.  \LaTeX\ treats the given
text just like normal text that it has to set into paragraphs,
except that it indents the margins a little.

\nsubsubsection{{\tt verse} environment}
This is provided to facilitate the setting of poetry.
When within the {\tt verse} environment, we use
\verb@\newline@ (or \verb@\\@) to end a line; and
what would normally signify a new paragraph
serves to indicate the start of a new stanza.
Let's have a shot at some cheap poetry.

\moveright0.1\textwidth\vbox{%
\footnotesize\begin{verbatim}
\begin{verse}
Roses are red\\
Violets are blue\\
I think \TeX\ is great\\
And so will you!

Roses are still red\\
Violets are still blue\\
I'm schizophrenic\\
And so am I.
\end{verse}
\end{verbatim}
}
\noindent will produce the following stunningly-creative ``poem'':

\result{%
\begin{verse}
Roses are red\\
Violets are blue\\
I think \TeX\ is great\\
And so will you!

Roses are still red\\
Violets are still blue\\
I'm schizophrenic\\
And so am I.
\end{verse}
}



\nsubsubsection{{\tt center} environment}
This environment allows the centring of consecutive lines
of text, new lines being indicated by a \verb@\\@.  If you
don't separate lines with the \verb@\\@ command then you'll
get a centred paragraph the width of the page,
which won't look any different to normal.  If only one
line is to be centred, then no \verb@\\@ is necessary.

\moveright0.1\textwidth\vbox{%
\footnotesize\begin{verbatim}
The {\tt center} environment takes care of the vertical
spacing before and after it, so we don't need to leave any.
\begin{center}
If we leave no blank line after the\\
{\tt center} environment\\
then the ensuing text will not\\
be regarded as part of a new\\
paragraph, and so will not be indented.\\
\end{center}

In this case we left a blank line after the environment,
so the new text was regarded as starting a new paragraph.
\end{verbatim}
}
\noindent gives the following text

\result{%
The {\tt center} environment takes care of the vertical
spacing before and after it, so we don't need to leave any.
\begin{center}
If we leave no blank line after the\\
{\tt center} environment\\
then the ensuing text will not\\
be regarded as part of a new\\
paragraph, and so will not be indented.\\
\end{center}

In this case we left a blank line after the environment,
so the new text was regarded as starting a new paragraph.
}

\nsubsubsection{{\tt flushright} and {\tt flushleft} environments}
The {\tt flushright} environment causes each line to be set
with its last character against the right margin, without trying
to stretch the line to to current text width.  The {\tt flushleft}
environment is similar.

\moveright0.1\textwidth\vbox{%
\footnotesize\begin{verbatim}
We can stop \LaTeX\ from justifying each line to both the
left and the right margins.
\begin{flushright}
The {\tt flushright} environment is\\
used for text with an even right margin\\
and a ragged left margin.
\end{flushright}
\begin{flushleft}
and the {\tt flushleft} environment is\\
used for text with an even left margin\\
and a ragged right margin.
\end{flushleft}
\end{verbatim}
}
\noindent gives the desired display

\result{%
We can stop \LaTeX\ from justifying each line to both the
left and the right margins.
\begin{flushright}
The {\tt flushright} environment is\\
used for text with an even right margin\\
and a ragged left margin.
\end{flushright}
\begin{flushleft}
and the {\tt flushleft} environment is\\
used for text with an even left margin\\
and a ragged right margin.
\end{flushleft}
}

One must be wary not to lapse into ``word-processing'' mode
when using these environments.  Remember that pressing return
at the end of a line in the input file does not serve to end
the current line there, but just to indicate the end of another word.
We have to use the \verb@\\@ command to end a line.

\nsubsubsection{{\tt verbatim} environment}
We can simulate typed text using the {\tt verbatim} environment.
The \verb@\tt@ (typewriter text) type style can be used for
simulating typed words, but runs into trouble if one of the
characters in the simulated typed text is a specially reserved
\LaTeX\ character.  For instance, \verb@{\tt type \newline}@
would not have the desired effect because \LaTeX\ would
interpret the \verb@\newline@ is an instruction to start
a new line.

The {\tt verbatim} environment allows the simulation of multiple
typed lines.  {\em Everything\/} within the environment is
typeset in typewriter font exactly as it appears in our source
file---obeying spaces and line breaks as in the source file and
not recognising the existence of any special symbols.

% this is going to be ugly, because we can't demonstrate an
% \end{verbatim} using the verbatim environment
\moveright0.1\textwidth\vbox{%
\footnotesize\begin{flushleft}
\tt\bs begin\{verbatim\}\\
In the verbatim environment we can type anything\\
we like.\\
So we don't  need to look out for uses of \%, \$, \& etc,\\
nor will control sequences like \bs newline have any\\
effect.\\
\bs end\{verbatim\}
\end{flushleft}
}
\noindent will produce the simulated input text

\moveright0.1\textwidth\vbox{%
\footnotesize\begin{verbatim}
In the verbatim environment we can type anything
we like.
So we don't  need to look out for uses of %, $, & etc,
nor will control sequences like \newline have any 
effect.
\end{verbatim}
}

The only thing that cannot be typed in the {\tt verbatim}
environment is the sequence \verb@\end{verbatim}@.  You
might notice that I still managed to simulate that
control sequence above.  One can always get what you want
in \TeX, perhaps with a little creativity.

If we want only to simulate a few typed words, such as when
I say to use \verb@\newline@ to start a new line, then the
\verb@\verb@ command is used.  This command has a slightly
odd syntax, pressed upon it by the use for which it was
intended. It cannot accept an argument, because we may 
want to simulate typed text that is enclosed by
\verb@{braces}@.  What one does is to choose any character
that is {\em not\/} in the text to be simulated, and use
a pair of these characters as ``argument delimiters''.  I usually use the 
\verb"@" or \verb@"@ charachters, as I rarely have any other uses for them.
Thus

\result{%
\noindent use \verb"\%" to obtain a \% sign
}
\noindent is typed as

\moveright0.1\textwidth\vbox{
\footnotesize\begin{verbatim}
use \verb"\%" to obtain a \% sign
\end{verbatim}
}

\nsubsubsection{{\tt itemize}, {\tt enumerate}, {\tt description} environments}
\LaTeX\ provides three predefined list-making environment, and a 
``primitive'' list environment for designing new list environments
of your own.  We shall just describe the predefined ones here.

There is delightfully little to learn in order to be able to create
lists.  The only new command is \verb@\item@ which indicates the
beginning of a new list item (and the end of the last one if this is
not the first item).  This command accepts an optional argument
(which means you'd enclose it in square brackets) that can be
used to provide an item label.  If no optional argument is given, then
\LaTeX\ will provide the item label for you;  in an
{\tt itemize} list it will bullet the items, in an
{\tt enumerate} list it will number the items, and in a list
of {\tt description}s the default is to have no label (which would look
a bit odd, so you're expected to use the optional argument there).

Remember that \verb@\item@ is used to separate list items; it
does not accept the list item as an argument.  

\moveright0.1\textwidth\vbox{%
\footnotesize\begin{verbatim}
\begin{itemize}
\item an item is begun with \verb@\item@
\item if we don't specify labels, then
      \LaTeX\ will bullet the items for us
\item I indent lines after the first in the
      input file, but that is just to keep things
      readable.  As always, \LaTeX\ ignores additional
      spaces.

\item a blank line between items is ignored, for
      \LaTeX\ is responsible for spacing items.
\item \LaTeX\ is in paragraph-setting mode when
      it reads the text of an item, and so will
      perform all the usual functions
\end{itemize}
\end{verbatim}
}
\noindent produces the following itemised list:

\result{
\begin{itemize}
\item an item is begun with {\tt\bs item}%\verb blew up here!
\item if we don't specify labels, then
      \LaTeX\ will bullet the items for us
\item I indent lines after the first in the
      input file, but that is just to keep things
      readable.  As always, \LaTeX\ ignores additional
      spaces.

\item a blank line between items is ignored, for
      \LaTeX\ is responsible for spacing items.
\item \LaTeX\ is in paragraph-setting mode when
      it reads the text of an item, and so will
      perform all the usual functions
\end{itemize}
}

Lists can also be embedded within one another,
for they are just environments and we said that
environments have this property.  Remember that
we must nest them in the correct order.  We
demonstrate with the following list, which also
shows how to use the {\tt enumerate} environment.

\moveright0.1\textwidth\vbox{%
\footnotesize\begin{verbatim}
\noindent I still have to do the following things:
\begin{enumerate}
\item Sort out LAN accounts for people on the course
   \begin{itemize}
   \item Have new accounts created for those not already
         registered on the LAN
   \item Make sure all users have a personal directory
        on the data drive
   \item Give read and scan rights to users in the \TeX\
         directories
   \item Add users to the appropriate LAN print queues
   \end{itemize}
\item Have a \TeX\ batch file added to a directory that
      is on a public search path
\item Finish typing these course notes and proof-read them
\item Photocopy and bind the finished notes
\end{enumerate}
\end{verbatim}
}
\noindent will give the following list

\result{
I still have to do the following things:
\begin{enumerate}
\item Sort out LAN accounts for people on the course
   \begin{itemize}
   \item Have new accounts created for those not already
         registered on the LAN
   \item Make sure all users have a personal directory
        on the data drive
   \item Give read and scan rights to users in the \TeX\
         directories
   \item Add users to the appropriate LAN print queues
   \end{itemize}
\item Have a \TeX\ batch file added to a directory that
      is on a public search path
\item Finish typing these course notes and proof-read them
\item Photocopy and bind the finished notes
\end{enumerate}
}

See how I lay the source file out in a readable fashion.
This is to assist myself, not \LaTeX.

The {\tt description} environment is, unsurprisingly, 
for making lists of descriptions.

\moveright0.1\textwidth\vbox{%
\footnotesize\begin{verbatim}
\begin{description}
\item[\tt itemize] an environment for setting itemised lists.
\item[\tt enumerate] an environment for setting numbered lists.
\item[\tt description] an environment for listing descriptions.
\end{description}
\end{verbatim}
}
\noindent will typeset the following descriptions:

\result{%
\begin{description}
\item[\tt itemize] an environment for setting itemised lists.
\item[\tt enumerate] an environment for setting numbered lists.
\item[\tt description] an environment for listing descriptions.
\end{description}
}

Note that the scope of the \verb@\tt@ commands used in the
item labels was restricted to the labels.

\nsubsubsection{{\tt tabbing} environment}
This environment simulates tabbing on typewriters.
There one chose the tab stops in advance (analysing
the material to be typed for the longest item in
each column) and typed entries consecutively,
hitting the tab key to move to the next tab stop
and return to move to the next line.

In the {\tt tabbing} environment, we proceed similarly.
We look for the worst-case line (that which will 
determine the desired tab stops) and use it to
set the tabs by inserting \verb@\=@ control symbols
at the points where we want tab stops. We then discard
that line using \verb@\kill@, since the worst-case line
might not be the first line in the material we have to
type.  We then type each line, using \verb@\>@ to move
to the next tab stop and \verb@\\@ to end a line.

\moveright0.1\textwidth\vbox{%
\footnotesize\begin{verbatim}
\begin{tabbing}
Cheddar cheese \= Recommended \= \$2.00 \kill
Green Ham \> Recommended \> \$2.00
Eggs \> 1 a week \> \$1.50
Cheddar cheese \> Hmmm \> \$0.80
Yak cheese \> Avoid \> \$0.05
\end{tabbing}
\end{verbatim}
}
\noindent gives the following uniformly-tabbed table

\result{%
\begin{tabbing}
Cheddar cheese \= Recommended \= \$2.00 \kill
Green Ham      \> Recommended \> \$2.00\\
Eggs           \> 1 a week    \> \$1.50\\
Cheddar cheese \> Hmmm   \> \$0.80\\
Yak cheese     \> Avoid  \> \$0.05
\end{tabbing}
}

In the format line I chose the longest entry
from each of the prospective columns.  I lined
some of the \verb@\>@ commands up in the source
just to keep things readable.

Remember that excess spaces are ignored.  \LaTeX\
sets the \verb@\kill@ed line normally and sees where the
tab stops requested will be needed in the typeset text.
Note also that commands given within the {\tt tabbing}
environment are local to {\em the current item}. 

Actually, we use the above approach in the case that
we require uniformly tabbed columns.  The format line
is not compulsory, and we can define tab stops dynamically.
See if you can make sense of the following.

\moveright0.1\textwidth\vbox{%
\footnotesize\begin{verbatim}
\begin{tabbing}
Entry in position 1,1 \= Entry 1,2 \= Entry 1,3\\
Entry in position 2,1 \> Entry 2,2 \> Entry 2,3\\
Entry 3,1 \= Entry 3,2 \> Entry 3,3\\
Entry 4,1 \> Entry 4,2 \> Entry 4,3
\end{tabbing}
\end{verbatim}
}
\noindent which produces

\result{%
\begin{tabbing}
Entry in position 1,1 \= Entry 1,2 \= Entry 1,3\\
Entry in position 2,1 \> Entry 2,2 \> Entry 2,3\\
Entry 3,1 \= Entry 3,2 \> Entry 3,3\\
Entry 4,1 \> Entry 4,2 \> Entry 4,3
\end{tabbing}
}

The are additional commands that can be used within
the tabbing environment to achieve special effects,
but we won't be discussing them here.

\nsubsubsection{{\tt tabular} environment}
The {\tt tabular} environment is used to produce
tables of items, particularly when the table
is predominantly rectangular and when line drawing
is required.  \LaTeX\ will make most decisions for
us;  for instance it will align everything for us
without having to be told which are the longest
entries in each column.

This environment is the first of many that use the
\TeX\ ``tabbing character'' {\tt \&}.  This character
is used to separate consecutive entries in a row
of a table, array, etc.  The end of a row is indicated
in the usual manner, by using \verb@\\@.
In this way the individual cells of the table, or array,
are clearly described to \LaTeX, and it can analyse
them to make typesetting decisions.  Commands issued
within a cell so defined are, again, local to that
cell.

The {\tt tabular} environment is also our first example
of an {\em environment with arguments}.  The arguments
are given, in braces as usual, just after the closing
brace after the environments name.  In the case of
{\tt tabular} there is a single mandatory argument
giving the justification of the entries in each column:
{\tt l} for left justified, {\tt r} for right justified,
and {\tt c} for centred.  There must be an entry for each
column of the table, and there is no default.  Let's start
with a simple table.

\moveright0.1\textwidth\vbox{%
\footnotesize\begin{verbatim}
\begin{tabular}{llrrl}
\bf Student name & \bf Number & \bf Test 1 & \bf Test 2 & \bf Comment\\
F. Basset    & 865432 & 78     & 85     & Pleasing\\
H. Hosepipe  & 829134 & 5      & 10     & Improving\\
I.N. Middle  & 853931 & 48     & 47     & Can make it
\end{tabular}
\end{verbatim}
}
\noindent will produce the following no-frills table

\result{%
\begin{tabular}{llrrl}
\bf Student name & \bf Number & \bf Test 1 & \bf Test 2 & \bf Comment\\
F. Basset        & 865432     & 78         & 85         & Pleasing\\
H. Hosepipe      & 829134     & 5          & 10         & Improving\\
I.N. Middle      & 853931     & 48         & 47         & Can make it
\end{tabular}
}
Note that a \verb@\\@ was not necessary at the end
of the last row.  Also note that, once again, the alignment
of the \verb@&@ characters was for human readability.
It is conventional to set columns of numbers with right
justification.  The \verb@\bf@ directives apply only the
entries in which they are given.

A {\tt |} typed in the {\tt tabular} environment's argument
causes a vertical line to be drawn at the indicated position
and extending for the height of the entire table.  An
\verb@\hline@ given in the environment draws a horizontal
line extending the width of the table to be drawn at the
vertical position at which the command is given.
A \verb@\cline@$\{i$-$j\}$ draws a line spanning columns
$i$ to $j$, at the vertical position at which the
command is given.  A repeated line-drawing command
causes a double line to be drawn.  We illustrate line
drawing in tables by putting some lines into our first
table.  We will type this example in a somewhat expanded
form, trying to make it clear why the lines appear where they
do.

\moveright0.1\textwidth\vbox{%
\footnotesize\begin{verbatim}
\begin{tabular}{|l|l|r|r|l|}
\hline
\bf Student name & \bf Number & \bf Test 1 & \bf Test 2 & \bf Comment\\
\hline
F. Basset        & 865432     & 78         & 85         & Pleasing\\
\hline
H. Hosepipe      & 829134     & 5          & 10         & Improving\\
\hline
I.N. Middle      & 853931     & 48         & 47         & Can make it\\
\hline
\end{tabular}
\end{verbatim}
}
\noindent which will give

\result{%
\begin{tabular}{|l|l|r|r|l|}
\hline
\bf Student name & \bf Number & \bf Test 1 & \bf Test 2 & \bf Comment\\
\hline
F. Basset        & 865432     & 78         & 85         & Pleasing\\
\hline
H. Hosepipe      & 829134     & 5          & 10         & Improving\\
\hline
I.N. Middle      & 853931     & 48         & 47         & Can make it\\
\hline
\end{tabular}
}

--
Gavin Maltby, University of Natal, Pietermaritzburg, South Africa
gmaltby@unpcs1.cs.unp.ac.za, maltby@unpsun1.cc.unp.ac.za
Any opinion expressed is mine and mine alone.
------------------------------------------------------------------