Skip to Main Content

Research Guides

Submit and Publish Your Thesis

Formatting in LaTeX

For formatting instructions and requirements see the Formatting section of the School of Graduate Studies website. The thesis style template for LaTeX (ut-thesis) implements these requirements. You are not required to use the template, but using it will make most of the formatting requirements easier to meet.

►►Thesis template for LaTeX.


LaTeX Help

Below are some general formatting tips for drafting your thesis in LaTeX.  In addition, there are other supports available:

  • Regular LaTeX workshops are offered via the library, watch the library workshop calendar at https://libcal.library.utoronto.ca/
  • With questions about LaTeX formatting, contact Map and Data Library (MDL) using this form
  • There are also great resources for learning LaTeX available via Overleaf
  • Many common problems have been solved on the TeX - LaTeX Stack Exchange Q & A Forum

LaTeX Template

 

Installing

To use the LaTeX and ut-thesis, you need two things: a LaTeX distribution (compiles your code), and an editor (where you write your code). Two main approaches are:

  1. Overleaf: is a web-based platform that combines a distribution (TeX Live) and an editor. It is beginner-friendly (minimal set-up) and some people prefer a cloud-based platform. However, manually uploading graphics and managing a bibliographic database can be tedious, especially for large projects like a thesis.
  2. Local distribution & editor:
    • A LaTeX distribution can be installed as described here. ut-thesis can then be installed either: a) initially, with the distribution; b) automatically when you try to compile a document using \usepackage{ut-thesis}; or manually via graphical or terminal-based package manager for the distribution.
    • The LaTeX distribution allows you to compile code, but provides no tools for writing (e.g. syntax highlighting, hotkeys, command completion, etc.). There are many editor options that provide these features. TeXstudio is one popular option.

Occasionally, the version of ut-thesis on GitHub may be more up-to-date than the popular distributions (especially yearly TeX Live), including small bug fixes. To use the GitHub version, you can download the file ut-thesis.cls (and maybe the documentation ut-thesis.pdf) and place it in your working directory. This will take priority over any other versions of ut-thesis on your system while in this directory.

LaTeX Formatting Tips

Here are a few tips & tricks for formatting your thesis in LateX.

 

Document Structure

Using the ut-thesis document class, a minimal example thesis might look like:

\documentclass{ut-thesis}
\author{Your Name}
\title{Thesis Title}
\degree{Doctor of Philosophy}
\department{LaTeX}
\gradyear{2020}
\begin{document}
  \frontmatter
  \maketitle

  \begin{abstract}
    % abstract goes here
  \end{abstract}
  \tableofcontents
  \mainmatter

  % main chapters go here
  % references go here

  \appendix
  % appendices go here
\end{document}

►► A larger example is available on GitHub here.

You may want to consider splitting your code into multiple files. The contents of each file can then be added using \input{filename}.

 

Sections

The usual commands for document hierarchy are available like \chapter, \section, \subsection, \subsubsection, and \paragraph. To control which appear in the \tableofcontents, you can use \setcounter{tocdepth}{i}, where i = 2 includes up to \subsection, etc. For unnumbered sections, use \section*, etc. No component should be empty, such as \section{...} immediately followed by \subsection{...}.

Note: In the examples below, we denote the preamble vs body like:

preamble code
---
body code

 

Tables & Figures

In LaTeX, tables and figures are environments called “floats”, and they usually don’t appear exactly where you have them in the code. This is to avoid awkward whitespace. Float environments are used like \begin{env} ... \end{env}, where the entire content ... will move with the float. If you really need a float to appear exactly “here”, you can use:

\usepackage{float}
---
\begin{figure}[H]
...
\end{figure}

Most other environments (like equation) do not float.

 

Tables

A LaTeX table as a numbered float is distinct from tabular data. So, a typical table might look like:

\usepackage{booktabs}
---
\begin{table}
  \centering
  \caption
{The table caption}
  \begin{tabular}{crll}
    i &   Name & A &  B \\
    1 &  First & 1 &  2 \\
    2 & Second & 3 &  5 \\
    3 &  Third & 8 & 13
  \end{tabular}
\end{table}

The & separates cells and \\ makes a new row. The {crll} specifies four columns: 1 centred, 1 right-aligned, and 2 left-aligned.

 

