\chapter{Getting Started}

The basic idea of \LaTeX\ (and ``plain'' \TeX) is that you create one
or more \emph{plain text} ``source files'' using any text editor (but
not word processor!\null) of your choice, and then ``compile'' your
source files into a nicely-formatted document (normally a PDF file).
This work flow separates the writing of your ideas from the formatting
and style details, allowing you to concentrate on what you want to
say, without simultaneously worrying about getting the look ``just
so''.  In particular, this thesis template allows you to create a
document meeting Acadia's thesis formatting requirements without
having to worry about all the details of the front pages, page
numbering, lists of figures and tables, and so on\dots\ it just
happens automatically for you.  But, if some time later you wish to
publish your writing elsewhere (e.g., a journal or conference), you
can change the few lines which specify the formatting, select the
parts of your work you want to publish, and re-compile.

To use \LaTeX\ (or plain \TeX) to produce your thesis (or other
documents or presentations) you need to have a \TeX\ ``distribution''
installed on your computer, or you need to have a so-called ``live
\TeX\ DVD''.  The former is preferable to the latter, unless you are
extremely short of disk space.

As mentioned in the abstract, and given the existence of this thesis
template, the quickest way to get going with the \TeX\ system is to
use the \LaTeX\ package.  \LaTeX\ can be used to create so-called
``\verb|.dvi|'' files, from which you can subsequently create
PostScript or Adobe PDF files.  However, \LaTeX\ can also directly
create PDF files, and this route is strongly recommended for the most
users.  (There are two reasons for this recommendation.  First, since
the library wants a PDF file, there are less steps involved if you
just create a PDF file from the get-go.  Second, it is easier to
include \emph{most} graphics made with other programs (photographs,
plots, \dots) using the ``flavour'' of \LaTeX\ which creates PDF
files.)

