\documentclass[12pt,titlepage,twoside]{article}
\usepackage{graphicx,pst-all}   % graphics
\usepackage{hyphenat}           % enables control over hyphenation
\usepackage[T1]{fontenc}        % ...to write \textbf{\textsc{..}}
\usepackage{fancyvrb,moreverb}  % verbatim
\usepackage{float}              % enable float [H] option
\usepackage{ifthen}             % ifthenelse {condition}{true}{false}
\usepackage{makeidx}            % index
\usepackage{multirow}           % like multicolumn
\usepackage{amsmath}            % formerly amstex
\usepackage{amssymb}            % ams symbols (\mathbb fonts)
\usepackage{amscd}              % draws commutative diagrams
\usepackage{mathrsfs}           % more math symbols (viz., \mathscr)
\usepackage{bm}                 % bold math fonts (\mathbm)
\usepackage{theorem}            % enables more control over newtheorem
\usepackage{url}                % \url{...}

\renewcommand\contentsname{Table of Contents}   % change `Contents'
\renewcommand\url{\begingroup\urlstyle{sf}\Url} % puts url in sf font

\input{mydefs}  % My commands and environments
\makeindex      % make myfile.idx (input to makeindex at command line)

\newcounter{mycounter}  % Used for demo in section
\newlength{\mylength}   % "
% Following are used in Math Exercise
{\theorembodyfont{\rmfamily} \newtheorem{Xdefn}{Definition}}
{\theorembodyfont{\rmfamily} \newtheorem{Xth}{Theorem}}

\def\defaultheight{\textheight}
\def\longerheight{7.9in}

\raggedbottom           % Prevents vertical spaces inserted to justify
%%%%%%%%%%%%%%%%%%%%%%%%% End Preamble %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
%%%%%%%%%%%%%%%%%%%%%%% Begin Cover Page %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\title{A Simplified Introduction to \LaTeX}
\author{ Harvey J. Greenberg 
      \\ University of Colorado at Denver
      \\ Mathematics Department
      \\ PO Box 173364
      \\ Denver, CO 80217-3364
      \\ Harvey.Greenberg@cudenver.edu
      \\ \url{http://www.cudenver.edu/~hgreenbe/}
       }

%\date{February 8, 2000}
%\date{April 18, 2000}
%\date{January 5, 2001}
%\date{August 28, 2001}
%\date{January 4, 2003}
%\date{January 23, 2003}
%\date{July 14, 2003}
%\date{November 15, 2003}
\date{July 9, 2004}   % posted
\maketitle
%%%%%%%%%%%%%%%%%%%%%%%%% End Cover Page %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\pagenumbering{roman} \pagestyle{myheadings}
\setlength{\textheight}{\longerheight}
\tableofcontents
\setlength{\textheight}{\defaultheight}

\newpage \addcontentsline{toc}{section}{List of Figures}
\listoffigures \label{front:lof}

\newpage \addcontentsline{toc}{section}{List of Tables}
\listoftables  \label{front:lot}

\setlength{\textheight}{\longerheight}
\newpage \addcontentsline{toc}{section}{Preface}
\centerline {\Large\bf Preface}
\bigskip

\noindent
The majority of this book is about using \LaTeXe~\cite{latex2e,usrguide}, a
descendant of \LaTeX, designed by Leslie Lamport~\cite{latex}, based on \TeX,
originated by Donald E. Knuth~\cite{tex}.
This is a \textit{typesetting} program, not a word processor.
You enter some editor that saves plain text files.
Then, you type text freely until you need something special, such as
\textit{italic} font or a complex mathematical expression, like
\[ \lim_{\vareps\goto 0_+} \Bigfrac
       {\displaystyle{\int_{a_i}^{a_i+\vareps}} \sqrt{1+(x-\mu)^2}\, dx}
                     {\Phi(\vareps)}.
\]

It was the desire to have high quality, low cost publications in mathematics
and related disciplines that caused Knuth (pronounced \textsf{Kah-nooth})
to invent \TeX\ (pronounced \textsf{Tek}) in the late 1970's.
Originally believing that he could write a program in less than a year that
could typeset documents, he actually ended up defining an entire branch of
research in computer science.
It was 10 years later that he published his seminal book~\cite{tex},
but he published articles along the way, and he permanently changed the
way mathematical documents are prepared.
\LaTeX\ (pronounced \textsf{Lah-tek} or \textsf{Lay-tek}) is a collection of
\textit{macros} built on top of \TeX\ that ``represents a balance between
functionality and ease of use''~\cite[p.~xiii]{latex}.
\LaTeXe\ is the current version, developed by a team of volunteers:
Johannes L. Braams, David P. Carlisle, Alan Jeffrey, Frank Mittelbach,
Chris Rowley, and Rainer Sch\"{o}pf~\cite{latex2e}.

A comprehensive coverage of \LaTeX\ and the many enhancements to it is
given by the \textit{The \LaTeX\ Companion}~\cite{companion}.
By contrast, this book is designed to be a succinct introduction,
omitting many of the things \LaTeXe\ can do.
My goal is to offer enough of an introduction that someone not acquainted
with \LaTeX\ (or with \TeX) can write a term paper, thesis, or
article, using \LaTeXe\ to produce high quality results.
Exercises are provided for guided instruction, which should be just a
few classes.
For one who is well acquainted with computers, particularly unix,
the basics that are covered should take less than 10 hours, and one could
do all of the exercises.
For one who is just learning how to use a computer, it will take longer,
especially getting used to functioning at the command line.
In any case, the finer points require more study.

\begin{flushright}
\textit{Happy \LaTeX ing.}
\nopagebreak

--- Harvey J. Greenberg \\ Denver, Colorado
\end{flushright}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\setlength{\textheight}{\defaultheight}
\newpage
\addcontentsline{toc}{section}{Acknowledgments}
\centerline {\Large\textbf{Acknowledgments}} \bigskip

\noindent
The author thanks the many contributors in the \verb|comp.text.tex|
newsgroup, particularly
Donald Arseneau,
Herman Bruyninckx,
David Carlisle,
Robin Fairbairns,
Jonathan Fine,
Denis Girou,
David Haller,
Dan Luecking,
Timothy Murphy,
Sebastian Rahtz,
Axel Reichert,
Thomas Ruedas,
Bernd Schandl,
Anton Schwaighofer,
M\aa rten Svantesson,
and
Matt Swift,
who were very generous with taking time to answer so many questions
on a regular basis.
I also received useful comments from people who read an earlier draft
that I made available on the web, notably William Briggs.
I especially thank Kasper B. Graversen whose in-depth review has made this 
version much better than my original.
One student, Andrea Dean, provided feedback that led to several points of 
clarification.
Last, but not least, I thank Allen G. Holder, who taught me
\LaTeX\ in the first place.

\vspace{.75in}

\addcontentsline{toc}{section}{Sources of \LaTeX\ Software}

\centerline {\Large\textbf{Sources of \LaTeX\ Software}}
\bigskip

\noindent
The basic \LaTeX\ software system is available free of charge for
unix systems, and MiKTeX~\cite{miktex} is available free of charge for
DOS systems.
The best source of these, and additional packages \index{package}
that extend the \LaTeX\ capabilities (to which I refer in this book),
is at the Comprehensive TeX Archive Network (CTAN)~\cite{CTAN},
at three host sites (and many mirrors):
\begin{enumerate}
\setlength{\itemsep}{-3pt} %  \item \the\itemsep
  \item \url{http://ctan.tug.org/} in Boston, MA, USA,
  \item \url{http://www.tex.ac.uk/} in Cambridge, UK, and
  \item \url{http://www.dante.de/} in Mainz, Germany (in German).
\end{enumerate}
These all describe how to search and browse the FTP sites for
software and documents.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newpage \pagenumbering{arabic} \pagestyle{headings}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\section{Overview}
%\markboth{\leftmark}{\leftmark}

You will create a file, called the \LaTeX\ \textit{source}, which is plain text.
To keep things simple, its suffix is \texttt{.tex}. 
For example, I refer to \texttt{myfile.tex} as a plain text source file 
that you create.
Figure~\ref{fig:document} shows the structure of this file, which I shall
describe in greater detail throughout this book.

\begin{figure}[ht]
{\small
\[ \begin{array}{|l|l} \cline{1-1}
     \begin{array}{l}
        \verb|% This is myfile.tex| \\
        \verb|% |\mbox{\textit{notes to yourself can go here}}
      \end{array}
                           & \left\} \begin{array}{l} \\
                                  \mbox{Anything following \% is ignored} \\
                                  \mbox{ (used for \indx{comments}).}
                                \end{array}\right.
 \\
     \begin{array}{l}
         \verb|\documentclass[|options\verb|]{|style\verb|}| \\
           \mbox{ \it optional specifications} \\
           \mbox{ --- e.g., declaring use of packages } \\
     \end{array}
                                       & \left\} \begin{array}{l}
                                            \mathit{Preamble}\index{preamble} \\
                                      \mbox{(blank lines do not matter)} \\
                                           \end{array}\right.
 \\ \\
    \begin{array}{l}
       \verb|\begin{document}| \\ \mc{1}{c}{\vdots} \\
       \verb|\end{document}| \\
    \end{array}
                                  & \left\} \begin{array}{l}
                                        \mathit{Body}\index{body} \\
                                        \mbox{This is the document \it\indx{environment}.}
\vspace{.06in} \\
                                      \end{array} \right.
\\                                &  \begin{array}{l}
                                        \mbox{All that follows is ignored}\\
                                        \mbox{(could be used for comments).}
                                      \end{array}

\\ \cline{1-1}
   \end{array}
\]
} % end small
\vspace{-.2in}
\caption{The Structure of a \LaTeX\ Document. \label{fig:document}}
\end{figure}
\index{\texttt{$\backslash$documentclass}}
\index{environment!document} \index{special character}
\index{package}

In the preamble, there are many options, depending upon the style; the
intrinsic \indx{document styles} are: \texttt{article}, \texttt{book}, 
\texttt{letter}, \texttt{report}, and \texttt{slides}.
Most publishers have their own style, which they provide for you to download.
Among these are professional societies, notably the
American Mathematical Society (amsmath style) 
\index{AMS}
and the Society for Industrial and Applied Mathematics (siam style).
\index{SIAM}

The focus throughout this book is on the article style.
Further, I shall be using defaults for almost everything, concentrating
on getting started with using \LaTeX\ as quickly as possible.
Later, some of the options, like margin settings and other preamble
specifications are covered, as well as more advanced topics for customizing
your document.

\index{file!tex}
Are you ready to write your first \LaTeX\ document?
Copy the source file shown in Figure~\ref{fig:helloworld} and name it
\verb|myfile.tex|.
Then, at the \indx{command line}, enter:
\cmdline{latex myfile}\index{latex command}
(In an MS Windows system, the \textit{command line} is the DOS command
line, which you enter by running
Start$\longrightarrow$Programs$\longrightarrow$MS-DOS~Prompt, 
or by Start$\longrightarrow$Run and entering cmd or command into the window.)

\begin{figure}[ht]
\bigskip
\begin{center}
{\footnotesize
\begin{boxedverbatim}
 \documentclass{article}
 \begin{document}

    Hello world.

 \end{document}
\end{boxedverbatim}
} % end footnotesize
\end{center}
\vspace{-.1in}
\caption{ Your First \LaTeX\ Source File \label{fig:helloworld}}
\end{figure}

This is called \textit{compiling} your source, which creates several output
files.
\index{compile}
The only one you need to be concerned with now is the \textit{dvi file},
\index{file!dvi}
which the latex program (called a ``compiler'') names \texttt{myfile.dvi}.
One of three things will have occurred:

\begin{description}

   \item [Case 1.] You got messages, but they were not fatal errors.

       Among the non-fatal messages you will generally see are warnings like:
\vspace*{-.3in}

       \begin{verbatim}
         Overfull \hbox ...
         Overfull \vbox ...
         Underfull \hbox ...
         Underfull \vbox ...
       \end{verbatim}
       \index{message!warning}
       \index{message!Overfull \dots} \index{message!Underfull \dots}
\vspace*{-.3in}

       Do not worry about these.

   \item [Case 2.] You got a fatal error \indx{message}.

       You must find and correct it.
       This is called \textit{\indx{debugging}} your source.
       Sometimes the error message tells you what went wrong, such as missing
       a brace (characters \verb|{| and \verb|}|, which you will come to know
       and love), or some command was not recognized due to being misspelled.
       Many times the message is not very informative, so you are advised
       to compile often.
       That way you will know that what you did in the last few minutes
       contains the error.

   \item [Case 3.] You got no messages.

        Something went wrong and you need to ask for help.
\end{description}

If all went well, the first thing to do is
\textcolor{red}{\textbf{\textsc{save a backup}}}
by copying your source file to another subdirectory, or to a different name.
In unix do this by entering:
\cmdline{cp -p myfile.tex myfile-1.tex}
(The \verb|-p| is to keep the date and time of the source file.)
Change \verb|-1| to another qualifier each time (e.g., \verb|-2| \dots),
so you have a collection of backups.
If you are running under DOS, use \texttt{copy myfile.tex}~\textit{destination},
where the \textit{destination} is either \texttt{a:} or some backup file name.
(If you are familiar with DOS, nothing more need be said; if not,
you need to learn how to create, edit, and save plain text files.)

Next you want to view the result.
If you are in a \indx{unix} environment, you can view the result with the
\textit{\indx{dvi viewer}}, \texttt{\indx{xdvi}}.
At the command line enter: \cmdline{xdvi myfile}
and it will come on your screen.  (There is more to do if you are working
remotely, in which case you might ask someone for help.)

If you are using \indx{DOS}, the viewer that comes with 
\indx{MiKTeX}~\cite{miktex}, a free software system by Christian Schenk, 
is called \indx{YAP}.
At the DOS command line you enter: \cmdline{YAP myfile}
You will see various options for viewing and printing.

Under unix, \texttt{xdvi} does not have a print option, so
you first need to convert the dvi file to postscript.
\index{file!ps (postscript)}
This is done with the program, \texttt{dvips}.
\index{\texttt{$\backslash$dvips}}
At the command line enter: \cmdline{dvips myfile -o}
(The \texttt{-o} tells the system you want the output to go to a file, rather
than just print; your installation might already have file output as the
default, in which case the  \texttt{-o} is not needed.)
This will result in the creation of the postscript file
\texttt{myfile.ps}.  You can print it by any number of ways, including the
unix command, \texttt{lpr myfile.ps}.

The same conversion program can be run under DOS (and comes with MiKTeX),
and you might want to obtain \texttt{myfile.ps} for a variety of reasons,
including posting it on the web.
To view or print a postscript file under DOS, you can run a program
called \texttt{\indx{ghostview}}.
You will need to find out more about viewing and printing postscript files
that suit your particular needs.

Summarizing, you begin by entering a plain text editor.
In \indx{unix} this could be pico, emacs, vi or vim.
In \indx{DOS} you can use EDIT at the command line, or you can use
\textsf{Notepad}, %\copyright
\textsf{Wordpad} or \textsf{MS Word}.
If you use a word processor, however, you must take absolutely no advantage
of its formatting.
You should even put in hard return characters (i.e., press \Enter
at the end of a line instead of letting the word processor do it for you),
and \textbf{never use tabs}.
In MS Word, when saving the file, be sure to specify plain text, and you must
continue to specify the suffix as \texttt{.tex} (otherwise, it will use
\texttt{.doc} as its suffix).
If you want to check that the file is really plain text, enter
\cmdline{EDIT myfile.tex}
at the DOS command line and see how the file appears.
(There are some free text editors on the web; use your favorite search engine
to find them.)

Once you have your source ready to compile, enter \texttt{latex myfile}, and
if all is well, enter your dvi viewer.
Under unix or DOS use \texttt{\indx{dvips}} to convert the dvi file to a
postscript (ps) file, which can be printed.
These steps are given in Figure~\ref{fig:comsequence}.
Execute these commands for the source file shown in
Figure~\ref{fig:helloworld}.  The result should be one line of output:
Hello World.  Congratulations!


\begin{figure}[H]
\vspace{1.2in}
\begin{center}
\psset{unit=1in}
\rput(-2,0){\rnode{T}{\psframebox{\texttt{myfile.tex}}}}
\rput( 0,0){\rnode{D}{\psframebox{\texttt{myfile.dvi}}}}
\rput( 2,0){\rnode{P}{\psframebox{\texttt{myfile.ps }}}}
\psset{arrowsize=3pt 5}
\ncline{->}{T}{D} \ncline{->}{D}{P}
\rput(-2,.75){\ovalnode{e}{create/edit}}
\rput( 0,.75){\ovalnode{v}{view/print}}
\rput( 2,.75){\ovalnode{r}{print/post}}
\psset{arrowsize=2pt 3}
\ncline{<->}{T}{e} \ncline{->}{D}{v} \ncline{->}{P}{r}
\rput(-1,.4){\begin{tabular}{c} compile \\ with \\ \texttt{latex} \end{tabular}}
\rput( 1,.4){\begin{tabular}{c} convert \\ with \\ \texttt{dvips} \end{tabular}}
\end{center}

\caption{Command Sequence from Source to Postscript \label{fig:comsequence}}
\end{figure}

Now change your document to specify a font size of 12pt (default is 10pt)
\index{font size}
by changing your first line to the following:

{\small
\begin{verbatim}
 \documentclass[12pt]{article}
\end{verbatim}
} % end small

\noindent
The ``pt'' (abbreviation for ``point'') is one of the
\indx{units of measurement}, about $\frac{1}{72}$in;
other units used in many parts of \LaTeX\ are \texttt{in} (inches),
\texttt{cm} (centimeters), and \texttt{em}
(like the letter m, which is a printer measure equal to the
width of M in the current font).

This book is designed for quick entry into using \LaTeX, but do not be
reluctant to read the last chapter.  
It tells you how to define your own commands and how to separate them 
into an input file that simplifies changing things, like notation.  
I also cannot elaborate just yet on ``using packages,'' \index{package}
indicated in Figure~\ref{fig:document}, except to say that they are used 
to fulfill some function, and I shall introduce specific packages 
throughout this book.
(One of the strengths of \LaTeX\ is the community of people who provide 
packages for everyone to use at no cost.)
The orientation here is by function, beginning with how to write text.


\section{Text}

We begin by illustrating the most common text formatting, much like you
would want in a word processor.
(The power of \LaTeX\ will be evident when we get to mathematical
expressions, but even some text, especially tables, will demonstrate the
superior quality of the \LaTeX\ results.)
First, consider how to make sections and subsections in article style.
\index{\texttt{$\backslash$section}} \index{section}
Figure~\ref{fig:text1a} is the source that produces the result in
Figure~\ref{fig:text1b}, showing how sections and subsections are defined.
\index{subsection}
Note the automatic numbering, and how extra spaces and blank lines
have no effect.

\begin{figure}[H]
\begin{center}
{\footnotesize
\begin{boxedverbatim}
 \documentclass[12pt]{article}

 % We have defined the document to be an article using 12 point font.
 % Blank lines mean nothing here, in the preamble.

 \begin{document}               % Begin document "environment".

 \section{This is a Section}
 \subsection{This is a subsection}
 This is the body of the subsection.
 I can move to a new line anytime, and I can put in     lots
 of       blanks     with       no        effect.



 Skipping four lines is the same as skipping one line
 --- it starts a new paragraph.

 \subsection{Here is another subsection}
 \section{Here is another section}
 \end{document}
\end{boxedverbatim}
} % end footnotesize
\end{center}
\vspace{-.1in}

\caption{An Introductory Document Source (Result in Figure \ref{fig:text1b})
         \label{fig:text1a}}
\end{figure}
\index{\texttt{$\backslash$section}} \index{section}
\index{\texttt{$\backslash$subsection}} \index{subsection}

\begin{figure}[H]
\begin{quote}
\noindent \\
{\Large \textbf{1 ~~ This is a Section}} \\

\noindent
{\large \textbf{1.1 ~~ This is a subsection}}\medskip

\noindent
This is the body of the subsection.
I can move to a new line anytime, and I can put in     lots
of       blanks     with       no        effect.
\vspace{-.1in}

\hspace{15pt}Skipping four lines is the same as skipping one line
--- it starts a new paragraph.
\bigskip

\noindent
{\large \bf 1.2 ~~ Here is another subsection}
\bigskip

\noindent
{\Large \bf 2 ~~ Here is another section}

\end{quote}
\psset{unit=1in}
\psline(.2,.2)(5.2,.2)(5.2,3)(.2,3)(.2,.2)
\vspace{-.2in}
\caption{An Introductory Document Result (Source in Figure \ref{fig:text1a})
         \label{fig:text1b}}
\end{figure}


\subsection{Fonts and Paragraphs}

Figure \ref{fig:text:position-a} shows the source to produce different
\indx{paragraph positions}:  centered, flush left,
flush right, and justified (the default).
Note that these are \textit{\indx{environment}s},
a concept you need to understand about \LaTeX.
The general form of an environment uses the following syntax:
\medskip

\begin{tabular}{l}
   \verb|\begin{|\textit{environment}\verb|}| \\
      \mc{1}{c}{\vdots} \\
   \verb|\end{|\textit{environment}\verb|}|
\end{tabular}
\medskip

\begin{figure}[H]
\begin{center}
{\footnotesize
\begin{boxedverbatim}
 \begin{center}
   The text is centered because I have entered the center environment.
   Text remains centered as long as we remain in this environment.
 \end{center}
 \begin{flushleft}
   Now we are out of the centering environment, and have begun the
   flushleft environment.
 \end{flushleft}
 \begin{flushright}
   This is another paragraph, but in the flushright environment.
   You will have occasion to use all four paragraph positions.
 \end{flushright}

 I am back to normal justification.  The added space you see between
 the above paragraphs is due to entering those environments.
\end{boxedverbatim}
} % end footnotesize
\end{center}
\vspace{-.1in}
\caption{ Positioning Paragraphs Source
         (Result in Figure \ref{fig:text:position-b})
         \label{fig:text:position-a}}
\end{figure}
\index{environment!center}
\index{environment!flushleft} \index{environment!flushright}
%\nopagebreak

\begin{figure}[H]
\begin{quote} \noindent
 \begin{center}
   The text is centered because I have entered the center environment.
   Text remains centered as long as we remain in this environment.
 \end{center}
 \begin{flushleft}
   Now we are out of the centering environment, and have begun the
   flushleft environment.
 \end{flushleft}
 \begin{flushright}
   This is another paragraph, but in the flushright environment.
   You will have occasion to use all four paragraph positions.
 \end{flushright}

  \hspace{.22in}
  I am back to normal justification.  The added space you see between
  the above paragraphs is due to entering those environments.
\end{quote}
\psset{unit=1in}
\psline(.2,.2)(5.2,.2)(5.2,3.2)(.2,3.2)(.2,.2)
\vspace{-.2in}
\caption{ Positioning Paragraphs Result
         (Source in Figure \ref{fig:text:position-a})
         \label{fig:text:position-b}}
\end{figure}
%\index{font style!typewriter}
%\index{font style!sans serif}
%\index{font style!italic}
\vspace{-.1in}

Instead of the \textsf{center} environment, you can use the
\cmd{centerline} command; \index{\texttt{$\backslash$centerline}}
they differ in that the environment skips a line before and after the
paragraph, shown in Figures \ref{fig:centering-a} and \ref{fig:centering-b}.

\begin{figure}[H]
\begin{center}
{\footnotesize
\begin{boxedverbatim}
  This precedes center environment.
  \begin{center} This line is centered.  \end{center}
  This continues after centering.

  This precedes centerline.

  \centerline{This line is centered.}
  This continues after centering.
\end{boxedverbatim}
} % end footnotesize
\end{center}
\vspace{-.1in}
\caption{Centering Source (Result in Figure \ref{fig:centering-b})
         \label{fig:centering-a}}
\end{figure}

\begin{figure}[H]
\begin{quote} \noindent \\
  This precedes center environment.
  \begin{center} This line is centered. \end{center}
  This continues after centering.

  This precedes centerline.

  \centerline{This line is centered.}
  This continues after centering.
\end{quote}
\psset{unit=1in}
\psline(.2,.2)(5.2,.2)(5.2,2.15)(.2,2.15)(.2,.2)
\vspace{-.2in}
\caption{Centering Result (Source in Figure \ref{fig:centering-a})
         \label{fig:centering-b}}
\end{figure}


You can also suppress indentation of the first line of a paragraph
with the \cmd{noindent} command.  Here is an example:
\medskip

   \verb|\noindent This paragraph is not indented.| produces: \newline
This paragraph is not indented.

Table~\ref{tbl:fonts} lists the fonts that are intrinsic in a basic
latex installation.
(More fonts are available in packages, \index{package}
usually free of charge.)
In technical writing, you will have particular use for the italic font,
\pagebreak
as it is used when introducing a new term.  For example,

\begin{tabbing}
  \produces \= \kill
    \> \verb|A \textit{group} is defined on a set of elements \dots| \\
  \produces \>
      A \textit{group} is defined on a set of elements \dots
\end{tabbing}

\noindent
(The \produces\ symbol can be read as ``produces.'')
Note the use of the \cmd{dots} command, \index{\texttt{$\backslash$dots}}
which produces the ellipsis.
\vspace{-.2in}

\begin{center}
\begin{table}[ht]
 \caption{Intrinsic Font Styles \label{tbl:fonts}}
\vspace{.1in}

\begin{center}
\begin{tabular}{lcl}
   What you write                     &         & How it appears               \\ \hline
  \verb|This is \textbf{boldface}.|   &\produces& This is \textbf{boldface}.   \\
  \verb|This is \textit{italic}.|     &\produces& This is \textit{italic}.     \\
  \verb|This is \textrm{roman}.|      &\produces& This is \textrm{roman}.      \\
  \verb|This is \textsc{small caps}.| &\produces& This is \textsc{small caps}. \\
  \verb|This is \textsf{sans serif}.| &\produces& This is \textsf{sans serif}. \\
  \verb|This is \textsl{slanted}.|    &\produces& This is \textsl{slanted}.    \\
  \verb|This is \texttt{typewriter}.| &\produces& This is \texttt{typewriter}. \\
\hline
\end{tabular}
\end{center}
\end{table}
\end{center}
\index{font style!boldface}
\index{font style!italic}
\index{font style!slanted}
\index{font style!small caps}
\index{font style!sans serif}
\index{font style!typewriter}
\index{font style!underlined}

\vspace{-.1in}

Some combinations of font styles can be produced.  For example,
\vspace{.1in}

\noindent\hspace{.3in}
\verb@\textbf{\textit{bolditalic}}@ $\Rightarrow$ \textbf{\textit{bolditalic}}.
\vspace{.1in}

\noindent
The \textit{argument} of \cmd{textbf} is \verb|\textit{bolditalic}|.
\index{\texttt{$\backslash$text}\textit{font}}
The general form is
\texttt{$\backslash$text}\textit{font}\texttt{\{}\textit{text}\texttt{\}},
\label{term:textfont}
where \textit{font} is one of
\{\texttt{bf, it, rm, sc, sf, sl, tt}\}, as seen in Table~\ref{tbl:fonts}.

Not all combinations are in the basic \LaTeXe\ installation.
In particular, you must put \verb|\usepackage[T1]{fontenc}| in
\index{package!fontenc}
your preamble to obtain:
\vspace{.1in}

\noindent\hspace{.3in}
\verb@\textbf{\textsc{bold small caps}}@
  $\Rightarrow$  \textbf{\textsc{bold small caps}}.
\index{font style!bold small caps}
\vspace{.1in}

Font size can also be varied at will.  \index{font size}
Figures \ref{fig:sizes-a} and \ref{fig:sizes-b} give the source and result
for common variations.
Notice how the paragraph spacing changes to accommodate the variation in
font size.
These size variations can be combined with font styles, such as
using \verb|{\Large\textbf{heading}}| for some heading.

\begin{figure}[ht]
\begin{center}
{\footnotesize
\begin{boxedverbatim}
 You can make the text {\large large} or {\Large larger} or
 even {\LARGE larger still}.  You can also make it {\huge huge}.
 You might want to make something {\small small} or
 {\footnotesize smaller} or even {\scriptsize smaller still}.
 You can make it really {\tiny tiny}.
\end{boxedverbatim}
} % end footnotesize
\end{center}
\vspace{-.1in}
\caption{ Some Font Sizes Source (Result in Figure \ref{fig:sizes-b})
         \label{fig:sizes-a}}
\end{figure}

\begin{figure}[H]
\bigskip
\begin{quote} \noindent \\
  You can make the text {\large large} or {\Large larger} or
  even {\LARGE larger still}.  You can also make it {\huge huge}.
  You might want to make something {\small small} or
  {\footnotesize smaller} or even {\scriptsize smaller still}.
  You can make it really {\tiny tiny}.
\end{quote}
\psset{unit=1in}
\psline(.3,.2)(5.1,.2)(5.1,1.35)(.3,1.35)(.3,.2)
\vspace{-.2in}
\caption{ Some Font Sizes Result (Source in Figure \ref{fig:sizes-a})
         \label{fig:sizes-b}}
\end{figure}

\index{font size}
%\index{font size!large} \index{font size!Large} \index{font size!LARGE}
%\index{font size!huge}
%\index{font size!small} \index{font size!footnote} \index{font size!script}
%\index{font size!tiny}

The use of braces to enclose a font size specification is like an
environment.  Optionally, we can explicitly use the environment syntax:
\verb|\begin{|\textit{size}\verb|}| \dots \verb|\end{|\textit{size}\verb|}|.
\index{environment!large}
For example, \verb|\begin{large} This is large.\end{large}| produces the
same result as \verb|{\large This is large.}|.
The environment syntax is useful when you want to keep the size for a
large block of text, and the braces format is useful for short phrases.
(There is no intrinsic environment for font styles.)

It is straightforward to \underline{underline} text --- just write
\verb|\underline{|\textit{text}\verb|}|.
\index{\texttt{$\backslash$underline}}
We can also \frame{frame} text just by writing
\verb|\frame{|\textit{text}\verb|}|.
\index{\texttt{$\backslash$frame}} \index{\texttt{$\backslash$fbox}}
We can give \fbox{frame} some room around the edges by using
\cmd{fbox} instead.  (More on framing in \S\ref{sec:Graphics},
p.~\pageref{term:framebox}.)
To $\overline{\mbox{overline}}$ is as straightforward, but learning it must
wait until we enter \textit{math mode}.

Now consider ways to indent a block of text.
Here is an example using  the \textit{quote environment}, \index{environment!quote}
which was generated by putting \verb|\begin{quote}|
before the text and \verb|\end{quote}| after it:

\begin{quote}
   The construction of the real number system, notably by Dedekind cuts,
   was motivated by the need to fix calculus, which ran into trouble due
   to insufficient rigor in dealing with limits.
\end{quote}

The quote environment is intended for short quotes, generally one
short paragraph (as above), or a sequence of one line quotes, separated
by blank lines.
The \textsf{quotation} environment \index{environment!quotation}
is used for long quotations, having more than one paragraph (separated
by blank lines).
The indentation is the same as the quote, except the first line of
each new paragraph is indented.
(Just as in the regular text, this can be overridden by the \cmd{noindent}
command.) \index{\texttt{$\backslash$noindent}}
Here is an example that was created by putting \verb|\begin{quotation}|
before the text and \verb|\end{quotation}| after it.

\index{environment!quotation}

\begin{quotation}
   ``Computers do not dream, any more than they play.  We are far
   from certain what dreams are good for, but we know what they
   indicate: a great deal of information processing goes on far
   beneath the surface of man's purposive behavior, in ways and for
   reasons that are only very indirectly reflected in his overt activity.''

\hfill                                                --- Alan M. Turing
\bigskip

   ``There are reports that many executives make their decisions by
   flipping a coin or by throwing darts, etc.  It is also rumored
   that some college professors prepare their grades on such a basis.
   Sometimes it is important to make a completely `unbiased' decision;
   this ability is occasionally useful in computer algorithms, for example
   in situations where a fixed decision made each time would cause the
   algorithm to run more slowly.''

