Short answers to questions
These Q&As were emailed after, or discussed during, various LaTeX courses. I add to this section all of the most interesting problems that come up on courses and suggest solutions. They are in no particular order.
Lower levels of subsection
The last two levels of the numbered sections are actually called paragraph and subparagraph and these are not usually numbered or included in the table of contents. Two extra lines of code are required to allow paragraph numbering and to include these numbers in the Table of Contents (toc).
\documentclass{paper}
\begin{document}
% change the settings to number paragraphs and
% include in the table of contents (toc)
\setcounter{secnumdepth}{5}
\setcounter{tocdepth}{5}
\section{section title (depth 1)}
\subsection{subsection title (depth 2)}
\subsubsection{subsubsection title (depth 3)}
\paragraph{paragraph title (depth 4)}
\subparagraph{Subparagraph title (depth 5)}
\end{document}
N.B. Depth 0 corresponds to \chapter and depth -1 corresponds to \part
Drawing pictures using TikZ in LaTeX documents
Not something I do or recommend, but this is a fair question. Short answer here ►
Side-by-side pictures and text
Loads of solutions are available, many involving packages. Here is a simple kludge using two minipages separated by a \hspace - the widths of all three elements add up to \linewidth. The whole sorry mess is best avoided.
\medskip
\newline
%
\begin{minipage}[t]{0.3\linewidth}
\vspace{-6pt}
\includegraphics[\linewidth]{myPicture}
\end{minipage}
%
\hspace{0.1\linewidth}
%
\begin{minipage}[t]{0.6\linewidth}
Your text goes here
\end{minipage}
How do I get the glossary and index?
This is definitely one of the most frequently asked questions. Neither the glossary nor the index come by just pressing F5 for compile and build (assuming you are using TeXstudio) using the supplied document class and example thesis.
Index: This option is on the Tools menu; it does not have a keyboard shortcut. Select Tools>Index from the menus and then compile again. Try it twice if there are problems.
Glossary: Use file explorer to find your working directory. The example thesis directory contains a file called makethegloss.bat double click the icon representing this file and it will execute the glossary script. You may get a warning message from windows but just ignore it. Now compile twice.
The glossary script looks like this:
makeindex main.nlo -s nomencl.ist -o main.nls
For it to work the thesis file must be called main.tex but you can edit makethegloss.bat so it works with any name.
NB The TeXStudio [Tools]>[Glossary] or F9 option doesn't work because it assumes the presence of a package which is not part of the class file or preamble - and if it were it would cause problems further down the chain.
I don't like the section numbers in the margin in the uop thesis class - how do I stop this?
This feature is part of the template. It makes the major divisions of the chapter easier to locate as you scan the document quickly. To remove it just add this to the end of your preamble.
% --- turn off section visibility aid
\titleformat
{\section}
{
\settowidth{\secsep} {\large\sffamily\bfseries n}
\large\sffamily\bfseries
}
{\thesection}
{\secsep}
{}
I don't like the equations coming out in the middle of the page - how do I left-align them?
Alignment of equations is a tricky business with loads of options. The simplest answer is to use the flush-left-align option in the amsmath package.
\usepackage[fleqn]{amsmath}
A raft of other options are available with this package. A full discussion can be found here:
http://en.wikibooks.org/wiki/LaTeX/Advanced_Mathematics
Is the approach discussed here compatible with biblatex and biblatex-biber?
There are a number of more modern innovations in the LaTeX community (such as biblatex and xelatex to pick just two) which look to be superior in many ways to the techniques discussed here. Making the change should represent minimal effort once you have mastered the basics. Good luck!
How do we download new packages? I am having trouble using the UoP thesis class file as I am missing something and it brings up an error because of this.
This should be automatic if you have an internet connection, have installed MikTeX successfully, and answered 'Yes' to the 'Install missing packages on the fly' option during the MikTeX installation (as recommended). Check your connection and if no luck re-install MikTeX with the right options. If you still have problems then we have to look for them somewhere else.
How do we use the Harvard/ Plymouth recommended referencing system instead of the plain one?
Plymouth requires 'author-date' citations in dissertation texts. This is sometimes called 'Harvard style' but in fact it is more like a large family of citation styles allowing quite a few variants on the basic author-date form. A full discussion of all the options would be out of place here, in any case the submission requirements do not make clear exactly what is required.
A suitable citation style has been standard in the uopThesis class for more than a decade. The technical details (all taken care of for you in the class file so don't worry) are:
\usepackage{natbib}
\renewcommand{\bibname}{List of references}
\bibpunct[ ]{(}{)}{;}{a}{}{,}
\bibliographystyle{agsm}
If you don't change this then everything will be fine. Use \citep{} and \citet{} - do not use \cite{}. If you want your own variation then consult the documentation for the natbib package.
How do we get double spacing for the main body of text?
Again, if you use the uopThesis class this is already written in. The technical details are:
\usepackage{setspace}
\onehalfspacing
% or
\doublespacing
How do we set up the chapters as separate file to the main document?
\include{separatechapter.tex}
The chapter files must not have a begin{document} or end{document} or any preamble.
How do we put images, figures, into the document?
Make sure you have:
\usepackage{graphicx}
which is there for you anyway in uopthesis.cls, and if you are using TexStudio then select from the menu bar:
Wizards -> Insert Graphic
you will be prompted to browse for the image file, add a caption, set the size and so on. You can change all of these later so just put in something sensible. Most picture formats are OK but jpeg is the most storage efficient and pdf is the best for high quality figures. png is in the middle somewhere and bmp works as well.
Positioning of floats (including Figures) has always been contentious - start here ►
How do we put tables into the document?
There are two ways to do this and examples of both are in the set of minimal examples supplied. For traditional latex tables I recommend the LaTable free utility.
What is the best program for our supervisors to use to annotate and correct the output pdf document?
Tracker PDF-Exchange Viewer is free and it works OK.
Foxit is still available free and is very good - I use this one.
How do I Do a Word Count?
Details here ►
How to handle footnotes in tables
This is covered in one of my 'minimal examples'. Page footnotes do not work in tables because they are stuck in the table and have no way of `escaping’ to the main page. Good typographic style avoids footnotes in tables.
If you must use them, then make them footnotes to the table, not footnotes to the page. Fortunately this is easy in LaTeX. Put the tabular environment in a minipage and the footnotes are handled correctly. This will work fine and looks beautiful.
\begin{table}
\begin{minipage}[t]{\textwidth}
\centering
\begin{tabular}{llll}
May & Jun & Jul & Aug\footnote{Really! I will make a note of that.}
\\
2 & 4 & 6 & 9
\\
6 & 7 & -- & 9\footnote{This also deserves a mention.}
\\
\end{tabular}
\end{minipage}
\caption{This is the table with the footnotes.}
\label{t:theTable}
\end{table}
Order in Nomenclatures/Glossaries
The full answer is long and obscure. Latex puts symbols first, then numbers, then words, in three separate sorting processes. You can fine tune or impose an arbitrary sort order by doing this:
% natural order without prefix
\nomenclature{dog}{Woof}
\nomenclature{cat}{Meow}
\nomenclature{bird}{Tweet}
% custom order with prefix
\nomenclature[adog]{$\delta$ og}{Sorted after 'dog'}
\nomenclature[acat]{$\kappa$ at}{Sorted after 'cat'}
You will find information here ► and here ► very useful to get the full picture.
URLs Causing Problems?
Get in to the habit of using \url{ } when using urls in your text. These often contain characters that need special treatment. And urls cause line breaking problems because they are long, and the algorithm doesn't know how to split them at the end of lines.
This is particularly important if you want the url in the Bibliography or List of References. Use \url{ } in your bibliographic database and most of your problems will be sorted when it is set in the document.
You will need \usepackage(url) or \usepackage(hyperref) in your preamble.