You can download (for free!\null) a \TeX\ distribution from
\url{http://www.tug.org/texlive/} for many different systems.
However, if your operating system supplier provides an up-to-date
\TeX\ distribution, you may (or may not!\null) find it easier to just
use that.  The way you use \LaTeX\ varies a bit, depending on which
operating system you use on your computer, as well as which
\TeX\ system you installed on your computer.  The next three
subsections give some operating system-specific details.

You can use an ordinary text editor to create or edit your ``source
files'', but there are some editors which are specifically designed
for creating \TeX\ or \LaTeX\ documents.  (In fact, these ``editors''
tend to be more than plain editors; a computer scientist might call
them integrated development environments (IDEs)).  Three such editors,
all available for free, are
\begin{itemize} \itemsep0pt
\item \TeX{}studio, available at
\url{http://texstudio.sourceforge.net/},
\item Texmaker,
available at \url{http://www.xm1math.net/texmaker/}, and
\item \TeX{}works, available at \url{http://www.tug.org/texworks/}.
\end{itemize}
A comparison of these (and others) can be found at
\url{http://en.wikipedia.org/wiki/Comparison_of_TeX_editors}.

\section{Using Linux}

% If, when you read this, there is once again an Acadia Linux template, it
% might come with \TeX\ and \LaTeX\ installed.  If you use some other
% distribution of Linux, you should be able to download and install one
% or more packages to get it running on your system.

Regardless of which Linux distribution you use, you should be able to
download and install one or more packages to get \TeX\ and
\LaTeX\ running on your system (if the \TeX\ system is not already
installed).  Look through the list of packages available for download
and installation for your distribution.  For example, in Ubuntu-type
systems you can use your GUI package manager to install the \verb|tex|
package, or from the command line you can type
``\verb|sudo apt-get install tex|''.  This is a big download; make
sure your network connection is good and you have more than a minute
or two for the download to complete.

If you are unable to find anything specific for your Linux
distribution, the \TeX\ Live distribution is quite easy to install and
should work on virtually any Linux distribution.  The installation
instructions are found at the web site given above.

\TeX{}live for Linux does not provide (what a computer scientists
might call) an integrated development environment (IDE), but some
people like the combination of \verb|emacs| and \verb|auctex|.
Alternatively, you might like to try out one of the free \TeX\ editors
mentioned above.  However, the command-line usage of \LaTeX\ is very
straightforward, so you might decide that you don't need to spend time
trying to find a suitable IDE.

To compile any \LaTeX\ document from the command line, you can either
use the program \verb|latex|, which produces ``\verb|.dvi|'' files, or
you can use \verb|pdflatex|, which produces ``\verb|.pdf|'' files.
All things being equal, the latter is probably the best choice.  Of
course, most people (as well as the library) will be able to use a PDF
file, but if you produce a \verb|.dvi| file, you will need to use a
post-processor to create a PDF or PostScript file.  The \verb|.dvi|
approach is probably only of interest to you if you want to use the
power of the PostScript language to do tricky things.

Having created one or more \LaTeX\ source files using your favourite
text editor, the next step is to ``compile'' your document into a
PDF file.  This can be done with the following steps.  First,
assuming that your document is in a file called \verb|thesis.tex| (or
that \verb|thesis.tex| includes all of the files comprising your
document), run

\verb|pdflatex thesis.tex|

\noindent
Note that under Linux you do not need to type the ``\verb|.tex|'',
\verb|pdflatex| will add that for free.  Assuming you are using
\verb|bibtex| to process your citations, next run

\verb|bibtex thesis|

\noindent
Finally, to ensure that all of the references in your document are
correct, re-run \verb|pdflatex| twice (yes, twice):

\verb|pdflatex thesis|

\noindent
You can, of course, type all these on one line, as follows:

\verb|pdflatex thesis && bibtex thesis && pdflatex thesis && pdflatex thesis|

\noindent
If for some reason you want to go the \verb|.dvi| route, use
\verb|latex| instead of \verb|pdflatex| in the examples above.
Then, you can create a PostScript file by running

\verb|dvips thesis.dvi -o thesis.ps|

\noindent
and if you want to create a PDF file from that you can run the
command

\verb|ps2pdf thesis.ps|

\noindent
Alternatively, a PDF file can be created directly from the \verb|.dvi|
file with the command

\verb|dvipdfm thesis.dvi|

\smallskip
There is a ``\verb|Makefile|'' in the thesis template directory with
the other files.  You can just type \verb|make| to create a new PDF
version of your thesis whenever you have made some changes.  The
Makefile is a bit heavy-handed, since it runs \verb|pdflatex| three
times and \verb|bibtex| once, even if one run of \verb|pdflatex| would
suffice.  Ho hum.

\section{Using MS Windows}

\subsection{IDE}
A (MS Windows-only) IDE which many people use to write \LaTeX\ is
called TeXnic Center; at time of writing it can be found at:
\url{http://www.texniccenter.org/}.

You can use any text editor to edit \verb|.tex| files, but TeXnic Center
provides useful extras.
Another alternative, \verb|Texmaker|, which is also available for
Linux and OS X, can be found at \url{http://www.xm1math.net/texmaker/}.

\subsection{Support in MS-Windows}

TeXnic Center relies on MiKTex to perform the actual compiling
into DVI, PS, PDF, etc.  MiKTex can be found at
\url{http://www.miktex.org/}.
You'll need to install MiKTex \emph{before} installing TeXnic Center.

\subsection{Command Line Support}

You may choose to type commands in to a command window, rather than
using the pointy-clicky features of TeXnic Center or \verb|Texmaker|.
The next subsection describes how to do that.  But if you like the
pointy-clicky method, you can skip the rest of this subsection.

\subsubsection{Option 1: \emph{pdflatex}}

To compile a \verb|.tex| document that uses citations in \verb|bibtex|
format (see Section~\ref{sec:CITATIONS}) we must compile the document
in a specific order.  For example, using the \verb|thesis.tex| file in
used to produce this document:

First run:

\verb|pdflatex -interaction=nonstopmode thesis.tex|

\noindent which will compile the document, tabulate any
citations and cross-references and include images.

Next run: 

\verb|bibtex.exe thesis|

\noindent which extracts bibliographic data from 
\verb|./bibliograph/thesisbib.bib| and combines it with
the \verb|thesis.aux| file produced in the first step.

Then run:

\verb|pdflatex -interaction=nonstopmode thesis.tex|

\noindent again. This step combines the bibliographic data
from the first step with the document and tabulates the 
bibliography of the document.  At this point, everything
is done \emph{except} the numbering of the items in the
bibliography.  To fix this run the previous step again, and
you will be left with a PDF containing a cross-referenced
thesis.

\subsubsection{Option 2: \emph{texify} then \emph{dvipdfm}}

You have options other than option~1.  However, getting a 
PDF document out of the process can be more difficult. 

For example, the \verb|texify| command, runs all of the previous
commands in one call, automatically tabulating everything.  The
downside is that a \verb|.dvi| (``\textbf{D}e \textbf{V}ice
\textbf{I}ndependent'') file is produced instead of a PDF\null.  You then
must convert the \verb|.dvi| to a PDF if you desire.  First, run

\verb|texify thesis.tex|
\\
which produces the \verb|dvi| file.  Then run:

\verb|dvipdfm thesis|
\\
to convert to PDF\null. Unfortunately, this process
does NOT preserve hyper-linking in the document, so you 
must use Option~3 if you wish to have this feature (which you
really should!).

\subsubsection{Option 3: Using \emph{texify} then \emph{GhostView}}

If you'd like to take advantage of \verb|texify| and its compile-one
interface, you may be disappointed that \verb|dvipdfm| doesn't
preserve your hyper-linking.  However, (on MS Windows) you can use
another program that will preserve hyper-linking: GhostView.
To start, go out and download GhostScript from:

\verb|http://www.cs.wisc.edu/~ghost/|
\\
Now use \verb|texify| to compile your document.  Then take your
\verb|.dvi| file and convert it into a PS (PostScript) file using:

\verb|dvips thesis.dvi|
\\
which will produce a \verb|thesis.ps| file. 
Now convert the PS file into a PDF using the 
command-line interface of GhostScript. 
Assuming GhostScript is installed at:

\verb|C:\Program Files\gs\gs8.54\bin\gswin32.exe|
\\
run (all on one line) the following
\begin{verbatim}
   C:\Program Files\gs\gs8.54\bin\gswin32.exe -dBATCH -dNOPAUSE
       -q -sDEVICE=pdfwrite -sOutputFile=thesis.pdf thesis.ps
\end{verbatim}
to produce a beautiful document with cross-referencing,
hyper-linking and so on.

HINT: You can also automate this process in TeXnicCenter by defining
your own ``output profile''.  The \verb|texify| command becomes your
primary command and then tack the DVI-to-PS and PS-to-PDF conversions
as post-processors (in that order).

\section{Using Macs}

Aside from \TeX\ Live, there is a Mac-only system called
\verb|TeXShop| which can be obtained from
\url{http://www.uoregon.edu/~koch/texshop/}.  If you use
\verb|TeXShop| and want
to expand this section for the benefit of other Mac users, please
e-mail \href{mailto:jim.diamond@acadiau.ca}{Jim Diamond} to discuss
getting your contribution into this document.


\section{Tutorials, etc.}
Finally, there are \emph{a lot} of tutorials on the web explaining how
to write in \LaTeX/\TeX.
% This was defunct as of Nov 2013 (and maybe before).
% I use pages designed for another
% \TeX/\LaTeX\ environment 
% (TeTeX) at:
% \begin{center}	
%     \url{http://www.eng.cam.ac.uk/help/tpl/textprocessing/teTeX/latex/latex2e-html}
% \end{center}
% to provide me with help on commands and environments, and to act as a
% ``starting point''.
Try searching for \verb|latex tutorial| using your favourite internet
search engine and take a look at the first few results.  These sites move
around, making it difficult to keep a list of them up to date (so we
are going to make you look for yourself).

There is a USENET newsgroup called \verb|comp.text.tex| inhabited by
\TeX\ and \LaTeX\ wizards (as well as mere mortals).  You can get help
there for tough questions, but before submitting questions to that
newsgroup you should search the newsgroup archives first, since it is
unlikely you are the first problem to have any given \TeX- or
\LaTeX-related problem.

At the web site \url{http://tex.stackexchange.com/} you can find
answers to many common (and uncommon) \TeX\ and \LaTeX\ questions.


\section{Quick Start Guide}

This is a long document; it started out somewhat shorter, but as
sections were added to give more explanation and help, it grew.  You
may be concerned that you have to read the whole thing before you can
start typing up your thesis, but that's not true.  You can get going
with just the information in this chapter and the next one.  When you
want to learn a bit more, you can use the table of contents of this
document to zoom in on what you want, or you can skim through the
whole document from beginning to end when you have a spare half hour;
later, when you have a specific need, you can carefully re-read the
corresponding chapter or sections.

In summary, to get going:
\begin{enumerate}
    \itemsep0pt
    \item Install a \TeX\ system on your computer.
    \item If you want to use a GUI interface, download and install one
      of the suggested \TeX\ GUIs (or maybe you will find another one
      not described here).
    \item Copy all the files from the same place you found this PDF
      file into a directory (``folder'') on your computer.  At time of
      writing, all the files are in
      \url{http://cs.acadiau.ca/~jdiamond/tex-reference-material/honours-thesis-template/}.
    \item As described in Chapter~\ref{chap:INTRO}, edit the file
      \verb|preliminaries.tex| to personalize it for your name, your
      department or school, your thesis title, and so on.
    \item (Optional, but you really should.) Put your name, thesis
      title and keywords in the ``hypersetup'' in \verb|header.tex|.
      When you create a PDF file, these pieces of information are put
      into the internal PDF document description.
    \item Edit the file \verb|thesis.tex| to do two things:
    \begin{enumerate}
    \item delete the lines between ``START NOTE'' and ``END OF START
      NOTE'' (that text produces the first two pages of the sample
      thesis you are reading); and
    \item replace the lines like \verb|\include{gettingstarted}| with
      lines which include the files with \emph{your} writing.
    \end{enumerate}
    \item Write your thesis.
\end{enumerate}

\TeX\ and \LaTeX\ are extremely powerful and sophisticated tools.
Many students have used this template to produce a nicely-prepared
thesis without learning any more about \TeX\ or \LaTeX{}.  Should you
decide to use \LaTeX\ to write papers, letters, or other documents in
the future, you will discover that there are many packages for
\LaTeX\ to help you do these things.  And if you are in a department
that requires you to stand up at the front of a room and present your
thesis, you may want to learn about the \LaTeX\ ``\verb|beamer|''
package, which takes input very similar to what you will write for
your thesis, but instead formats it for presentations.

Finally, we hope this document provides 99\% of the information needed
by a beginner to create his or her thesis using \LaTeX.  If you decide
there is something else we should really talk about, please e-mail
\href{mailto:jim.diamond@acadiau.ca}{Jim Diamond} (or go and see him
in person).  Grammatical improvements from English majors are also
welcome.