\hfill                                                --- Donald E. Knuth
\end{quotation}

\index{environment!quotation}

The quotes are by two pioneers of algorithms, Alan M. Turing
and Donald E. Knuth. Their names appear on the right, after their quote,
by skipping a line and entering \cmd{hfill}
\index{\texttt{$\backslash$hfill}}
(which means \textit{\indx{horizontal fill}}), to make the line flush right.
Here are some other things to notice about this example:

\begin{itemize}
  \item There are left and right \indx{quotation marks}.
        I used \verb|`` ''|, not \verb|" "|, to create this more
        stylistic quotation punctuation.

  \item The \indx{dash} that appears before each name is created by
        three minus signs, \verb|---|.  The more minus
        signs you use, the longer the \indx{dash}.
        The convention is that one dash is for hyphenation, two are for
        ranges, such as page numbers, and three are for punctuation ---
        i.e., use \verb|---| preceding ``i.e.''

  \item There is extra space between the two quotations.
        This was done with the \cmd{bigskip} command.
        \index{\texttt{$\backslash$bigskip}}
\end{itemize}

Figures \ref{fig:skips-a} and \ref{fig:skips-b} illustrate three levels of
skipping: small, medium and big.
Later, we shall look at a way to have a much finer range of vertical spacing.
\index{spacing!vertical}
\bigskip

