Dave's Thesis-in-a-Box :: HOWTO
David Symonds, 2003-4

If you're not interested in using LaTeX, turn back now!

This is a quick guide to various little things you might want to with LaTeX for your thesis or other documents. This assumes you are using my Thesis-in-a-Box kit; most of what is below will work equally well without it, and notes are given on how to get it working. It is starting out quite small, but will gradually expand when I get around to it. Check back often.

There is a good general reference for LaTeX; use it! Another must-get is the LaTeX cheat sheet, free to download. Get it now!

Gotchas!

Here's a list of problems that some people experience which have easy (but perhaps obscure) fixes:

Figures

The cliché is:
	\begin{figure}[ht]
		\epsfig{file=figs/fig_adhoc_routing.eps}
		\caption{Categorisation of ad hoc routing protocols.}
		\label{fig:adhoc_routing_cats}
	\end{figure}
The bit in the square brackets on the first line tell LaTeX where to put the figure. h stands for "here", t stands for "top of a page", b stands for "bottom of a page", and p stands for "page of floats". They are tried in order. ht works well for most purposes.

The second line is the location of the figure, relative to the current directory. The best figure format to use is Encapsulated PostScript (EPS), though other formats can be forced to work. If you don't yet have your figures in EPS format, use something like The GIMP to convert into EPS first.

The caption is self-evident. This text will also appear in the List of Figures; if you want them to be different, you can do something like:

		\caption[lof_text]{Actual caption text}

The label is the anchor tag used for referencing the figure from elsewhere in the document. It's best to start it with fig: so that the prettyref package can be smart about things.

References

A reference must have an anchor tag immediately after (or in) whatever you are referring to. You use the \label command to set a tag, as in:
	\chapter{Method}
	\label{cha:method}
or
	\sec{Definitions}
	\label{sec:definitions}
The list of tags that you should use (the bit before the colon) is below, also showing how they will appear in the output (shortref format).
TagWhereHow they appear
algInside \begin{algorithm} ... \end{algorithm}Algorithm A
appAppendix chaptersAppendix A
chaRegular chaptersChapter 2
figInside \begin{figure} ... \end{figure}Figure 3.4
lemInside \begin{lemma} ... \end{lemma}Lemma 1
secSections, subsections, etc.Section 3.1.4
tabInside \begin{table} ... \end{table}Table 2.1
thmInside \begin{theorem} ... \end{theorem}Theorem 2
To actually make a reference, use either:
	\prettyref{sec:definitions}
or
	\shortref{sec:definitions}
The first form includes a page reference, whilst the second is only the short form (as in the table above).

Bibliography

LaTeX bibliographies are best done by using BiBTeX. The bibliographic entries themselves are kept in a separate file (called refs.bib in Thesis-in-a-Box), and it is referenced from main.tex. The file containing the entries only contains the raw data, and the actual layout is done separately. There's lots of styles that can be used for bibliographies, but my preferred style is included with Thesis-in-a-Box (mybibstyle.bst). The selection of which style to use is made at the bottom of main.tex (without the ".bst" extension), and other styles you might like to try are amsalpha, amsplain, abbrv, ieeetr or plain.

As for the actual bibliographic entries, they look a lot like this:

	@inproceedings{Perkins94,
		author = {C. Perkins and P. Bhagwat},
		title = {Highly Dynamic Destination-Sequenced Distance-Vector Routing ({DSDV}) for Mobile Computers},
		booktitle = {{ACM SIGCOMM} Conference on Communications Architectures, Protocols and Applications},
		year = {1994},
		pages = {234-244},
		address = {London, United Kingdom},
		note = {doi:~10.1145/190314.190336}
	}
Thankfully you don't have to do it all by hand, since there are several tools that give you a nice GUI for editing these files: Remember that the idea is to put as much information into that file as you can, and the style file will tell the LaTeX/BiBTeX system what to do. For example, it's probably best to use full names in the bibliography file (not like the example above!). More importantly: use a good key. Like the one above, "Perkins94", it is easy to remember this when inserting citations (below). It is not uncommon to cite several papers by the same author, so I recommend using the system that I use (surname of first author plus year of publication).

So how do I insert an actual citation? Like so:

	As mentioned in \cite{Perkins94}, some frogs are green.
The output will look different, depending on the bibliography style chosen. In my style, they come out looking like [Perkins94]; other styles can give you boring old numbers like [47] that are more traditional, but are not as easy to use in practice.

Sample output using this style includes:


Contact

I can be emailed at , or found in G61B. Come and chat to me if you need help getting started or getting things going. Check this page regularly for updates!