\chapter{Sectioning}

\LaTeX provides a great deal of flexibility in creating and naming
sections; for instance, we used ``\verb|\chapter{Sectioning}|''
command to create this section. After the main chapters of your
thesis have been included, you can use the command 
\verb|\appendix| to indicate that all subsequent chapters should 
be called appendices.  For example,

\begin{verbatim}
\chapter{A chapter}
Chapter contents...
\appendix
\chapter{An Appendix}
Appendix Contents...
\end{verbatim}

\noindent will ensure that the chapter titled ``An Appendix''
will be referred to as Appendix~A in the document.  See
Appendix~\ref{chap:websites}, for example.

We can also create many other types of sections, as seen here:

\section{A Sample Section}
\label{sec:ONE}

Sectioning is an important organization tool in your thesis.
In \LaTeX\ and \TeX\ (with ``eplain'') there is built-in support for
sectioning along with appropriate section numbering. 

For example, this section was introduced with 
\verb|\section{A Sample Section}|.

\subsection{A sample SUBSECTION}
\label{sec:TWO}
Subsection text, which was introduced with 
\verb|\subsection{A sample SUBSECTION}|.
\subsubsection{And a SUBSUBSECTION}
\label{sec:THREE}
Note that in the Acadia thesis style, there is no number for a
sub-sub-section.  This is the text of the sub-sub-section, which was
introduced with the somewhat longer command
\verb|\subsubsection{And a SUBSUBSECTION}|.
\paragraph{PARAGRAPH 1}
\label{sec:FOUR}
We can also create paragraphs with paragraph titles.  This was
introduced with \verb|\paragraph{PARAGRAPH 1}|.
\subparagraph{SUBPARAGRAPH Label}
And we can even do a sub-paragraph, which was introduced with
\verb|\subparagraph{SUBPARAGRAPH Label}|. 
\label{sec:FIVE}
Yet more subparagraph text.

\section{Custom ``Environments''}
\label{sec:CUSTOMSEC}
You can also create so-called ``environments'' which are treated
specially by \LaTeX.  Later in this document you can find information
about (for example) figures and tables.  These environments are
typeset specially, are numbered, and can be referenced from other
parts of the document.

This section has a demonstration of how you can set up a
``definition'' environment.  Mathematicians (or others, for that
matter) might want to create a lemma environment, a corollary
environment, and so on.  The idea explained here can be used in a wide
variety of ways.

For example, two definitions of baked goods (specifically, cookies)
follow.  In order to number these definitions (just as figures and
tables are numbered) and to be able to reference the definitions from
other places in your thesis, you can define a ``definition''
environment.

To create the custom ``definition'' environment we included the 
following code in the \verb|header.tex| file:
\begin{verbatim}
        \theoremstyle{definition}
        \newtheorem{definition}{Definition}[chapter]
\end{verbatim}
\noindent
The command \verb|\newtheorem{definition}{Definition}[chapter]|
creates an environment called \verb|definition| which
uses the text \verb|Definition| to introduce a definition, where the
definition numbers are reset every chapter, and the formatting is
derived from the ``theorem'' environment (which is itself defined by the
\verb|amsthm| package).

The command \verb|\theoremstyle{definition}| is used to indicate that
the following \verb|\newtheorem| command will use the ``definition'' style.
(To find more about these things read the \verb|amsthm|
documentation.)  Note that if you are creating (say) a corollary
environment, you might add the following two lines to \verb|header.tex|:
\begin{verbatim}
        \theoremstyle{definition}
        \newtheorem{corollary}{Corollary}[chapter]
\end{verbatim}
In particular, note that the \verb|\theoremstyle| is still ``definition''.