\begin{figure}[ht]
\begin{center}
{\small
\begin{boxedverbatim}
 This is a first line. \bigskip

 The space you see above is a big skip.  \medskip

 The space you see just above is a medium skip.  \smallskip

 The space you now see just above is a small skip.

 This is just an ordinary line space.
\end{boxedverbatim}
} % end footnotesize
\end{center}
\vspace{-.1in}
\caption{Skipping Line Spaces Source (Result in Figure \ref{fig:skips-b})
         \label{fig:skips-a}}
\end{figure}

\index{\texttt{$\backslash$bigskip}}
\index{\texttt{$\backslash$medskip}}
\index{\texttt{$\backslash$smallskip}}

\begin{figure}[ht]
\bigskip
\begin{quote} \noindent \\
 This is a first line. \bigskip

 The space you see above is a big skip.  \medskip

 The space you see just above is a medium skip.  \smallskip

 The space you now see just above is a small skip.

 This is just an ordinary line space.
\end{quote}
\psset{unit=1in}
\psline(.3,.2)(5.0,.2)(5.0,2)(.3,2)(.3,.2)
\vspace{-.2in}
\caption{Skipping Line Spaces Result (Source in Figure \ref{fig:skips-a})
         \label{fig:skips-b}}
\end{figure}


The \textsf{verse} environment \index{environment!verse}
indents oppositely: lines after the first.
The following was generated by putting
\verb|\begin{verse}| before the text and \verb|\end{verse}| after it:

\begin{verse}
\textit{Neglect of mathematics works injury to all knowledge, since he who is
  ignorant of it cannot know the other sciences or the things of this world.
  And what is worse, men who are thus ignorant are unable to perceive their
  own ignorance and so do not seek a remedy.
} \hfill --- Roger Bacon
\end{verse}

The italics were specified in the usual way, by enclosing Bacon's
verse with \verb|\textit{|\dots\verb|}|.
(Designed for poetry, each line is a stanza in the verse, and if
a stanza runs long, this form of indentation makes it clear.)
Bacon's name appears flush right, again from the \cmd{hfill} command,
\index{\texttt{$\backslash$hfill}}
but this time it is on the last line of the verse, rather than a new line.
This is achieved by not skipping a line after the verse:

{%\newpage
\begin{verbatim}
 \begin{verse}
 \textit{Neglect of mathematics ...
 } \hfill --- Roger Bacon
 \end{verse}
\end{verbatim}
} % end samepage


\subsection{Lists} \label{subsec:Lists}

There are three intrinsic \indx{list environment}s, distinguished by what
appears at the beginning of each item:  number, bullet, or your description
(perhaps nothing).
To illustrate, here is the use of a \textsf{description} list environment
\index{list environment!description}
\index{environment!description}
to itemize steps involved in learning \LaTeX, whose source is indicated
by Figure~\ref{fig:list:descr}.

\begin{description}

  \item [Basic Document Preparation.]  Knowing how to setup the latex source
       file, make paragraphs, vary fonts, and list items are enough to
       prepare a basic document without mathematics or tables (like a resume).

  \item [Making Tables.] \LaTeX\ provides a means to make tables with the
       \textit{tabular environment}, and its versatility puts it far ahead
       of word processors.

  \item [Bibliography.]  Knowing how to create a bibliography,
       in particular with \Bibtex.

  \item [Mathematics.] This is a power of \LaTeX\ and one reason why it has
       become standard in writing mathematical papers.
       I will show you how to do virtually any mathematical
       expression in line with the text, or in \textit{math display mode}.

  \item [Graphics.] This has progressed a great deal in the past few years
       thanks to many people who have provided packages free of charge.

  \item [Other.]  There are a great many things to learn beyond the simple
       introduction when using \LaTeX\ to prepare a thesis, report or article.

\end{description}


\begin{figure}[ht]
\begin{center}
{\footnotesize
\begin{boxedverbatim}
 \begin{description}
   \item [Basic Document Preparation.]  Knowing how to setup ...
   \item [Making Tables.] \LaTeX~ provides a means ...
   \item [Bibliography.]  Knowing how to create a bibliography ...
   \item [Mathematics.] This is the power of \LaTeX~ and one ...
   \item [Graphics.] This has progressed a great deal in the ...
   \item [Other.]  There are a great many things to learn ...
 \end{description}
\end{boxedverbatim}
} % end footnotesize
\end{center}
\vspace{-.1in}
\caption{ Description List Environment \label{fig:list:descr}}
\end{figure}

Two new things appear in the example:  the use of \verb|\LaTeX| to
produce \LaTeX, and the use of \verb|~| (called ``tilde'') to enter a space.
\index{spacing} \index{special character}
Without the tilde, the result would be \LaTeX provides, even with a
space after \verb|\LaTeX| in the source.  (The reason is that a space (or
some delimiter) is needed after \verb|\LaTeX| (or any keyword) in order to 
distinguish it completely, and one might want a punctuation mark, like a comma,
following \verb|\LaTeX|, which requires no space.)

The text within the square brackets is an option.  If present, as in this
example, it is printed in boldface.
With no option, the description list is one way to have text indented
the opposite of a normal paragraph:  the first line is at the left and
subsequent lines are indented.  For example,

{\small
\begin{verbatim}
  \begin{description}
     \item \textsf{This is how one item in a description list 
          environment looks with no optional text at the beginning.}
   \end{description}
\end{verbatim}
}

\noindent
produces the following result:

   \begin{description}
     \item \textsf{This is how one item in a description list 
          environment looks with no optional text at the beginning.}
    \end{description}
%\medskip

\noindent
Unlike the verse environment, the first line goes almost to the left margin,
and the lines extend all the way to the right margin.

Next, Figures \ref{fig:list:itemize-a} and \ref{fig:list:itemize-b}
illustrate the \textsf{itemize} list environment,
\index{list environment!itemize} \index{environment!itemize}
which prints bullets.
Note the indentation of each item and the spacing between items.
You see the nesting of two itemize lists, but any type of list can be nested
within any other type.
\bigskip

\begin{figure}[ht]
\begin{center}
{\footnotesize
\begin{boxedverbatim}
 \begin{itemize}
    \item This is item 1 and our task has just begun.  Blank lines
          before an item have no effect.

    \item This is item 2 and we shall limit to just this few.

          A blank line within an item does create a new paragraph,
          using the indentation of the itemize environment.

       \begin{itemize}
          \item A second (nested) itemized list changes the bullet
                and indents another level.
       \end{itemize}
 \end{itemize}
\end{boxedverbatim}
} % end footnotesize
\end{center}
\vspace{-.2in}
\caption{ Itemize List Environment Source
         (Result in Figure \ref{fig:list:itemize-b}) \label{fig:list:itemize-a}}
\end{figure}

\begin{figure}[H]
\begin{quote} \noindent \\
  \begin{itemize}
     \item This is item 1 and our task has just begun.  Blank lines
           before an item have no effect.

     \item This is item 2 and we shall limit to just this few.

           A blank line within an item does create a new paragraph,
           using the indentation of the itemize environment.

        \begin{itemize}
           \item A second (nested) itemized list changes the bullet
                 and indents another level.
        \end{itemize}
  \end{itemize}
\end{quote}
\psset{unit=1in}
\psline(.1,.2)(5.2,.2)(5.2,2.05)(.1,2.05)(.1,.2)
\vspace{-.2in}
\caption{ Itemize List Environment Result
        (Source in Figure \ref{fig:list:itemize-a}) \label{fig:list:itemize-b}}
\end{figure}

Finally, I describe the \textsf{enumerate} list environment,
\index{list environment!enumerate} \index{environment!enumerate}
where the default numbering is with Arabic numerals.
With nested enumeration, the numbering changes at each level.
Figures \ref{fig:list:enum-a} and \ref{fig:list:enum-b} illustrate with
three levels of nesting.
\bigskip

\begin{figure}[ht]
\begin{center}
{\footnotesize
\begin{boxedverbatim}
 \begin{enumerate}
    \item This is item 1, and we are having fun.
    \item This is item 2, and it's time to number anew.
       \begin{enumerate}
          \item Back to item 1, but we are not yet done.
          \item Two is new.
             \begin{enumerate}
                \item One again!
                \item Two (b) or knot 2b?
             \end{enumerate}
       \end{enumerate}
 \end{enumerate}
\end{boxedverbatim}
} % end footnotesize
\end{center}
\vspace{-.1in}
\caption{ Enumerate List Environment Source
         (Result in Figure \ref{fig:list:enum-b}) \label{fig:list:enum-a}}
\end{figure}

\begin{figure}[H]
\begin{quote} \noindent \\
  \begin{enumerate}
     \item This is item 1, and we are having fun.
     \item This is item 2, and it's time to number anew.
         \begin{enumerate}
            \item Back to item 1, but we are not yet done.
            \item Two is new.
               \begin{enumerate}
                   \item One again!
                   \item Two (b) or knot 2b?
               \end{enumerate}
         \end{enumerate}
  \end{enumerate}
\end{quote}
\psset{unit=1in}
\psline(.45,.2)(4.6,.2)(4.6,1.9)(.45,1.9)(.45,.2)
\vspace{-.2in}
\caption{ Enumerate List Environment Result
         (Source in Figure \ref{fig:list:enum-a}) \label{fig:list:enum-b}}
\end{figure}


\subsection{Making Tables}

A \indx{table} is made with the \textsf{tabular} environment,
\label{term:tabular_environemnt} \index{environment!tabular}
which has the following syntax:
\smallskip

\begin{tabular}{l}
    \verb|\begin{tabular}{|\textit{column specs}\verb|}| \textit{options} \\
     ~\textit{first row spec} \verb|\\| \\
         \hspace{.2in} \vdots   \\
    ~\textit{last row spec} [\verb|\\ |\textit{options}] \\
    \verb|\end{tabular}|
\end{tabular}
\medskip

\noindent
As indicated, each row ends with two backslashes, \verb|\\|.
\index{\texttt{$\backslash\backslash$}}
Each column specification can be left, center or right, abbreviated by just
one character: \linebreak
\texttt{l}, \texttt{c} or \texttt{r}, respectively.
In the body of the table, each column is separated by \verb|&|.
\index{special character}
Figure~\ref{fig:table1} shows an example of a $2\times 3$ table.

\begin{figure}[ht]
\begin{center}
\begin{tabular}{lp{.3in}l}
   How it appears && What you write \\ \hline
\vspace{-.1in} \\
   \begin{tabular}{lcr}
     left & center & right \\
       1  &  2     &  3
   \end{tabular}
&& \small \begin{tabular}{l}
      \verb|\begin{tabular}{lcr}| \\
      \verb| left & center & right \\| \\
      \verb|   1  &  2     &  3|     \\
      \verb|\end{tabular}|
   \end{tabular}
\vspace{-.1in} \\
\\ \hline
\end{tabular}
\end{center}
\vspace{-.2in}
\caption{ A $2\times 3$ Table \label{fig:table1}}
\end{figure}

We can draw a horizontal line before any new row by specifying \verb|\hline|.
\index{\texttt{$\backslash$hline}}
To draw a line after the last row, enter \verb|\\ \hline|
(the \verb|\\| is simply part of the syntax and does not add an extra row
to the table).
The column specifications can have \verb@|@ on either side to
indicate a vertical line.
Figure~\ref{fig:table2} illustrates a combined use of these options.

\begin{figure}[ht]
\begin{center}
\begin{tabular}{lp{.3in}l}
   How it appears && What you write \\ \hline
\vspace{-.1in} \\
   \begin{tabular}{|l|c|r|} \hline
     -110 & -120.12 & -130 \\ \hline
      210 &  220. &  230 \\ \hline
   \end{tabular}
&& \small \begin{tabular}{l}
      \verb@\begin{tabular}{|l|c|r|} \hline@ \\
      \verb|  -110 &  120 & -130 \\ \hline| \\
      \verb|   210 & -220 &  230 \\ \hline| \\
      \verb|\end{tabular}|
   \end{tabular}
\vspace{-.1in} \\
\\ \hline
\end{tabular}
\end{center}
\vspace{-.2in}
\caption{ A $2\times 3$ Table with Horizontal and Vertical Lines
         \label{fig:table2}}
\end{figure}
\index{\texttt{$\backslash$hline}}

We could draw lines that span some rows and/or columns.
The way to vary vertical line drawing is with the column specifications:
put \texttt{|} only where you want a vertical line.
The way to vary horizontal line drawing is by using
\verb|\cline{|\textit{first col}\verb|-|\textit{last col}\verb|}| instead of
\verb|\hline|.
\index{\texttt{$\backslash$cline}}
This is illustrated in Figure~\ref{fig:table3}.
\nopagebreak

\begin{figure}[H]
\begin{center}
\begin{tabular}{lp{.2in}l}
   How it appears && What you write \\ \hline
\vspace{-.1in} \\
   \begin{tabular}{l|cc|}
     Name  & Test 1 & Test 2  \\ \cline{1-1}
     Bob   &  67    &  72     \\
     Sue   &  72    &  67     \\ \cline{2-3}
   \end{tabular}
&&\footnotesize \begin{tabular}{l}
   \verb@\begin{tabular}{l|cc|}@ \\
     \verb| Name  & Test 1 & Test 2 \\ \cline{1-1}| \\
     \verb| Bob   &  67    &  72 \\ |   \\
     \verb| Sue   &  72    &  67 \\ \cline{2-3}|  \\
   \verb|\end{tabular}|
\end{tabular}
\vspace{-.1in} \\
\\ \hline
\end{tabular}
\end{center}
\vspace{-.2in}
\caption{ A Table with Partially Spanning Horizontal and Vertical Lines
         \label{fig:table3}}
\end{figure}

We can have tables nested within tables.
Figures~\ref{fig:tablenested-a} and \ref{fig:tablenested-b} illustrate
this, while showing more variation with lines and using various fonts.
Here are some things to note:

\begin{itemize}
  \item The entire table uses sans serif font style.  This is done by
        specifying \verb|\textsf{| {\em before} entering the tabular environment
        (and closing with \verb|}| just after it).
  \item Within the tables, fonts are varied: Roman is in the Roman font,
        specified by \verb|\textrm{Roman}|, \index{font style!Roman}
        Greek is in italic, specified by \verb|\textit{Greek}|, and
        \index{font style!italic}
        upper case is in small caps, specified by \verb|\textsc{upper case}|.
        \index{font style!small caps}
  \item A new \indx{column specification} is introduced:
        \verb|p{|\textit{length}\verb|}|, where any unit of measure can
                  \index{units of measurement}
        be used as the length of the spacing.
        In this example .3~inches is specified.
        Note that this counts as a column, so you see \verb|&&| to separate
        the two tables, each being a column of the main table.
  \item The \verb|\underline| \index{\texttt{$\backslash$underline}}
        command is used to underline \textsf{Table 1}, which is column 1
        of the main table, whereas \verb|\cline{3-3}| is used to underline
        all of column 3 of the main table, headed by \textsf{Table 2}.
\end{itemize}

\begin{figure}[ht]
\begin{center}
{\footnotesize
\begin{boxedverbatim}
 \textsf{
  \begin{tabular}{lp{.3in}l} \\
     \underline{Table 1}  &&    Table 2 \\ \cline{3-3}
   \\
     \begin{tabular}{|lc|} \hline
        Object    & Symbols used \\ \hline
        variable  & lower case \textrm{Roman} \\
        parameter & \textit{Greek}            \\
        constant  & \textsc{upper case} \textrm{Roman} \\
     \end{tabular}
  && % Begin Table 2
     \begin{tabular}{|rcc|} \hline
       * & 1 & 2 \\ \cline{2-2}
         & 3 & 4 \\ \cline{1-1}\cline{3-3}
     \end{tabular}
  \end{tabular}
 } % end sf
\end{boxedverbatim}
} % end footnotesize
\end{center}
\vspace{-.1in}
\caption{Nested Tables Source (Result in Figure \ref{fig:tablenested-b})
         \label{fig:tablenested-a}}
\end{figure}