Fancy Tables

Some helpful packages for creating more advanced tabular data:

  • booktabs: provides the commands \toprule, \midrile, and \bottomrule, which add horizontal lines of slightly different weights.
  • multicol: provides the command \multicolumn{2}{r}{...} to “merge” 2 cells horizontally with the content ..., centred.
  • multirow: provides the command \multirow{2}{*}{...}, to “merge” 2 cells vertically with the content ..., having width computed automatically (*).

 

Figures

A LaTeX figure is similarly distinct from graphical content. To include graphics, it’s best to use the command \includegraphics from the graphicx package. Then, a typical figure might look like:

\usepackage{graphicx}
---
\begin{figure}
  \centering
  \includegraphics[width=.6\textwidth]{figurename}
\end{figure}

Here we use .6\textwidth to make the graphic 60% the width of the main text.

By default, graphicx will look for figurename in the same folder as main.tex; if you need to add other folders, you can use \graphicspath{{folder1/}{folder2/}...}.

 

Subfigures

The preferred package for subfigures is subcaption; you can use it like:

\usepackage{subcaption}
---
\begin{figure} % or table, then subtable below
  \begin{subfigure}{0.5\textwidth}
    \includegraphics[width=\textwidth]{figureA}
    \caption{First subcaption}
  \end{subfigure}
  \begin{subfigure}{0.5\textwidth}
    \includegraphics[width=\textwidth]{figureB}
    \caption{Second subcaption}
  \end{subfigure}
  \caption{Overall figure caption}
\end{figure}

This makes two subfigures each 50% of the text width, with respective subcaptions, plus an overall figure caption.

 

Math

Math can be added inline with body text like $E = m c^2$, or as a standalone equation like:

\begin{equation}
  E = m c^2
\end{equation}

A complete guide to math is beyond our scope here; again, Overleaf provides a great set of resources to get started.

 

Cross References

We recommend using the hyperref package to make clickable links within your thesis, such as the table of contents, and references to equations, tables, figures, and other sections.

A cross-reference label can be added to a section or float environment using \label{key}, and referenced elsewhere using \ref{key}. The key will not appear in the final document (unless there is an error), so we recommend a naming convention like fig:diagram, tab:summary, or intro:back for \section{Background} within \chapter{Intro}, for example. We also recommend using a non-breaking space ~ like Figure~\ref{fig:diagram}, so that a linebreak will not separate “Figure” and the number.

You may need to compile multiple times to resolve cross-references (and citations). However, this occurs by default as needed in most editors.

Diagrams

The LaTeX package tikz provides excellent tools for drawing diagrams and even plotting basic math functions. Here is one small example:

\usepackage{tikz}
---
\begin{tikzpicture}
  \node[red,circle]  (a) at (0,0) {A};
  \node[blue,square] (b) at (1,0) {B};
  \draw[dotted,->]   (a) -- node[above]{$\alpha$} (b);
\end{tikzpicture}

Don’t forget semicolons after every command, or else you will get stuck while compiling.

 

References

There are several options for managing references in LaTeX. We recommend the most modern package: biblatex, with the biber backend.  A helpful overview is given here.

Assuming you have a file called references.bib that looks like:

@article{Lastname2020,
  title = {The article title},

  author = {Lastname, First and Last2, First2 and Last3 and First3},

  journal = {Journal Name},

  year = {2020},

  vol = {99},

  no = {1}

}

...

then you can cite the reference Lastname2020 using biblatex like:

\usepackage[backend=biber]{biblatex}
\addbibresource{references.bib}

---

\cite{Lastname2020}

...

\printbibliography

Depending on what editor you’re using to compile, this may work straight away. If not, you may need to update your compiling command to:

pdflatex main && biber main && pdflatex main && pdflatex main

Assuming your document is called main.tex. This is because biber is a separate tool from pdflatex. So in the command above, we first identify the cited sources using pdflatex, then collect the reference information using biber, then finish compiling the document using pdflatex, and then we compile once more in case anything got missed.

There are many options when loading biblatex to configure the reference formatting; it’s best to search the CTAN documentation for what you want to do.

Windows users may find that biber.exe or bibtex.exe get silently blocked by some antivirus software. Usually, an exception can be added within the antivirus software to allow these programs to run.