Having set that up once in \verb|header.tex|, we can now create
definitions as shown below.
Notice that the first one includes
the command \verb|\label{def:COOKIE}| so that the second definition
(or other parts of your document) can refer to it by using
\verb|\ref{def:COOKIE}|.  This is \emph{much} better than explicitly
using ``4.1'' in your text; if you revise your document later and add
a new definition before this one, \LaTeX\ will automagically renumber
not only your definitions, but also the references to the definitions.
The careful reader will also notice that instead of carelessly writing
the obvious ``\verb|(Definition \ref{def:COOKIE})|'' we instead took
the extra tiny amount of time to write
``\verb|(Definition~\ref{def:COOKIE})|''.  The ``\verb|~|'' is a
\emph{non-breakable} space; this means that the word ``Definition''
won't appear at the end of one line, leaving ``\ref{def:COOKIE}'' all
by itself at the beginning of the next line.

Our first usage:
\begin{verbatim}
\begin{definition}
    \label{def:COOKIE}
        A \emph{cookie} is a round baked good that is tasty,
        sugary, and usually bad for you. See~\citep{COOKIE}.
\end{definition}
\end{verbatim}

\noindent creates the example:

% Note: Having the changemargin environment here confuses pdftex
% and it can't find the reference for ``4.1'' in the PDF file.
% In the log it whines
%    pdfTeX warning (dest): name {definition.4.1} has been referenced
%    but does not exist, replaced by a fixed one
% JD does not find it aesthetically pleasing anyway, so out it goes.
\begin{definition}
    \label{def:COOKIE}
%    \begin{changemargin}{1cm}{0cm}
	A \emph{cookie} is a round baked good that is tasty,
	sugary, and usually bad for you. See~\citep{COOKIE}.
%    \end{changemargin}
\end{definition}

\need 2 in

The code:
\begin{verbatim}
\begin{definition}
    \label{def:PBCOOKIE}
        A \emph{peanut butter cookie} is a \emph{cookie}
        (Definition~\ref{def:COOKIE}) which contains, at a minimum,
        the ingredients peanut butter, flour, sugar and eggs.  Peanut
        Butter cookies are said to be \emph{delicious}.
\end{definition}
\end{verbatim}

\noindent creates:
\begin{definition}
    \label{def:PBCOOKIE}
        A \emph{peanut butter cookie} is a \emph{cookie}
        (Definition~\ref{def:COOKIE}) which contains, at a minimum,
        the ingredients peanut butter, flour, sugar and eggs.  Peanut
        Butter cookies are said to be \emph{delicious}.
\end{definition}

% Sorry Brian... this breaks things.
%To adjust the margins of the definition text, we changed the
%indenting within the definition using the custom commands in
%\verb|header.tex|:
%
%\begin{verbatim}
%    \begin{changemargin}{LEFTMARGIN}{RIGHTMARGIN}		
%         Text to be indented goes here...
%    \end{changemargin}
%\end{verbatim}
%
%\noindent Note that the argument \verb|LEFTMARGIN| was set to 
%\verb|1cm| and \verb|RIGHTMARGIN| was set to \verb|0cm| in the 
%above examples.


\need 2 in

\section{Cross-Referencing Sections}
\label{sec:CROSS_REF}

The keen observer will have noticed that we used a cross-reference
when defining what a Peanut Butter cookie was: ``A 
\emph{peanut butter cookie} is a \emph{cookie} 
(Definition~\ref{def:COOKIE})\dots'' this feature is extremely useful
since it allows us to refer to other sections of the document
using section numbering.

Let's say we want to reference our section on sections.
We have defined the section using the command:

\begin{verbatim}
\section{SECTION}
\label{sec:ONE}
\end{verbatim}

\noindent which creates a ``section'' called ``SECTION'' and
associates a label ``\verb|sec:ONE|'' with this section.  Now I can
reference this label from elsewhere in the document.  For example, the
input

\begin{center}
\begin{verbatim}
As shown in Section~\ref{sec:ONE}, we can create different\dots
\end{verbatim}
\end{center}

\noindent would produce:

\begin{center}
As shown in Section~\ref{sec:ONE}, we can create different\dots
\end{center}

\noindent in the document.

Finally, the numbering of a cross-reference reflects the numbering
of the actual label in the document.  Therefore, if the document's
number is updated, the cross-reference will also be updated to
suit.  This is \emph{much} easier than trying to maintain
cross-referencing manually.