\begin{figure}[ht]
\begin{quote} \noindent \\
 \textsf{
  \begin{tabular}{lp{.3in}l} \\
     \underline{Table 1}  &&    Table 2 \\ \cline{3-3}
   \\
     \begin{tabular}{|lc|} \hline
        Object    & Symbols used \\ \hline
        variable  & lower case \textrm{Roman} \\
        parameter & \textit{Greek}            \\
        constant  & \textsc{upper case} \textrm{Roman} \\
     \end{tabular}
  && % Begin Table 2
     \begin{tabular}{|rcc|} \hline
       * & 1 & 2 \\ \cline{2-2}
         & 3 & 4 \\ \cline{1-1}\cline{3-3}
     \end{tabular}
  \end{tabular}
} % end sf
\end{quote}
\psset{unit=1in}
\psline(.3,0)(5.2,0)(5.2,1.5)(.3,1.5)(.3,0)
%\vspace{-.2in}
\caption{Nested Tables Result (Source in Figure \ref{fig:tablenested-a})
         \label{fig:tablenested-b}}
\end{figure}


There are times when we want to put a good bit of text into some columns
of a table.  Suppose, for example, we write the following:

{\samepage
  {\small
    \begin{verbatim}
 \begin{tabular}{|l|l|} \hline
     This amount of text is too long to fit on one line of
     the page.  & This is column 2. \\ \hline
 \end{tabular}
    \end{verbatim}
  }
} % end samepage
\vspace{-.2in}

\noindent
The result will be to run off the edge of the paper:
\medskip

 \begin{tabular}{|l|l|} \hline
     This amount of text is too long to fit on one line of
     the page.  & This is column 2. \\ \hline
 \end{tabular}
\vspace*{-.05in}

One solution is to insert new rows and break up the text manually:
\vspace{-.1in}

{\samepage
  {\small
    \begin{verbatim}
 \begin{tabular}{|l|l|} \hline
     This amount of text is too long to fit on one
           & This is column 2. \\
     line of the page.  & \\ \hline
 \end{tabular}
    \end{verbatim}
  }
\nopagebreak \vspace{-.1in}

\noindent $\Rightarrow$
 \begin{tabular}{|l|l|} \hline
     This amount of text is too long to fit on one
           & This is column 2. \\
     line of the page.  & \\ \hline
 \end{tabular}
} % end samepage
\bigskip

Instead, one can assign a fixed width to a column by specifying
\verb|p{|\textit{length}\verb|}|.  For example,

{\newpage
  {\small
    \begin{verbatim}
 \begin{tabular}{|p{2in}|l|} \hline
 This amount of text is too long to fit on one line of the page.
          & This is column 2. \\ \hline
 \end{tabular}
    \end{verbatim}
  }
\nopagebreak \vspace{-.1in}

\noindent $\Rightarrow$
 \begin{tabular}{|p{2in}|l|} \hline
 This amount of text is too long to fit on one line of the page.
          & This is column 2. \\ \hline
 \end{tabular}
} % end samepage
\bigskip

Another solution is to use the \cmd{parbox} command
\index{\texttt{$\backslash$parbox}} \label{term:parbox}
(short for ``paragraph box'').
This has the form
\verb|\parbox[|\textit{option}\verb|]{|\textit{width}\verb|}{|%
\textit{text}\verb|}|,
where the \textit{option} is the placement: \verb|t|~=~top and
\verb|b|~=~bottom (default is center).  Here are two examples:

{\samepage
  {\small
    \begin{verbatim}
 \begin{tabular}{|l|l|} \hline
     \parbox{2in}{This amount of text is too long to fit on
        one line of the page.} & This is column 2. \\ \hline
 \end{tabular}
    \end{verbatim}
  }
\nopagebreak \vspace{-.1in}

\noindent $\Rightarrow$
 \begin{tabular}{|l|l|} \hline
     \parbox{2in}{This amount of text is too long to fit on one
     line of the page.} & This is column 2. \\ \hline
 \end{tabular}
} % end samepage
\bigskip

{\samepage
  {\small
    \begin{verbatim}
 \begin{tabular}{|l|l|} \hline
     \parbox[t]{2in}{This amount of text is too long to fit on
        one line of the page.} & This is column 2. \\ \hline
 \end{tabular}
    \end{verbatim}
  }
\nopagebreak \vspace{-.1in}

\noindent $\Rightarrow$
 \begin{tabular}{|l|l|} \hline
     \parbox[t]{2in}{This amount of text is too long to fit on
        one line of the page.} & This is column 2. \\ \hline
 \end{tabular}
} % end samepage
\bigskip

\noindent
They differ only in the placement of the paragraph box, the latter
being at the top to align it with column 2 in the manner shown.

When making a column or parbox small, the spacing can become unsightly
due to being justified.  
This is overcome with the \textsf{flushleft} environment.  
\index{environment!flushleft}
Figures \ref{fig:table:parbox-a} and \ref{fig:table:parbox-b} illustrate
this, and note that it contains other commands that can be in any 
paragraph.

\begin{figure}[H]
\begin{center}
{\footnotesize
\begin{boxedverbatim}
 \begin{center}
 \begin{tabular}{ll} 
    \parbox[t]{3in}{\begin{flushleft}
       This is column 1, and I might want to display something:

       \medskip\centerline{\fbox{How sweet it is.}}\medskip

       This is not the same as

       \medskip\fbox{\centerline{How sweet it is.}}
                   \end{flushleft} }
   & \parbox[t]{1in}{\begin{flushleft}\textsf{This is column 2,
             which I have put in sans serif font.}
                   \end{flushleft} }
 \end{tabular}
 \end{center}
\end{boxedverbatim}
} % end footnotesize
\end{center}
\vspace{-.1in}
\caption{\texttt{\textbackslash parbox} Source 
      (Result in Figure \ref{fig:table:parbox-b}) \label{fig:table:parbox-a}}
\end{figure}

% -b
\begin{figure}[ht]
 \begin{center}
 \begin{tabular}{ll} 
    \parbox[t]{3in}{\begin{flushleft}
       This is column 1, and I might want to display something:

       \medskip\centerline{\fbox{How sweet it is.}}\medskip

       This is not the same as

       \medskip\fbox{\centerline{How sweet it is.}}
                   \end{flushleft} }
   & \parbox[t]{1in}{\begin{flushleft}\textsf{This is column 2,
             which I have put in sans serif font.}
                   \end{flushleft} }
 \end{tabular}
 \end{center}
\psset{unit=1in}
\psline(.3,.2)(5.1,.2)(5.1,1.7)(.3,1.7)(.3,.2)
\vspace{-.2in}
\caption{\texttt{\textbackslash parbox} Result 
     (Source in Figure \ref{fig:table:parbox-a}) \label{fig:table:parbox-b}}
\end{figure}
\index{\texttt{$\backslash$parbox}} \index{\texttt{$\backslash$centerline}}
\index{environment!flushleft}

Any measurement, such as the width of a paragraph box, can be determined
by some length parameter, rather than a fixed constant.  
For example, see exercise~\ref{text:exer:parbox} at the end of this
chapter and consider \verb|\parbox{.3\linewidth}|...

If we want some heading to span several columns, this is done by the command,
\verb|\multicolumn{|\textit{number}\verb|}{|\textit{col spec}\verb|}{|\textit{entry}\verb|}|.
\index{\texttt{$\backslash$multicolumn}}
The first argument is the number of columns to span (starting where
\cmd{multicolumn} is specified).
This must be in the range 1 to however many columns remain from the
current position.
The second argument is any valid column specification, such as
\texttt{l}, \texttt{c}, \texttt{r}, with, or without, a vertical line 
specification, \texttt{|}, on either side.  
Finally, the third argument is the text.

The \cmd{multicolumn} command can also serve to override some column 
specification.
Suppose, for example, we want the columns to be left justified,
but we want the headers to be centered.
Figures \ref{fig:tablemc-a} and \ref{fig:tablemc-b} illustrate
these uses of \cmd{multicolumn}.
The first is used to center `Test number' over columns 2 and 3.  
The line in the source begins with \texttt{\&} to skip column 1, then
the \cmd{multicolumn} specifies 2 columns, centered with vertical lines
before and after.
The second use simply centers the `Student' header.
The last use of \cmd{multicolumn} centers `Taken in class' over 
columns 2 and 3.  Unlike the first use,  
the vertical line at the end is missing because \verb@c@ was specified 
\nopagebreak
instead of \verb@c|@.

\begin{figure}[H]
\begin{center}
{\footnotesize
\begin{boxedverbatim}
  \begin{center}
  \begin{tabular}{l|cc|c}
               & \multicolumn{2}{|c|}{Test number} \\
    \multicolumn{1}{c|}{Student} &    1   &    2   & Average \\ \hline
                    Bill         &   67   &   72   &   70.5  \\
                    Charleetah   &   72   &   67   &   70.5  \\ \hline
               & \multicolumn{2}{c}{Taken in class}     \\ \cline{2-3}
  \end{tabular}
  \end{center}
\end{boxedverbatim}
} % end footnotesize
\end{center}
\vspace{-.1in}
\caption{Multicolumn Source (Result in Figure \ref{fig:tablemc-b}) 
         \label{fig:tablemc-a}}
\end{figure}

% -b
\begin{figure}[ht]
  \begin{center}
  \begin{tabular}{l|cc|c}
          & \multicolumn{2}{|c|}{Test number} \\
   \multicolumn{1}{c|}{Student}  &  1 &  2 & Average \\ \hline
                    Bill         & 67 & 72 &   70.5  \\
                    Charleetah   & 72 & 67 &   70.5  \\ \hline
            & \multicolumn{2}{c}{Taken in class}\\ \cline{2-3}
  \end{tabular}
  \end{center}
\psset{unit=1in}
\psline(.2,.1)(5.2,.1)(5.2,1.3)(.2,1.3)(.2,.1)
\vspace{-.1in}
\caption{Multicolumn Result (Source in Figure \ref{fig:tablemc-a})
         \label{fig:tablemc-b}}
\end{figure}

Tables that are too long to fit on one page could be broken manually,
but the \textsf{longtable} package   \index{package!longtable}
enables automatic page breaks by the \LaTeX\ compiler.  
(You obtain the package from CTAN~\cite{CTAN}.)  
In the preamble, specify \verb|\usepackage{longtable}|.   
Then, instead of the \textsf{tabular} environment, 
specify the \textsf{longtable} environment,  \index{environment!longtable}
which has most of the same options.


\subsection{Special Characters} \index{special character}

We have already seen that some characters are special, in that they
\textit{delimit} something.
In particular, \verb|\| delimits every \LaTeX\ command, and
\verb|%| ends a line, enabling comments. \index{comment}
How do we print such characters?
One way is with the symbol, itself, like \verb|\%|.
Other times a keyword, like \verb|\textbackslash|, is needed.
The Appendix contains complete tables of these special characters
(including those I do not cover explicitly in the chapters).
Of particular importance are the braces, written as \verb|\{ \}| to obtain
\{ \}.
(Recall that the braces by themselves create a local environment, like
\verb|{\large|\dots\verb|}|.)

When using a keyword to specify a special character, it appears with
whatever font is active.
Table~\ref{tbl:specialchars} 
\ifthenelse{\equal{\pageref{tbl:specialchars}}{\thepage}}{}{(next page)}
illustrates this with commonly used special characters.
The brackets, [ ], are different because they can be entered directly,
except when they are used to delimit an option in the syntax, in
which case they can be obtained by enclosing them in braces.
One example is the description list environment, illustrated in
Figure~\ref{fig:descrenvbracket}.
\index{environment!description}
(Another is in the tabular environment
(page~\pageref{term:tabular_environemnt}),
\index{environment!tabular}
but I omitted a discussion of position options that are specified by brackets.)


\begin{figure}[ht]
\begin{center}
\begin{tabular}{ll}
   How it appears & \hspace*{-10pt} What you write \\ \hline
\vspace{-.1in} \\
      {\bf This is option} for item.
&\hspace*{-7pt}\footnotesize \begin{tabular}{l}
   \verb|\begin{description}| \\
   \verb|  \item [This is option] for item.| \\
   \verb|\end{description}|
                \end{tabular}
\vspace{.1in} \\
   {[This is not option]} for item.
&\hspace*{-7pt}\footnotesize \begin{tabular}{l}
   \verb|\begin{description}| \\
   \verb|  \item {[This is not option]} for item.| \\
   \verb|\end{description}|
                \end{tabular}
\vspace{3pt} \\ \hline
\end{tabular}
\end{center}
\vspace{-.1in}
\caption{ Obtaining Brackets in a Description List Environment
         \label{fig:descrenvbracket}}
\end{figure}
%\vspace{-.1in}

\renewcommand{\arraystretch}{1.5}
\begin{table}[ht]
\caption{Writing Special Characters \label{tbl:specialchars} }
\begin{center}
\begin{tabular}{cc|c|c}
 Character & How you            & \mc{2}{c}{\raisebox{1ex}{Other fonts} }
\vspace{-.1in} \\
 (Roman)   & write it           &  italic      & large  \\ \hline
   \{ \}   & \verb|\{ \}|       & \it \{ \}    & \large \{ \} \\
  \% \$ \# \& \_  & \verb|\% \$ \# \& \_|
                         & \it \% \$ \# \& \_  & \large \% \$ \# \& \_ \\
  \textbackslash & \verb|\textbackslash|
                               & \textit{\textbackslash}
                                               & \large\textbackslash 
\vspace{-.1in} \\
  \textasciicircum & \verb|\textasciicircum|
                               & \textit{\textasciicircum}
                                               & \large\textasciicircum 
\vspace{-.1in} \\
  \textasciitilde & \verb|\textasciitilde|
                               & \textit{\textasciitilde}
                                               & \large\textasciitilde 
\vspace{-.1in} \\
  \textregistered & \verb|\textregistered|
                               & \textit{\textregistered}
                                               & \large\textregistered \\
       {[ ]}   & \verb|{[ ]}|  & \it {[ ]}     & \large {[ ]}  \\
\hline
\end{tabular}
\end{center}
\end{table}
\renewcommand{\arraystretch}{1}
\index{special character} 
\index{special character!\texttt{$\backslash$text\textit{spec}}}

Another way to print the unprintable is with the \textsf{verbatim} environment
\index{environment!verbatim} or the \cmd{verb} command.
\index{\texttt{$\backslash$verb}} \index{environment!verbatim}
Unlike all other commands, \cmd{verb} does not use braces to delimit
its argument.
It uses any other character to delimit a string, which can contain any
character except itself.
For example, we can write \verb|\verb@{}%$#\@| to generate the string
\verb@{}%$#\@ (delimited by \verb|@|), which is printed in typewriter 
font style.  The verbatim environment uses the usual syntax:
\medskip

\begin{tabular}{l}
  \verb|\begin{verbatim}| \\
  \mc{1}{c}{\vdots} \\
  \verb|\end{verbatim}|
\end{tabular}
\medskip

\noindent
This is how the source code was created for the figures, like
Figure~\ref{fig:tablemc-a} (p.~\pageref{fig:tablemc-a}).

Another class of special characters are letters with \indx{accents}.
Table~\ref{tbl:accents} shows some common examples;
a complete table is in the Appendix.
For example, write \verb|Poincar\'{e}| to have Poincar\'{e} and
\verb|G\"{o}del| to have G\"{o}del.  An accent could be applied to any
letter, even if it does not relate to some language --- for example,
\verb|\"{b}\~{c}\^{d}| $\Rightarrow$ \"{b}\~{c}\^{d}.

\LaTeX\ has a basic library of accents 
\index{accents}
and special characters for writing in languages other than English,
some of which are shown in Appendix Table~\ref{apndx:text:accents}
\index{font style!non-English}
 --- e.g., \verb|?`|\produces ?` and \verb|\aa|\produces \aa.
In some cases, these are not sufficient, particularly if the
entire document is to be in a non-English language.
For that purpose there are some packages,
such as Babel~\cite{babel} (also see \cite[Chapter~9]{companion}).
\index{package!babel}
%\vspace{-.1in}

\begin{table}[ht]
\caption{ Some Accents for Letters \label{tbl:accents} }
\begin{center}
\begin{tabular}{ccc}
  What you write &         & What you see \\ \hline
  \verb|\"{a}|   &\produces&   \"{a}      \\
  \verb|\`{e}|   &\produces&   \`{e}      \\
  \verb|\'{i}|   &\produces&   \'{i}      \\
  \verb|\~{o}|   &\produces&   \~{o}      \\
  \verb|\^{u}|   &\produces&   \^{u}      \\ \hline
\end{tabular}
\end{center}
\end{table}


\subsection{Tabbing}

The \textsf{tabbing} environment \index{environment!tabbing}
provides an alternative to the tabular environment by letting you set
your own column tabs.
Table~\ref{tbl:tabbing1} shows a simple case with two basic
\indx{tabbing commands}, \verb|\=| to define a tab setting,
and \verb|\>| to move to a tab setting.
In addition,  \verb|\\| ends each row,
but unlike the tabular environment, the first sentence continues normally,
without extra spaces, so that the position of the tab is not equivalent
to that of a table's column.
%A third tabbing command illustrated is \verb|\+|, which directs each
%subsequent line to begin one tab to the right.  Its companion is the
%\verb|\-| command, which moves the left margin back to the left one tab.
\vspace{-.1in}

\begin{table}[ht]
\caption{The Tabbing Environment \label{tbl:tabbing1} }
\begin{center}
\begin{tabular}{ll}
   What you see & \hspace*{-.03in}What you write \\ \hline
\if 0
   \hspace{-.06in}\begin{tabular}{l}
     Begin: set tab 1\dots  set tab 2 \\
     \hspace*{38pt}skip to 1 \hspace*{12pt}then to 2 \\
     \hspace*{100pt}skip to 2 \\
   \end{tabular}
\fi 
\parbox{2.2in}{\hspace{-.06in}
  \begin{tabbing}
    Begin: \=set tab 1\dots \=set tab 2 \\
           \>skip to 1      \>then to 2 \\
           \>               \>skip to 2 
  \end{tabbing}
}
& \footnotesize \hspace{-.09in}\begin{tabular}{l}
   \verb@\begin{tabbing}@ \\
   \verb@ Begin: \=set tab 1\dots \=set tab 2\\@ \\
   \verb@        \>skip to 1      \>then to 2\\@ \\
   \verb@        \>            \>skip to 2@ \\
   \verb@\end{tabbing}               @
                 \end{tabular}
\\ \hline
\end{tabular}
\end{center}
\end{table}
\vspace{-.15in}

Sometimes we do not want to have the longest portion of text first,
yet it is needed to define the tab.
Table~\ref{tbl:tabkill} illustrates how this is solved with the
\cmd{kill} command.  \index{\texttt{$\backslash$kill}}
In the first tabbing, the lines are in the order we want, but the tab
is set by the shorter string `1-3', making `4-6-8' extend past the tab.
The second tabbing puts the longer field first, in order to set the tab
correctly, then specifies \cmd{kill} instead of \verb|\\| to suppress
\index{\texttt{$\backslash$kill}}
(or ``kill'') the printing of the line.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%   Test the appearance of the tabs in the table with these
%  \begin{tabbing}
%     1-3  \= sting like a bee \\
%     4-6-8 \> don't be late
%  \end{tabbing}
%
%  \begin{tabbing}
%     4-6-8 \= don't be late \kill
%     1-3  \> sting like a bee \\
%     4-6-8 \> don't be late
%  \end{tabbing}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\vspace{-.1in}

\begin{table}[H]
\caption{ The \cmd{kill} Tabbing Command \label{tbl:tabkill} }
\begin{center}
\begin{tabular}{lp{.1in}l}
   What you see && What you write \\ \hline
   \begin{tabular}{l}
      1-3 sting like a bee \\
      4-6-8\hspace*{-6pt}don't be late
   \end{tabular}
&& \footnotesize \begin{tabular}{l}
   \verb|\begin{tabbing} | \\
   \verb| 1-3  \= sting like a bee \\ | \\
   \verb| 4-6-8 \> don't be late   \\ | \\
   \verb|\end{tabbing} |
                 \end{tabular}
\vspace{.1in} \\
   \begin{tabular}{l}
      1-3 ~~ sting like a bee \\
      4-6-8 don't be late
   \end{tabular}
&& \footnotesize \begin{tabular}{l}
   \verb|\begin{tabbing} | \\
   \verb| 4-6-8 \= don't be late    \kill | \\
   \verb| 1-3   \> sting like a bee \\ | \\
   \verb| 4-6-8 \> don't be late    \\ | \\
   \verb|\end{tabbing} |
                 \end{tabular}
\\ \hline
\end{tabular}
\end{center}
\end{table}
\vspace{-.1in}

Figures \ref{fig:tabbing-a} and \ref{fig:tabbing-b} illustrate the
tabbing environment with fixed field widths.
It first uses the \cmd{hspace*} command for horizontal spacing,
\index{\texttt{$\backslash$hspace*}}
then it uses the name of the last field to set what follows.
\medskip

\begin{figure}[H]
\begin{center}
{\footnotesize
\begin{boxedverbatim}
 \begin{tabbing}
   \= \hspace*{.5in} \= \hspace*{2in} \= Last field: \= \kill
   \> Field 1 (following tab 1)
   \\ \> \> Field 2 on new line \> Last field
   \\ \> \>                     \> Last field on new line
 \end{tabbing}
\end{boxedverbatim}
} % end footnotesize
\end{center}
\vspace{-.1in}
\caption{Tabbing Source (Result in Figure \ref{fig:tabbing-b})
         \label{fig:tabbing-a}}
\end{figure}
\vspace{-.4in}

\begin{figure}[H]
\begin{quote} \noindent \\
 \begin{tabbing}
   \= \hspace*{.5in} \= \hspace*{2in} \= Last field: \= \kill
   \> Field 1 (following tab 1)
   \\ \> \> Field 2 on new line \> Last field
   \\ \> \>                     \> Last field on new line
 \end{tabbing}
\end{quote}
\psset{unit=1in}
\psline(.2,.25)(5.2,.25)(5.2,1)(.2,1)(.2,.25)
\vspace{-.25in}
\caption{Tabbing Result (Source in Figure \ref{fig:tabbing-a})
         \label{fig:tabbing-b}}
\end{figure}


%\subsection{Line and Page Breaks}
\subsection{Line, Page, and Word Breaks}

You can cause a new line by entering \cmd{linebreak}.
\index{\texttt{$\backslash$linebreak}}
When text is justified (the default), this could result in an
undesirable appearance, like the following:
\medskip

        
\verb|\textsf{This example is \linebreak extreme.}|

\noindent\produces  \textsf{This example is \linebreak extreme.}
\medskip

\noindent
The \cmd{newline} command \index{\texttt{$\backslash$newline}}
forces a new line without justifying it.
\medskip

\verb|\textsf{Here is the extreme \newline example.}|

\noindent\produces  \textsf{Here is the extreme \newline example.}
\medskip

The \cmd{nolinebreak} command works analogously,
\index{\texttt{$\backslash$nolinebreak}}
preventing a line break, even if it means extending into the right margin.
Also, it is better style to keep certain `words' together,
such as `figure~1' or `p.~10'.
\label{term:usingtilde}
\index{spacing!\textasciitilde}
To prevent a line break where you want a blank, use the space character
\verb|~|. \index{special character}
We would thus write \verb|figure~1| or \verb|p.~10|.

There are two commands to force a page break:
\cmd{pagebreak} and \cmd{newpage}.
\index{\texttt{$\backslash$pagebreak}} \index{\texttt{$\backslash$newpage}}
\hspace*{-.8em} % made necessary by a quirk of latex
The \cmd{newpage} command follows
the analogy with \cmd{newline} in forcing a page break precisely at the
point it is specified, rather than completing the line as \cmd{pagebreak}
does.
The \cmd{nopagebreak} command disallows a page break immediately
\index{\texttt{$\backslash$nopagebreak}}
following the next blank line.
The \cmd{samepage} command \index{\texttt{$\backslash$samepage}}
prevents a page break within its scope.  Here is an example that keeps
line 1 on the same page as line 2.

{\small
\begin{verbatim}
  {\samepage
    line 1
   \nopagebreak

    line 2
  }
\end{verbatim}
} % end small

Word breaks are hyphenations \index{hyphenation} that \LaTeX\ does for you.
Sometimes, however, you want to suppress hyphenation.  This can be done by
specifying \verb@\usepackage{hyphenat}@ 
\index{\texttt{$\backslash$url}} \index{package!hyphenat}
in the preamble.  
(You might have to download the package from CTAN~\cite{CTAN}, and follow
the simple installation instructions.)  Then, to suppress hyphenation, you
specify the \cmd{nohyphens} command.  For example, the first sentence of 
this paragraph has a hyphen; to suppress it, enter:

{\small
\begin{verbatim}
  \nohyphens{Word breaks are hyphenations that \LaTeX\ does for you.  
            Sometimes, however, you want to suppress hyphenation.}
\end{verbatim}
}

\noindent
Then, you obtain the following:
\medskip

\nohyphens{Word breaks are hyphenations that \LaTeX\ does for you.
Sometimes, however, you want to suppress hyphenation.}


\subsection{Spacing}

We have already seen the use of \verb|~| to insert one space
\index{spacing!horizontal}
and \cmd{hfill} to put the remaining text flush right.
\index{\texttt{$\backslash$hfill}}
The most versatile method to insert horizontal spaces is with \cmd{hspace}
and \cmd{hspace*}.
\index{\texttt{$\backslash$hspace}} \index{\texttt{$\backslash$hspace*}}
These have one argument: the amount of space to be inserted.
For example,
\medskip

\verb|I insert .3~in \hspace{.3in} here.| $\Rightarrow$
I insert .3~in \hspace{.3in} here.
\medskip

\noindent
The \cmd{hspace} command has no effect at a line boundary, but the
\cmd{hspace*} \hspace*{1in} inserts the space no matter what.
For example, the previous sentence is written as:
\vspace{-.5\baselineskip}

{\small
\begin{verbatim}
 The \verb|\hspace| command has no effect at a line boundary, but
 the \verb|\hspace*| \hspace*{1in} inserts the space no matter what.
 \end{verbatim}
}
\vspace{-\baselineskip}

\noindent
That is why you see the 1 inch space at the beginning of the second line.
\cmd{hspace} would not insert the 1~inch, but \cmd{hspace*} does.

Two variations of \cmd{hfill} are:
\medskip

\verb|\dotfill| \dotfill

\verb|\hrulefill| \hrulefill

\index{\texttt{$\backslash$hfill}}
\index{\texttt{$\backslash$dotfill}} \index{\texttt{$\backslash$hrulefill}}
\medskip

Analogously, vertical spacing \index{spacing!vertical} is controlled by
\cmd{vspace}, \cmd{vspace*} and \cmd{vfill}.
\index{\texttt{$\backslash$vspace}} \index{\texttt{$\backslash$vspace*}}
\index{\texttt{$\backslash$vfill}}
The height of one line of normal text is in the keyword \cmd{baselineskip},
\index{\texttt{$\backslash$baselineskip}}
so \verb|vspace{\baselineskip}| skips one line at the next new line.
The vertical space is not added if this goes to the top of a new page;
that is what \cmd{vspace*} does.
In particular, at the very beginning of your document, if you want to
make your own title page, you use \verb|\vspace*{2in}| to put a 2~inch margin
at the top (\cmd{vspace} would not insert the space).

The easiest way to control line spacing throughout your document is to
specify \verb|usepackage{setspace}| in your preamble.
\index{\texttt{$\backslash$usepackage}}
\index{package!setspace}
This gives you three commands:
\medskip

\verb|   \singlespacing  \onehalfspacing  \doublespacing|
\medskip

\noindent
Right after you specify one of these, that spacing will commence.

\bigskip
\addcontentsline{toc}{subsection}{Exercises}
\noindent
{\large\textbf{Exercises.}} Submit a printed copy of both the \LaTeX\ source
       (tex file) and the associated postscript result (ps file).
       Be sure your name is on each.

\begin{enumerate}
   \item Write a paragraph in article [and letter] style with the following
         properties:
       \begin{enumerate}
          \item Each font style in Table \ref{tbl:fonts} is used as one
                letter in a word that has more than one letter.
          \item Each font style in Table \ref{tbl:fonts} is used for
                one complete word.
          \item Each font style in Table \ref{tbl:fonts} is used for
                two consecutive complete words.
       \end{enumerate}

   \item Write two paragraphs in article [and letter] style with each of
         the following properties:
       \begin{enumerate}
          \item Default indentation on both paragraphs.
          \item No paragraph is indented.
          \item Both paragraphs are indented.
          \item There is added space between paragraphs.
       \end{enumerate}

   \item Write a paragraph in article style and make a cover page with
         the following properties (like the cover page of this document):

        \begin{itemize}
           \item All lines are centered.
           \item The title appears first in very large letters.
           \item Your name appears second in letters that are not as large
                 as the title, but larger than normal size, and it is
                 preceded by extra space.
           \item Your e-mail address appears third.
           \item Your web address appears fourth.
           \item Course number and title appears next, with extra space
                 preceding it.
           \item Date appears last, with extra space preceding it.
        \end{itemize}

   \item Give an enumeration of at least three things you like about
         mathematics.  Give the same list without numbers.
      \label{exer:likeaboutmath}

   \item Produce the following table:
         \begin{center}
            \begin{tabular}{ll}
               \multicolumn{2}{c}{Colors} \\
                 Primary  & Secondary \\ \hline
                  Red     &  Green    \\
                  Blue    &  Orange   \\
                 Yellow   &  Purple   \\ \hline
            \end{tabular}
         \end{center}

   \item Produce the following table (including the accents and alignments).

     \begin{center}
     \begin{tabular}{l|cc}
         Mathematician         & Birth & Death \\ \hline
           Gabrielle Emilie
           Le Tonnelier \\
           ~~ de Breteuil Marquise \\
           ~~ du Ch\^{a}telet
                               & 1706  & 1749 \\
           Benjamin Banneker   & 1731  & 1806 \\
           Sophie Germain      & 1776  & 1831 \\
           Julius K\"{o}nig    & 1849  & 1913 \\
           R\'{o}zsa P\'{e}ter & 1905  & 1977 \\ \hline
     \end{tabular}
     \end{center}

   \item Produce the following table.

     \begin{center}
     \begin{tabular}{lp{.5in}l}
           \multicolumn{3}{c}{Payoffs (\$)} \\
                  Player A && Player B \\ \hline \\
          \begin{tabular}{|c|c|c|} \hline
             1 & 2 & 3 \\ \hline
             4 & 5 & 6 \\ \hline
          \end{tabular}
        &&
          \begin{tabular}{|c|c|} \hline
             1 & 2 \\ \hline
             3 & 4 \\ \hline
             5 & 6 \\ \hline
          \end{tabular}
     \end{tabular}
     \end{center}

  \item How can you have an entire table whose columns are of fixed width?

  \item \label{text:exer:parbox} Create a 3-column text such that each
      column is a paragraph of arbitrary length using about $\third$
      of the page width each.

  \item Use the tabbing environment to produce the following:
     \vspace{-.1in}

      \begin{tabbing}
         grapefruit \= variables \= derivatives \kill
         apples     \> integral  \> derivative  \\
         grapefruit \> sum       \> difference  \\
                    \> variables \> constants
      \end{tabbing}

  \item Use the tabbing environment to produce what you see on
      page~\pageref{term:tabbing}.

  \item Produce the following:

   \begin{center}
      \fbox{\parbox{1in}{\begin{flushleft}
         rate of mass accumulation in the compartment
               \end{flushleft} }}     
    = \fbox{\parbox{1.5in}{\begin{flushleft}
         net rate of mass entering the compartment by convection
               \end{flushleft} }}
    + \fbox{\parbox{1in}{\begin{flushleft}
          net rate of mass entering by diffusion.
               \end{flushleft} }}
   \end{center}

\end{enumerate}

\medskip % This shouldn't be needed, but it is.

\section{Bibliography with \Bibtex} \label{sec:Bibliography}

\subsection{Overview}

It might seem strange to have this section so early, instead of with 
\S\ref{subsec:Back_matter}.
That is because I require students to produce an annotated bibliography
early in the semester, and I want them to use \Bibtex.  So here we are.

\Bibtex~\cite{bibtex} was developed by Oren Ptashnik and is available
free of charge.
It reads a plain text file, called a \textit{bib file} \index{file!bib}
(plus one of the files created by the latex compiler, about which you need not
be concerned).
The bib file contains the \textit{bibliographic database}, which could
extend beyond one document.
The \indx{bibtex program} that you apply to your source creates another file
(which you need not examine),
from which a second latex compilation causes the bibliography to be created.
The execution looks like this (same under \indx{unix} and \indx{DOS}):

\cmdline{latex myfile \\ bibtex myfile \\ latex myfile}
\label{term:bibtex}

You might have to compile with latex more times, until you do not have any
``unresolved'' bibliography citations.  Once this is successful, you do not
have to \verb|bibtex myfile| again until you change your bib file or add a
citation.  This added loop is illustrated in Figure~\ref{fig:bibsequence}.

\begin{figure}[ht]
\vspace*{1.2in}

\begin{center}
\psset{unit=1in}
\rput(-2,0){\rnode{T}{\psframebox{\texttt{myfile.tex}}}}
\rput( 0,0){\rnode{D}{\psframebox{\texttt{myfile.dvi}}}}
\rput( 2,0){\rnode{P}{\psframebox{\texttt{myfile.ps }}}}
\psset{arrowsize=3pt 5}
\ncline{->}{T}{D} \ncline{->}{D}{P}
\psline{->}( 0,-.11)(0,-.35)(-2,-.35)(-2,-.11)
\rput(-2,.75){\ovalnode{e}{create/edit}}
\rput( 0,.75){\ovalnode{v}{view/print}}
\rput( 2,.75){\ovalnode{r}{print/post}}
\psset{arrowsize=2pt 3}
\ncline{<->}{T}{e} \ncline{->}{D}{v} \ncline{->}{P}{r}
\rput(-1,.4){\begin{tabular}{c} compile \\ with \\ \texttt{latex} \end{tabular}}
\rput( 1,.4){\begin{tabular}{c} convert \\ with \\ \texttt{dvips} \end{tabular}}
\rput(-1,-.55){\begin{tabular}{c} \texttt{bibtex} \end{tabular}}
\end{center}
\vspace{.4in}

\caption{Adding \texttt{bibtex} to the Command Sequence \label{fig:bibsequence}}
\end{figure}


\subsection{The bib File} \label{subsec:bibfile}

\subsubsection{Main body}

For purpose of this introduction, suppose your bibliography is in a
file called \texttt{mybiblio.bib}, but that name is arbitrary as long as it
ends with \texttt{.bib}.
We begin with the most important part of your bib file,
which are the entries you want to include in its database.
\index{file!bib}
Each entry has the following form:
\bigskip

\begin{tabular}{l}
  \verb|@|\textit{type }\verb|{|\textit{label}\verb|,| \\
  \verb|  |\textit{field}\verb| = "|\textit{value}\verb|",| \\
  \verb|    |\vdots \\
  \verb|}|
\end{tabular}
\bigskip

\noindent
For example, Knuth's book \cite{tex} would be entered as follows:

{
\begin{verbatim}
  @article{tex,
   author  = "Donald E. Knuth",
   title   = "The {\TeX} Book",
   publisher = "Addison-Wesley Publishing Company",
   address = "Reading, MA",
   year    = "1989",
   edition = "15th",
  }
\end{verbatim}
}

Most authors develop a style to labelling bibliographic entries.  
The use of one keyword is somewhat simplistic and could cause problems
with a great number of entries because the labels must be unique.
We cannot, for example, have two entries with \verb|tex| as their label.
Here are two styles I have seen, which you might consider:

\begin{center}
\begin{tabular}{ll}
   Form  & Example \\ \hline
   \textit{author}\verb%.%\textit{year} & \verb%knuth.89% \\
   \textit{author}\verb%:%\textit{first\_keyword\_in\_title} 
                                        & \verb%knuth:tex% \\ \hline
\end{tabular}
\end{center}

With two authors, you can put both of their names; with more than 2, you
can add et al.  
(Linguistically, the use of the Latin \textsf{et al.} in formal writing
follows this rule.)
In the first form, if there are two publications by the same authors in the
same year, some people add \verb|a|, \verb|b|, \dots after the year 
(no blank).  
In the second form, if there are two publications by the same authors in the
same year, some people add another keyword.  
You must discover what style works best for you.

Before listing each \textit{style} (\texttt{article} is one style) and the
\textit{fields} they can or must have (\texttt{author} is one field), here are
a few things to note.

\begin{itemize}
   \item The label is arbitrary, but do not use any \LaTeX\ special characters
\index{special character}
         or blanks.  In the example, the label is specified as
         \texttt{tex} and it must be followed by a comma.
         Also, labels are case-sensitive, so \texttt{tex} is not the same
         as \texttt{TeX}.
   \item Each bib entry must have a unique label, so it can be cited without
         ambiguity in the source file.

\pagebreak % this is to avoid printing a lot of new pages
   \item The order of the fields is arbitrary, and fields are separated by
         commas (hence the comma \textit{after} the terminal quote).
         The last field does not require a comma at the end, but it will
         not hurt anything, and it gives flexibility if you want to add a
         field or change the order.
   \item Fields do not have to be on separate lines, but it is more
         readable that way.
   \item The \textit{field value} can be anything recognized by \LaTeX, 
         even mathematical symbols in math mode.
   \item There is a final \verb|}| to close the entry ---
         \verb|@|\textit{type}\verb|{| \dots \verb|}|.
\end{itemize}

Remember to put each author's name as \textit{first last} or
\textit{last}, \textit{first}.  If you put \textsf{Knuth Donald}, the
compiler will think the first name is Knuth and the last name is Donald.

Here is a list of standard entry types with their required fields.
What are ``optional fields'' in \Bibtex\ are not necessarily optional as
far as having a complete bibliography citation.
For example, the volume and page numbers of an article are necessary
to include even though they are optional to satisfy \Bibtex\ syntax.
(What is ``necessary'' depends upon the standard one applies, but most
journals require the volume of the journal and the page numbers for the
cited article.)
Fields that are neither required nor optional are ignored,
even if they are valid fields in other types of entries.

\begin{flushleft} \label{term:tabbing}
\begin{tabbing}
     \hspace*{.1in} \= \hspace*{.25in}\=   Required fields: \=  \kill
  \> \texttt{article} refers to an article from a journal or magazine.
    \\ \> \> Required fields: \>
           \texttt{author},
           \texttt{title},
           \texttt{journal},
           \texttt{year}.
    \\ \> \> Optional fields: \>
           \texttt{volume},
           \texttt{number},
           \texttt{pages},
           \texttt{month}.
\\
  \> \texttt{book} refers to a book with an explicit publisher.
    \\ \> \> Required fields: \>
           \texttt{author} or \texttt{editor},
           \texttt{title},
           \texttt{publisher},
           \texttt{year}.
    \\ \> \> Optional fields: \>
           \texttt{volume} or \texttt{number},
           \texttt{series},
           \texttt{address},
           \texttt{edition},
           \texttt{month}.
\\
  \> \texttt{booklet} refers to a bound, printed document, but without an
           explicit
    \\ \> \> ~~ publisher.
    \\ \> \> Required fields: \>
           \texttt{author} or \texttt{key},
           \texttt{title}.
    \\ \> \> Optional fields: \>
           \texttt{author},
           \texttt{howpublished},
           \texttt{address},
           \texttt{month},
           \texttt{year}.
\\
  \> \texttt{inbook} is a part of a book, such as a chapter or just some
           range of pages.
    \\ \> \> Required fields: \>
           \texttt{author} or \texttt{editor},
           \texttt{title},
           \texttt{chapter} and/or \texttt{pages},
    \\ \> \> \>
           \texttt{publisher},
           \texttt{year}.
    \\ \> \> Optional fields: \>
           \texttt{volume} or \texttt{number},
           \texttt{series},
           \texttt{type},
           \texttt{address},
           \texttt{edition},
    \\ \> \> \>
           \texttt{month}.
\\
  \> \texttt{incollection} is a part of a book having its own title.
    \\ \> \> Required fields: \>
           \texttt{author},
           \texttt{title},
           \texttt{booktitle},
           \texttt{publisher},
           \texttt{year}.
    \\ \> \> Optional fields: \>
           \texttt{editor},
           \texttt{volume} or \texttt{number},
           \texttt{chapter}
           \texttt{series},
    \\ \> \> \>
           \texttt{type},
           \texttt{pages}.
           \texttt{address},
           \texttt{edition},
           \texttt{month}.
\\
   \> \texttt{inproceedings} is an article in a conference proceedings.
    \\ \> \> Required fields: \>
           \texttt{author},
           \texttt{title},
           \texttt{booktitle},
           \texttt{year}.
    \\ \> \> Optional fields: \>
           \texttt{editor},
           \texttt{volume} or \texttt{number},
           \texttt{series},
           \texttt{pages},
    \\ \> \> \>
           \texttt{month},
           \texttt{organization},
           \texttt{publisher},
           \texttt{address}.
\\
   \> \texttt{manual} is some technical documentation.
    \\ \> \> Required fields: \>
           \texttt{author} or \texttt{key} (see note below).
           \texttt{title}.
    \\ \> \> Optional fields: \>
           \texttt{author},
           \texttt{organization},
           \texttt{address},
           \texttt{edition},
    \\ \> \> \>
           \texttt{month},
           \texttt{year}.
\\
   \> \texttt{mastersthesis} is a Master's thesis.
    \\ \> \> Required fields: \>
           \texttt{author},
           \texttt{title},
           \texttt{school},
           \texttt{year}.
    \\ \> \> Optional fields: \>
           \texttt{type},
           \texttt{address},
           \texttt{month}.
\\
   \> \texttt{misc} is when nothing else fits.
    \\ \> \> Required fields: \>
           \texttt{author} or \texttt{key} (see note below).
    \\ \> \> Optional fields: \>
           \texttt{author},
           \texttt{title},
           \texttt{month},
           \texttt{howpublished},
           \texttt{year}.
\\
   \> \texttt{phdthesis} is a PhD thesis.
    \\ \> \> Required fields: \>
           \texttt{author},
           \texttt{title},
           \texttt{school},
           \texttt{year}.
    \\ \> \> Optional fields: \>
           \texttt{type},
           \texttt{address},
           \texttt{month}.
\\
   \> \texttt{proceedings}
    \\ \> \> Required fields: \>
           \texttt{title},
           \texttt{year}.
    \\ \> \> Optional fields: \>
           \texttt{editor},
           \texttt{volume} or {\tt number},
           \texttt{series},
           \texttt{publisher},
    \\ \> \> \>
           \texttt{organization},
           \texttt{address},
           \texttt{month}.
\\
   \> \texttt{techreport} is a report published by some institution.
    \\ \> \> Required fields: \>
           \texttt{author},
           \texttt{title},
           \texttt{institution},
           \texttt{year}.
    \\ \> \> Optional fields: \>
           \texttt{type},
           \texttt{number},
           \texttt{address},
           \texttt{month}.
\\
   \> \texttt{unpublished} is a document with an author and title, but not formally
    \\ \> ~~~ published, even as a technical report.
            (Some note of explanation is
    \\ \> ~~~ required.)
    \\ \> \> Required fields: \>
           \texttt{author},
           \texttt{title},
           \texttt{note}.
    \\ \> \> Optional fields: \>
           \texttt{month},
           \texttt{year}.
\end{tabbing}
\end{flushleft}
%\vspace{-.2in}

In addition to the optional fields listed, which vary by the type of
entry, the \texttt{note} field is always an option.
This lets you enter a note that will appear at the end of the citation.
To have a comment that is not printed, enter an unrecognized field,
such as \verb|comment = "...",| (this is ignored with no error message given).

If a required field is missing when you compile, you will get an error
message.
Possibly there will be some standard fixup, but it is best if you
provide the missing field value.
If a document has no author, you must provide a \texttt{key} for sorting.
For example, consider the following entry for \LaTeXe~\cite{usrguide},
which has no person as an author.
The bibliography will be sorted with the key, \verb|LaTeX2e|, used to
order this entry relative to author names.  The key will not be printed.

%\newpage  % This allows above last line to be on previous page
{\samepage
{\small
\begin{verbatim}
 @manual{usrguide,
   key = "LaTeX2e",
 title = "{\LaTeXe} for authors",
  type = "World Wide Web site",
  institution = "Comprehensive {\TeX} Archive",
  address = "{CTAN\url{/macros/latex/doc/usrguide.ps}
               (see~\cite{CTAN} for replacing CTAN)}",
  year = "1995--99",
 }
\end{verbatim}
} % end small
} % end samepage

%\noindent
%The bibliography will be sorted with the key, \verb|LaTeX2e|, used to
%order this entry relative to author names.  The key will not be printed.

When there are multiple authors, we separate them with \textsf{and}
(no commas).  For example, \cite{companion} in this document has the
following \Bibtex\ entry:

{\small
\begin{verbatim}
  @Book{companion,
   author    = "Michel Goosens and Frank Mittelbach and
                Alexander Samarin",
   title     = "The {\LaTeX} Companion",
   publisher = "Addison-Wesley Publishing Company",
   address   = "Reading, MA",
   year      = "1994",
  }
\end{verbatim}
} % end small

The use of the braces in \verb|{\LaTeX}| is to tell the bibtex program
to take everything inside just as it is written
(for the latex program to process).
Otherwise, the bibtex program might try to process it itself and produce
an unintended result.  This applies to accents too.
In ordinary \LaTeX, we write \verb|G\"{o}del| to produce G\"{o}del,
but this will not work in \Bibtex.  Instead, we write \verb|G{\"{o}}del|,
or simply \verb|G{\"o}del|.

The use of braces to force a particular result is necessary in other
instances, such as writing \verb|{F}ourier analysis| to force the capital F;
otherwise, the bibtex program will produce `fourier analysis'
(the plain style produces article titles in lower case, except the
first letter of the first word).
Some authors, however, use this feature inappropriately by putting braces
around everything.  That defeats one of the primary advantages of using
\LaTeX\ and \Bibtex\ in the first place: we want to let the style files
determine the final form, so we can switch styles and use the same source
(tex and bib files).
\index{file!tex}\index{file!bib}

\subsubsection{Web citations} \label{subsubsec:webcite}

When \Bibtex\ was developed, the World Wide Web did not exist.
Now it is a major source of information.  There is no universally accepted
standard for how to reference web documents, but here is one way.

If it is a book, use the \verb|book| type and specify:

{\small
\begin{quote}
   \verb|publisher = "World Wide Web",| \\
   \verb|address   = "|\textit{url }\verb|",|
\end{quote}
}

\noindent
Here is an example:

{\small
\begin{verbatim}
   @book{Strunk,
      author = "William Strunk{, Jr.}",
      title  = "Elements of Style",
      publisher = "World Wide Web",
      address   = "http://www.columbia.edu/acis/bartleby/strunk/",
      year      = "1999",
      note   = "This is the web version of the classic book by
                Strunk and White~\cite{StrunkWhite}",
   }
\end{verbatim}
} % end small

The reference \verb|\cite{StrunkWhite}| presumes there is the entry
for the original publication.  The use of the braces in the name is
to be sure that the author appears as intended: William Strunk, Jr.
Otherwise, without the braces, the comma would signal the bibtex program
that `Jr.' is the first name of the author, and it would appear as
`Jr. William Strunk'.

If the document is a technical report, use that style but include the
url as a note or in the address field.  Eventually, you will run into
some difficulty with writing urls.  
For one thing, the url could contain special characters;  
\index{special character!in url}
in particular, \verb|~| is in many urls, and writing it will produce a space, 
not the tilde.
Also, a url could become very long, and with latex having no place to break,
you will see a line with lots of spaces (for justification), followed by
the url.  An unsightly line with spaces could also appear after the url.
These difficulties are overcome by specifying:
\medskip

\noindent
{\small
\verb| address = "\url{http://www.columbia.edu/acis/bartleby/strunk/}",|
}
\smallskip

The \cmd{url} specification is not actually an intrinsic command in \LaTeX;
it is defined in a package.
Its main use is to determine where the url can be broken in order to put
it on two lines, if needed.  Another feature of the url package is that
\cmd{url} prints special characters, like \verb|~|.
To have the \cmd{url} command active in your document, put the
following declaration into your preamble: \verb|\usepackage{url}|.
\index{\texttt{$\backslash$url}}
\index{package!url}
The default font it uses is \verb|tt|, but you can change this to 
another font with the specification:
\smallskip

\noindent
{\small
\verb| \renewcommand\url{\begingroup\urlstyle{|\textit{font}\verb|}\Url}|
}
\smallskip

\noindent
For example, this book specifies the sans serif font:
\vspace{-.1in}

{\small
\begin{verbatim}
 \usepackage{url}
 \renewcommand\url{\begingroup\urlstyle{sf}\Url} 
\end{verbatim}
\vspace{-.1in}
}
There are occasions when we want to reference an entire web site.
One example is the \LaTeXe\ reference~\cite{latex2e}, given by:

{%\newpage % This allows last line above to be printed with previous page
{\small
\begin{verbatim}
  @misc{latex2e,
   author = "Johannes L. Braams and David P. Carlisle and
             Alan Jeffrey and Frank Mittelbach and Chris Rowley
             and Rainer Sch{\" o}pf",
   title  = "{\LaTeXe} and the {LaTeX}3 Project",
   howpublished = "World Wide Web,
                 \url{http://www.latex-project/org/latex3.html}",
   year   = "1994",
  }
\end{verbatim}
} % end small
} % end samepage


We have seen several packages so far, and
you shall learn more about packages in \S\ref{sec:Graphics}, where I
describe enhancements for having graphics in \LaTeX. 
However, this is the first use of \cmd{renewcommand}, 
\index{\texttt{$\backslash$renewcommand}}
about which I shall say more when I describe ways to customize your 
document in \S\ref{sec:Control}.


\subsubsection{Additional features}

One element of good style is to be consistent in your terms, including
abbreviations and names of publishers.  
One sometimes sees ``Kluwer,'' other times ``Kluwer Academic Publishers,'' 
and still other times ``Kluwer Pub.''
To help be consistent and to save some work in the long run when we
write many different documents and produce more bib files, we
can define \textit{strings} with the entry:
\index{file!bib} %!\texttt[string}}
\medskip

{\small \verb|@string{|\textit{name}\verb| = "|\textit{string}\verb|"}|}
\medskip

\noindent
Then, we can refer to the string anywhere in the value of a field by
excluding the quotes.  (That is why we needed the quotes before, when
we wrote \textit{literals}.)

For example, suppose we define:
\medskip

{\small \verb| @string{kluwer = "Kluwer Academic Publishers"}|}
\medskip

\noindent
Then, we can enter:
\medskip

{\small \verb| publisher = kluwer,|}
\medskip

\noindent
to produce the publisher value = ``Kluwer Academic Publishers.''
Besides consistency, an advantage is that if some name changes, we
merely change the one string value and recompile.

We can concatenate strings and/or literals with \verb|#|.
For example, suppose we  write

{\small
\begin{verbatim}
   @string( mom = "My Mother" )
   @string( dad = "My Father" )

   author = mom,
   title  = mom # dad,
   editor = dad,
\end{verbatim}
}
\noindent
Then, the three field values are equivalent to:

{\small
\begin{verbatim}
   author = "My Mother",
   title  = "My MotherMy Father",
   editor = "My Father",
\end{verbatim}
}

\noindent
Note the absence of a space between the string values in the title.
To ensure a space, use the space character, \verb|~|, as a literal:

{\small
\begin{verbatim}
   title  = mom # "~" # dad,\end{verbatim}
}

\noindent
The same title as the above is obtained by any of the following:

{\small
\begin{verbatim}
   title  = "My Mother " # dad,
   title  = mom # " My Father",
\end{verbatim}
}
\medskip

Another useful feature of \Bibtex\ is the \verb|crossref| field for
\indx{cross referencing}.  \index{file!bib} %!\texttt{crossref}}
For example, suppose we have the following entry (kluwer is a string;
the other values are literals):

{\small
\begin{verbatim}
   @Proceedings{Byrnes:FAA-89,
    editor   =  "J.S. Byrnes and Jennifer L. Byrnes",
    title    = "Recent Advances in {F}ourier Analysis and its
                Applications: Proceedings of the {NATO}
                {A}dvanced {S}tudy {I}nstitute",
    publisher = kluwer,
    year   = 1990,
   }
\end{verbatim}
}
%\medskip

\noindent
Then, we can have the following entry:

{\small
\begin{verbatim}
   @InProceedings{Artemiadis:FAA-89-311,
      crossref = "Byrnes:FAA-89",
      author   = "N.K. Art{\'e}miadis",
      title    = "Results on the Absolutely Convergent Series
                  of Functions and of Distributions",
      pages    = "311--316",
   }
\end{verbatim}
}

\noindent
If these were the only references, the result would appear as follows:
\medskip

{\small
\noindent
\begin{tabular}{ll}
   $[1]$ & N.K. Art\'{e}miadis. Results on the absolutely convergent
          series of functions \\
       & and of distributions. In Byrnes and Byrnes $[2]$, pages 311--316.
\vspace{.2in} \\
   $[2]$ & J.S. Byrnes and Jennifer L. Byrnes, editors.
          \textit{Recent Advances in Fourier} \\
       & \textit{Analysis and its Applications: Proceedings of the NATO
             Advanced Study} \\
       & \textit{Institute}.  Kluwer Academic Press, 1990.
\end{tabular}
} % end small
\medskip

\Bibtex\ also recognizes a \indx{preamble} in our bib files to enable us to
define some \LaTeX\ commands.  The general form is
\medskip

{\small \verb|@Preamble{| \textit{string} \verb|}| }
\medskip

\noindent
where \textit{string} is any concatenation of literals and strings.
Here is an example~\cite{bibtex} that is useful for guiding the sorting
of references in a special circumstance:

{\small
\begin{verbatim}
   @Preamble{ "\newcommand{\noopsort}[1]{}" }
\end{verbatim}
} % end small

The \cmd{newcommand} is something I shall describe more fully in
\S\ref{sec:Control}.  \index{\texttt{$\backslash$newcommand}}
For now, it is used to define a command, \cmd{noopsort}, requiring one
argument.
Command \cmd{noopsort} ignores the argument that it receives, producing
nothing (indicated by \verb|{}|).
Here is how this can be used.

Suppose there is a 2-volume work by the same authors, originally published
1971, but a second edition of volume 1 is printed in 1973.
The bib entries would have the years in the opposite order than we want
because sorting is first by the authors, which are the same, then
by year.  To force the first volume to sort before the second, we fool
the bibtex program with the following specifications:
\medskip

\begin{center}
\begin{tabular}{l|l}
     Volume 1                         & Volume 2 \\ \hline
\small\verb|year = "{\noopsort{a}}1973",|
                          & \small\verb|year = "{\noopsort{b}}1971",|
\\ \hline
\end{tabular}
\end{center}
\medskip

\noindent
This fools the bibtex program into thinking the years are
\verb|a1973| and \verb|b1971|, thus putting volume 1 first.
The definition of \cmd{noopsort}, however, does not actually print the
letters, so just the years appear.


\subsection{Declaration and Citation}

At the end of your source file (where you want the
bibliography to appear), before \verb|\end{document}|, put
the following commands (in either order):

\begin{verbatim}
   \bibliography{mybiblio}
   \bibliographystyle{plain}
\end{verbatim}
\index{\texttt{$\backslash$bibliographystyle}}
\index{\texttt{$\backslash$bibliography}}
The first declares the bibliography to be in the bib file, 
\texttt{mybiblio.bib}.
\index{file!bib}

The second command defines the format style of the bibliography to be
\texttt{plain}, which comes with every installation of latex.
\index{file!bst (bib style)}
There are other bibliography format styles, including some provided by
publishers.
Here is a list of the most basic ones (included in every installation):

\begin{verse}
   \texttt{plain} is the most common because it formats entries according to
             accepted standards.  Entries are sorted by the
             alphabetical order of author names, breaking ties with the
             year of publication, and they are labeled with numbers. \\
   \texttt{abbrv} differs from \texttt{plain} by abbreviating names of journals,
             among other things (to give a more compact bibliography). \\
\label{term:abbrv}
   \texttt{alpha} differs from \texttt{plain} by citing by labels, rather than
             numbers. \\
   \texttt{unsrt} differs from \texttt{plain} by sorting entries by the order
             in which they are cited, rather than by the author names.
\end{verse}
We shall use only the \texttt{plain} style here, but know that many other
styles have been written and are available free of charge.

To cite particular references, the \LaTeX\ command is
\verb|\cite{|\textit{label }[\verb|,|\dots]\verb|}|,
\index{\texttt{$\backslash$cite}}
where \textit{label} is what we put in our bib file entry.
For example, \cite{tex} is produced by specifying
\verb|\cite{tex}|.
You can put more than one citation, separated by commas.
For example, \verb|\cite{tex,latex}| produces \cite{tex,latex}
for this document.

You can insert some further citation information as an optional input
argument to the \cmd{cite} command.
For example, \verb|\cite[p.~46]{latex}| produces \cite[p.~46]{latex}
in this document.
(In the option, delimited by \verb|[ ]|, the \verb|~| is used to ensure
that there is a space but no line break when giving the page number as
``p.~46'' in the citation.)

The rule is that only those bib entries that are cited appear in the
final document.
The reason is that we can maintain one large bib file and write many
documents that use it.
There are times when we want to be sure a particular bib entry appears,
but we do not want to cite it in the text.
This is done with the \cmd{nocite} command.  \index{\texttt{$\backslash$nocite}}
In particular, if we want to have every entry in our bib file appear,
we specify \verb|\nocite{*}|.
If we want only some particular list of entries to appear, we use
\cmd{nocite} with their labels, such as \verb|\nocite{tex}| to be sure
Knuth's \TeX\ book appears, even if it is not cited explicitly.
Figure~\ref{fig:citeall} shows a complete source file for having all
entries in \texttt{mybiblio.bib} appear, and that is the entire document!

\begin{figure}[ht]
\medskip
\begin{center}
{\small
\begin{boxedverbatim}
 \documentclass[12pt]{article}
 \begin{document}
    \nocite{*}
 \bibliographystyle{plain}
 \bibliography{mybiblio}
 \end{document}
\end{boxedverbatim}
} % end small
\end{center}
\vspace{-.1in}
\caption{ A Document to Print the Bibliographic Database \label{fig:citeall}}
\end{figure}


We can specify more than one bib file, such as:
\vspace{.3\baselineskip}

\noindent
{\small \verb| \bibliography{mybiblio,another}|
\vspace{.3\baselineskip}

\noindent
The bibtex program will search them sequentially for any citation.  If
we have the same label in both bib files, the entries must be identical;
otherwise, we will get a fatal error message, \texttt{Repeated entry--}
telling us which label is repeated.
\index{message!Repeated entry}
If we have the same entry with different labels, they will appear twice if
both labels are used (or if we used \verb|\nocite{*}|).
\index{\texttt{$\backslash$nocite}}


\bigskip
\addcontentsline{toc}{subsection}{Exercises}
\noindent
{\large\textbf{Exercises.}} Submit a printed copy of the \LaTeX\ source
       (tex file), the \Bibtex\ data (bib file), and the associated postscript
       result (ps file).  Be sure your name is on each.

\begin{enumerate}
   \item Produce a document with one paragraph that cites three
         bibliographic items, one for each of the following types:
\vspace{-.3\baselineskip}

        \begin{enumerate}
           \item An article in a journal.
           \item An entire book with at least three authors.
           \item A chapter in a book.
           \item A technical report.

        \end{enumerate}
    \item Produce a document that lists your entire database, which
          consists of at least one entry for each of six different document
          types.  Further, at least one entry must have more than two authors.

   \item Produce a document with one paragraph that cites three
         bibliographic items, one for each of the following types:
        \begin{enumerate}
           \item A technical report on the web.
           \item A book on the web.
           \item An entire web site.
        \end{enumerate}

   \item Produce a document that has only a bibliography composed of the
         following three entries (in the order shown).

{\small
\noindent \hspace*{-.3in}
\begin{tabular}{ll}
   $[1]$ & I.M. Rich, editor. \textit{Impossible Dreams}, volume I.
          MacTaco, second edition, \\
       & 1999.
\vspace{.1in} \\
   $[2]$ & I.M. Rich, editor. \textit{Impossible Dreams}, volume II.
          MacTaco, 1990.
\vspace{.1in} \\
   $[3]$ & I.M. Smart, U.R. Tu, and V.F. Money. \textit{How to Square a Circle},
          chapter 1. \\
       & Volume II of Rich [2], 1990.
\end{tabular}
} % end small
\medskip

  \item Produce an annotated bibliography of the following form
        (note the indentations on left and right margins):

{\small
\noindent \hspace*{-.3in}
\begin{tabular}{ll}
   $[1]$ & %\parbox{5in}{
       P.R. Halmos, \textit{Naive Set Theory}, Van Nostrand, Princeton, NJ,
           1960.
    \\ & \parbox{4.75in}{\begin{quote}
         This is a good book, which I assign to my Ph.D. students.
         The first 100 pages seem simple.  The next 100 reveal lack of
         understanding the first 100.
    \end{quote}}
\vspace{.1in} \\
   $[2]$ & G. Polya, \textit{How To Solve It}, Princeton University Press,
          Princeton, NJ,
     \\  & 1945.
    \\ & \parbox{4.8in}{\begin{quote}
         This is a seminal book that articulates the problem-solving
         --- i.e., theorem-proving --- process.  There are many editions,
         and there are modern descendants, such as \dots
    \end{quote}}
\end{tabular}
} % end small
\medskip



\end{enumerate}


\section{Counters, Labels, and References}

\subsection{Basic Concepts}

A \textit{counter} is a numerical value that refers to something that is
being numbered, such as pages, sections, figures, and equations.
A \textit{label} is the identification of a particular value, and a
\textit{reference} is a citation to a label.
The \LaTeX\ syntax for labeling a counter is \verb|\label{|\textit{label}\verb|}|,
placed where the counter's value is set, where \textit{label} is unique
in the document.
\index{\texttt{$\backslash$label}}
The \LaTeX\ syntax for referencing a label is \verb|\ref{|\textit{label}\verb|}|.
\index{\texttt{$\backslash$ref}}
For example, in this book I defined:
\smallskip

{\small
\verb|\section{Bibliography with \Bibtex} \label{sec:Bibliography}|
} % end small
\smallskip

\noindent
Now I can refer to \S\ref{sec:Bibliography} by 
{\small\verb|\S\ref{sec:Bibliography}|}. 
The choice of label is arbitrary, except do not use \LaTeX\ special
characters or blanks, just as the labels in the bib file entries.

There are times when you just want to produce the counter value, without
a label.  This is done by \verb|\the|\textit{counter}.
\index{\texttt{$\backslash$the}\textit{counter}}
For example, \verb|\thepage| produces the page number.
On the other hand, if you want to use the counter's numerical value
as an argument in a command, specify \verb|\value{|\textit{counter}\verb|}|.

In the next section I describe intrinsic counters and illustrate how
to label and reference them.  Then, I shall introduce the figure and table
environments, which have intrinsic counters associated with them.


\subsection{Intrinsic Counters}

Anything to which \LaTeX\ assigns a number has a counter associated with it.
Here I illustrate some of those that are in all document styles.
Counters that depend upon the style, like a chapter in a book, can be
labelled and referenced in the same manner.

You are looking at page \thepage, which I was able to print by writing
\small\verb|\thepage|.  \index{\texttt{$\backslash$the}\textit{counter}}
Similarly, you are reading subsection \thesubsection\ of section \thesection,
whose numbers I could write by \verb|\thesubsection\| and \verb|\thesection|,
respectively.
%(The \verb|\| after \verb|\thesubsection| is to have a space.)

To illustrate how I can reference other parts of this document, the
following labels were defined (when the subsection and subsubsection
were first written):

{\small
\begin{verbatim}
  \subsection{The bib File}  \label{subsec:bibfile}
  \subsubsection{Web citations} \label{subsubsec:webcite}
\end{verbatim}
} % end small

\noindent
Then, I can refer to these as follows:

\begin{tabbing}
 \hspace{.3in}\=
   \verb|\S\ref{subsubsec:webcite}| \=$\Rightarrow$ \S\ref{subsubsec:webcite}
 \kill

\> \verb|\S\ref{subsec:bibfile}|    \>$\Rightarrow$ \S\ref{subsec:bibfile} \\
\> \verb|\S\ref{subsubsec:webcite}| \>$\Rightarrow$ \S\ref{subsubsec:webcite}
\end{tabbing}

\noindent
I can also refer to their page numbers:

\begin{tabbing}
 \hspace{.3in}\=
 \verb|p.~\pageref{subsubsec:webcite}|   \=$\Rightarrow$ \kill
\> \verb|p.~\pageref{subsubsec:webcite}| \>$\Rightarrow$  p.~\pageref{subsubsec:webcite} \\
\> \verb|p.~\pageref{subsec:bibfile}|    \>$\Rightarrow$  p.~\pageref{subsec:bibfile}
\end{tabbing}
\index{\texttt{$\backslash$pageref}} \index{\texttt{$\backslash$ref}}
For any counter, \verb|\pageref{|\textit{counter}\verb|}|, gives the
page number where its label is defined, just as
\verb|\ref{|\textit{counter}\verb|}| gives its value.
(Recall from p.~\pageref{term:usingtilde} that \verb|~| is used to
%\index{spacing!\textasciitilde}
have a space without a linebreak, which is an element of good style.)

Equation (\ref{eqn:hessian}), page \pageref{eqn:hessian}, was labelled
\verb|\label{eqn:hessian}|, so in this sentence I wrote its number
by \verb|\ref{eqn:hessian}| (with parenthesis added)
and its page number by \verb|\pageref{eqn:hessian}|.
In the exercise to list what you like about mathematics, I entered the label
\verb|\label{exer:likeaboutmath}| (page~\pageref{exer:likeaboutmath}),
which I can now reference as exercise \#\ref{exer:likeaboutmath}
by writing \verb|\#\ref{exer:likeaboutmath}|.

The choice of label, such as \verb|subsubsec:webcite|, is any string you
want to use that does not contain embedded blanks or special characters
used by \LaTeX.
In my choice of label, I used the structure \textit{prefix}:\textit{name}.
That is a matter of style, and I used the prefix \verb|subsec| here.
This helps me to distinguish labels for different things.  
For equations, I use the prefix \verb|eqn|.
Some people use this same form but with different prefixes, such as
\verb|ss| for subsection and \verb|e| for equation.  
You can choose any labeling convention that is meaningful to you.
(If you have a lot of labels and need to keep track of them by printing
each label and citation in your drafts, see the \textsf{showkeys} package
\index{package!showkeys}
at CTAN~\cite{CTAN}.)


\subsection{Figures and Tables} \label{subsec:figtbl}

In this section I describe figure and table environments, 
\index{environment!figure} \index{environment!table}
which have the same syntax: 
\medskip

\noindent
{\small
\begin{tabular}{lp{2pt}l}
   \verb|\begin{figure}|[\textit{options}] && \verb|\begin{table}|[\textit{options}]
\\
   \verb|[\caption{|\textit{caption}[\verb|\label{|\textit{label}\verb|}|]\verb|}]|
&&
   \verb|[\caption{|\textit{caption}[\verb|\label{|\textit{label}\verb|}|]\verb|}]|
\\ ~~ \vdots && ~~ \vdots \\
   \verb|[\caption{|\textit{caption}[\verb|\label{|\textit{label}\verb|}|]\verb|}]|
&&
   \verb|[\caption{|\textit{caption}[\verb|\label{|\textit{label}\verb|}|]\verb|}]|
\\
   \verb|\end{figure}|                  && \verb|\end{table}|
\end{tabular}
} % end small
\medskip

\noindent
The caption, if present, can go at the top or bottom;  where you put it is
where it will appear.
The label to reference a figure or table is put inside the caption.
(If you put it outside the caption, as given in \cite{latex}, 
it will not be understood, even though you will get no error message.) 

Because figures and tables are not split, their exact location depends
upon how much room there is.  For that reason they are called
``\indx{floating object}s,'' or \textit{floats}.  \index{float}
The environment \textit{options} define where the float is to be located.
The four choices are shown in Table~\ref{tbl:figtblloc}.
In this document most tables and figures are specified with \verb|[ht]|,
which means they are to be placed ``here,'' the place where it is specified
in the source, if possible.
If there is not enough room, it is to be located at the top of the
following page.
%\vspace{-.1in}

\begin{table}[ht]
\caption{ Figure and Table Location Options \label{tbl:figtblloc} }
\begin{center}
\begin{tabular}{cl}
 Option     & Meaning \\ \hline
  \verb|h|  & Locate here (where the environment is declared). \\
  \verb|t|  & Locate at the top of the next page. \\
  \verb|b|  & Locate at the bottom of the page (or the next page, \\
            & if this page does not have enough room). \\
  \verb|p|  & Locate on a separate page, called a \textit{\indx{float page}},\\
            & which has no text, only figures and tables.
\\ \hline \vspace{-.2in} \\
\end{tabular}
\end{center}
\end{table}
\index{environment!table} \index{environment!figure}
%\vspace{-.2in}

The placement of a float is sometimes a source of frustration.
We might specify \verb|[ht]| and find the float in an unexpected place,
perhaps on a page by itself.
One cause could be an accumulation of floats that should be cleared
at some point before continuing.
This is done with the \cmd{clearpage} command.
\index{\texttt{$\backslash$clearpage}}
This does the same as \cmd{newpage}, \index{\texttt{$\backslash$newpage}}
except that it also prints all remaining floating objects.
It is also advisable to specify \verb|\usepackage{float}| in the preamble.
\index{\texttt{$\backslash$usepackage}}
\index{package!float}
One of the enhancements is the placement option: \verb|[H]|, which
insists that the float be placed here (note the capital H and no other
option specified).
This option is used in many places in this book, which is why you 
sometimes see pages with some blank space in the lower portion, followed
by a figure or table.  
I did this to avoid confusion by having some float appear pages after
it is cited and discussed.

The table environment is not to be confused with the tabular environment.
The latter
\index{environment!table} \index{environment!tabular}
makes tables, but the table environment does not have to contain a table;
it differs from a figure only in its name, and they have separate counters.
The figures and tables in this document appear as the form:

{\samepage
\begin{center}
\framebox{
 Figure \textit{number}$\,$: \textit{caption} ~vs.~ Table  \textit{number}$\,$: \textit{caption}
}
\end{center}
\nopagebreak

\noindent
That's it.
} % end samepage

As a matter of style, we generally use the figure environment
to present what we usually think of as figures, notably pictures, and
we generally use the table environment to present information in tabular form.
\index{environment!figure} \index{environment!tabular}
However, neither of these conditions is necessary for their \LaTeX\
environments.

Floats can be framed, using the \cmd{fbox} command.
\index{\texttt{$\backslash$fbox}}
For example, Figures \ref{fig:fboxbottom-a} and \ref{fig:fboxbottom-b}
illustrate how to frame a figure with a thick border.

\begin{figure}[H]
\begin{center}
{\footnotesize
\begin{boxedverbatim}
 \begin{figure}[ht]
 \begin{center}
  \setlength{\fboxrule}{3pt}  % make border lines thick
  \setlength{\fboxsep}{.2in}  % increase distance to border
  \fbox{ This is a framed figure. }
 \end{center}
 \caption{Framed Figure with Caption at Bottom \label{fig:fboxbottom}} 
 \end{figure}
\end{boxedverbatim}
} % end footnotesize
\end{center}
\vspace{-.1in}
\caption{Framed Figure \ref{fig:fboxbottom-b} Source \label{fig:fboxbottom-a}}
\end{figure}

% -b

\begin{figure}[H]
\begin{center}
 \setlength{\fboxrule}{3pt}  % make border lines thick
 \setlength{\fboxsep}{.2in}  % increase distance to border
 \fbox{ This is a framed figure. }
\end{center}
\vspace{-.1in}
\caption{Framed Figure with Caption at Bottom \label{fig:fboxbottom-b}}
\end{figure}
\index{\texttt{$\backslash$setlength}}
\index{\texttt{$\backslash$fboxrule}} \index{\texttt{$\backslash$fboxsep}}

The parameter settings have returned to their default values, upon
leaving the figure environment.
(This is called a \textit{local setting}.)
\index{local setting}
Thus, the frame in Figure~\ref{fig:fboxtop} has thin lines and no extra
padding around the border. 
Also note how the caption is put at the top (see exercise \ref{exer:fboxtop}).


\begin{figure}[H]
\caption{Framed Figure with Caption at Top \label{fig:fboxtop}}
\begin{center}
  \fbox{This is framed with default parameter values.}
\end{center}
\end{figure}

%\clearpage
\subsection{Defining Your Own}

In the preamble you can define your own counter with the
\cmd{newcounter} command:  \index{\texttt{$\backslash$newcounter}}
\label{term:newcounter}
\vspace{-.1in}

{\small \verb|\newcounter{|\textit{name}\verb|}|[\textit{within}]
} \smallskip

\noindent
where \textit{name} is the (unique) name of the counter (cannot be the
same as one of the intrinsic counter names).
The initial value of the counter is 0.
For example, \verb|\newcounter{mycounter}| defines a counter whose name
is \verb|mycounter|.
You can also define the counter to be \textit{within} another counter.
For example,
\smallskip

{\small \verb|\newcounter{mycounter}[section]|
} \smallskip

\noindent
defines \verb|mycounter| to be within the section counter.
This will cause the value of \verb|mycounter| to be reset to 0
when entering a new section.
Further, instead of the printed values being 1, 2, \dots, they will
be 1.1, 1.2, \dots within section 1; more generally, the values
of \verb|mycounter| will be of the form $s$.1, $s$.2, \dots when
printed within section $s$.

The counter values are printed in Arabic numerals, but you can specify the
type of numeral, shown in Table~\ref{tbl:numerals}.
\vspace{-.1in}

\begin{table}[H]
\caption{ Numerals to Print Counters \label{tbl:numerals} }
\begin{center}
\begin{tabular}{ll}
    What you see & What you write \\ \hline
\setcounter{mycounter}{1}
   \alph{mycounter}, \addtocounter{mycounter}{1}
   \alph{mycounter}, \addtocounter{mycounter}{1}
   \alph{mycounter}, \addtocounter{mycounter}{1}
   \alph{mycounter}, \dots
 & \verb|\alph{mycounter}| \\
\setcounter{mycounter}{1}
   \Alph{mycounter}, \addtocounter{mycounter}{1}
   \Alph{mycounter}, \addtocounter{mycounter}{1}
   \Alph{mycounter}, \addtocounter{mycounter}{1}
   \Alph{mycounter}, \dots
 & \verb|\Alph{mycounter}| \\
\setcounter{mycounter}{1}
   \arabic{mycounter}, \addtocounter{mycounter}{1}
   \arabic{mycounter}, \addtocounter{mycounter}{1}
   \arabic{mycounter}, \addtocounter{mycounter}{1}
   \arabic{mycounter}, \dots
 & \verb|\arabic{mycounter}| \\
% \verb|! Undefined control sequence.| & \verb|\Arabic{mycounter}| \\
\setcounter{mycounter}{1}
   \roman{mycounter}, \addtocounter{mycounter}{1}
   \roman{mycounter}, \addtocounter{mycounter}{1}
   \roman{mycounter}, \addtocounter{mycounter}{1}
   \roman{mycounter}, \dots
 & \verb|\roman{mycounter}| \\
\setcounter{mycounter}{1}
   \Roman{mycounter}, \addtocounter{mycounter}{1}
   \Roman{mycounter}, \addtocounter{mycounter}{1}
   \Roman{mycounter}, \addtocounter{mycounter}{1}
   \Roman{mycounter}, \dots
 & \verb|\Roman{mycounter}| \\
\hline
\end{tabular}
\end{center}
\end{table}
\vspace{-.1in}

Counter values can be incremented with the \cmd{addtocounter} command.
\index{\texttt{$\backslash$addtocounter}}
For example, \verb|\addtocounter{mycounter}{1}| adds 1 to the value of
\verb|mycounter|.
If we just want to increment the counter by 1, we can specify
\verb|\stepcounter{mycounter}|.  \index{\texttt{$\backslash$stepcounter}}
Counter values can be set to some absolute value
with the \cmd{setcounter} command. \index{\texttt{$\backslash$setcounter}}
For example, \verb|\setcounter{mycounter}{5}| sets the value of
\verb|mycounter| to 5.
This can also be used to transfer the value of one counter to another.
For example,

{\small
\begin{verbatim}
  \setcounter{mycounter}{\value{page}}
\end{verbatim}
} % end small
\index{\texttt{$\backslash$value}}

\noindent
sets the value of \verb|mycounter| to the current page number
(value of the intrinsic counter, \verb|page|).

When using a counter for some non-intrinsic sequence, we want to be
able to label it for future reference.
This is done with the \cmd{refstepcounter} command, which also increments
its value.  \index{\texttt{$\backslash$refstepcounter}}
For example, to increment \verb|mycounter| by 1 and establish a label to
its value at the place this is done, write
%\vspace{-.1in}

{\small
\begin{verbatim}
  \refstepcounter{mycounter} \label{mylabel}
\end{verbatim}
} % end small

\noindent
Then, we can use \verb|\ref{mylabel}| and \verb|\pageref{mylabel}|
wherever we like.

The default numeral type is \verb|arabic|, but you can change the
appearance to be any of those listed in Table~\ref{tbl:numerals}
by applying the \cmd{renewcommand} to \cmd{the}\textit{counter}.
\index{\texttt{$\backslash$renewcommand}}
\index{\texttt{$\backslash$the}\textit{counter}}
For example,

{\samepage
  {\small
    \begin{verbatim}
  \setcounter{mycounter}{0}
  \renewcommand{\themycounter}{\roman{mycounter}}
  \stepcounter{mycounter} (\themycounter),
  \stepcounter{mycounter} (\themycounter), \dots
    \end{verbatim}
  }
\nopagebreak \vspace{-.2in}

\noindent $\Rightarrow$
  \setcounter{mycounter}{0}
  \renewcommand{\themycounter}{\roman{mycounter}}
  \stepcounter{mycounter} (\themycounter),
  \stepcounter{mycounter} (\themycounter), \dots
} % end samepage
\bigskip

This can be used for intrinsic counters too.
For example, consider the enumerate list environment, where the types
of numerals for the four levels are:
\verb|arabic|, \verb|alph|, \verb|roman| and \verb|Alph|.
We can change these to be any type we want, such as illustrated in 
Figures \ref{fig:count:enum-a} and \ref{fig:count:enum-b}.
\index{\texttt{$\backslash$theenumi}} 
\label{term:enumi}


\begin{figure}[ht]
\begin{center}
{\footnotesize
\begin{boxedverbatim}
 \renewcommand{\theenumi}{\Roman{enumi}}
 \renewcommand{\theenumii}{\Alph{enumii}}  % changes numeral type
 \renewcommand{\labelenumii}{\theenumii.}  % changes appearance
 \begin{enumerate}
   \item Introduction
   \item Terms and Concepts
       \begin{enumerate}
          \item Groups and fields
          \item Picnics and frolic
       \end{enumerate}
 \end{enumerate}
\end{boxedverbatim}
} % end footnotesize
\end{center}
\vspace{-.2in}
\caption{Alternative \textsf{enumerate} Symbols Source 
        (Result in Figure \ref{fig:count:enum-b}) \label{fig:count:enum-a}}
\end{figure}

% -b
\begin{figure}[ht]
\begin{quote} \noindent \\
 \renewcommand{\theenumi}{\Roman{enumi}}
 \renewcommand{\theenumii}{\Alph{enumii}}  % changes numeral type
 \renewcommand{\labelenumii}{\theenumii.}  % changes appearance
 \begin{enumerate}
   \item Introduction
   \item Terms and Concepts
       \begin{enumerate}
          \item Groups and fields
          \item Picnics and frolic
       \end{enumerate}
 \end{enumerate}
\end{quote}
\psset{unit=1in}
\psline(.2,.2)(5.2,.2)(5.2,1.4)(.2,1.4)(.2,.2)
\vspace{-.2in}
\caption{Alternative \textsf{enumerate} Symbols Result
     (Source in Figure \ref{fig:count:enum-a}) \label{fig:count:enum-b}}
\end{figure}

The second level, whose counter is \verb|enumii|, had its \textit{label}
changed to what is specified in the source: 
\verb|\renewcommand{\labelenumii}{\theenumii.}|
(the ``appearance'' parameter is \verb|\labelenumii|).
These changes remain in effect (called a \textit{global setting}), 
\index{global setting}
so we must change them back if we want to restore the defaults, shown in 
Table~\ref{tbl:enumforms}.

  \renewcommand{\theenumi}{\arabic{enumi}}
  \renewcommand{\theenumii}{\alph{enumii}}
  \renewcommand{\labelenumii}{(\theenumii)}


\begin{table}[H]
\caption{Default Settings for \textsf{enumerate} Counters 
        \label{tbl:enumforms} }
\begin{center}
\begin{tabular}{lll} \hline
         & What    & \\
 Counter & changes & Command \\ \hline
 \small\verb@enumi@
         & numeral & \small\verb@\renewcommand{\theenumi}{\arabic{enumi}}@ \\
         & label   & \small\verb@\renewcommand{\labelenumi}{(\theenumi)}@ \\
 \small\verb@enumii@
         & numeral & \small\verb@\renewcommand{\theenumii}{\alph{enumii}}@ \\
         & label   & \small\verb@\renewcommand{\labelenumii}{(\theenumii)}@ \\
 \small\verb@enumiii@
         & numeral & \small\verb@\renewcommand{\theenumiii}{\roman{enumiii}}@ \\
         & label   & \small\verb@\renewcommand{\labelenumiii}{(\theenumiii)}@ \\
 \small\verb@enumiv@
         & numeral & \small\verb@\renewcommand{\theenumiv}{\Alph{enumiv}}@ \\
         & label   & \small\verb@\renewcommand{\labelenumiv}{(\theenumiv)}@ \\
\hline
\end{tabular}
\end{center}
\end{table}
%\vspace{-.1in}

%\bigskip
\addcontentsline{toc}{subsection}{Exercises}
\noindent
{\large\textbf{Exercises.}} Submit a printed copy of the \LaTeX\ source
       (tex file) and printed copy of the associated postscript result
       (ps file).   Be sure your name is on each.

\begin{enumerate}

   \item Write a document with at least two pages and two sections.
         Put an enumerated list of items near the beginning of your
         document, and use the \cmd{ref} or \cmd{pageref} command to
         reference each of the following.

       \begin{enumerate}
         \item Reference \S 2 by a label that you assign to se