So you decided to write your thesis in LaTeX? pt1

Oh deary, I appear to have forgotten about this blog. Some quick updates:

  • I moved to Austria about 3 months ago and since then,
  • I have written my PhD thesis.
  • Currently it sits with my Prof for corrections.

I wrote my thesis in LaTeX hoping it would make things easier than using Word which chugs horribly in large documents with dozens of figures. Not to mention the pains of layout.

I believe LaTeX is a great way to write a thesis, but there are a lot of hurdles I was unprepared for when starting. Here, I will outline to solutions to most of them.

There are now online services for writing in LaTeX (Overleaf.com probably being the largest) but as I was expecting to write at times with no/limited internet access, I wanted to do things locally. I used TeXstudio for most of the work, occasionally writing in a text editor with LaTeX highlighting (Sublime Text v3).

The basic template that I use came from this website, and while not perfect, it does make a lot of things easier than starting with a blank slate.

General

I highly recommend learning a little about LaTeX planning on spending weeks or months writing in it. It requires a certain level of comfort writing markup style, and if this scares you, given the importance of your thesis LaTeX may not be for you.

Some things to be aware of. I will state certain package that need to be included. These should be done above  \begin{document} in your "main.tex" file if you're using the Masters/Doctoral thesis template above. I find it useful to add comments all over my .tex files. Add a package? Comment to explain why you did and what it is for. This allows you to remove it later if you're not usually it any more or if it was just for testing.

Comments are easy, just add a % to the start of the line. If you are using TeXstudio, you can highlight text in bulk and Ctrl+t to comment out the whole block.

I also recommend writing in chapters and comment out chapters you aren't working on i.e.

\include{Chapters/Chapter1} %intro
% \include{Chapters/Chapter2} %synergy

Not only will it be faster than compiling the whole document every time you want to check a small layout change,  especially important when you have more than a couple of chapters done and the density of figures/tables etc increases.

Images

This is a complicated and important topic. Most scientific work is centred around the figures that you make, and so it really important that this is done right. Before you even consider any LaTeX code for images, I recommend you create your images as SVG files (inkscape is a great free tool to do this), then export as PDF. I initially read that I should export images as .EPS files (enhanced post-script), however my microscopy images were then subjected to compression and artefacts became apparently which was not acceptable. All software I used to create figures allowed for export as SVG or to Inkscape for manipulation (GraphPad Prism, imageJ, FlowJo) and I can't imagine that there would be a case where this is not possible.

If you have to use .EPS and those figures are not bitmap (i.e. microscopy), you can do so, but will need to include the epstopdf package usepackage{epstopdf} above \begin{document} in your "main.tex" file.

Make your images in Inkscape and save as SVG (for future editing) but export as PDF. You can usually edit imported text here (i.e. axis of graphs) and I would re-do these if necessary as not all symbols will transfer well to Inkscape. It also allows for you unify your fonts and text sizes. I would also label the figure parts at this stage a) b) c) etc. Pick a font size (probably 12) and stick with it for all figures. This helps later.

You can click and drag the PDF file of your image into TeXstudio. There you will be presented with a dialogue box where you can enter details that eventually just appear in the code inserted. Eventually, when familiar it's easier just to write it yourself in my opinion. Let's break it down. \begin{figure} starts a figure environment but isn't strictly necessary to insert an image, but it helps with formatting. \centering is pretty obvious - it lines up the figure to the centre of the writing environment of the page (i.e. not including the margins). \includegraphics[width=0.7\linewidth]{filelocation} sets the embedded image to 70% of the page width. Note that you don't need to include .pdf at the end of the file name. LaTeX realises this and deals with it for you. In the cast of imported .eps files, they get converted to PDF here.

\caption is self explanatory but can be combined with other markup for example to embolden a few words at the beginning.

It is important to put a unique label on images that is also descriptive. In the text you can then reference it with \ref{fig:label} which will post just the figure number, or \autoref{fig:label} which will post "Figure 4.1" etc.

I would recommend adding a couple notes using comments at the end of every figure. 1) %source: identify the source of your data as it's not always so obvious years after acquisition to go back and trace where it came from, especially after removing some of the text to make the figure look cleaner. 2) %todo this syntax adds a highlight by default in TeXstudio and makes it easier to spot where you want to make changes later.

\begin{figure}
	\centering
	\includegraphics[width=0.7\linewidth]{Figures/bonemarrowdevelopment}
	\caption{Bone marrow development. As humans age, haematopoietic cells are gradually replaced with adipose tissue, changing the colour of bone marrow from red to yellow.\cite{Li2018}}
	\label{fig:bonemarrowdevelopment}
\end{figure}

Future posts

Other articles to come when I find time to write them:

Tables : Easy ways how to create using excel, including tables that cross multiple pages

Referencing: Using Mendeley and to CWYW (cite while you write)!

Greek: Your alpha beta gamma deltas

Chemical names: I'll explore some packages for easily writing out chemical structures. Note I did it all manually, but I do not recommend this.

Paul Mac Eoin

Read more posts by this author.

Vienna, Austria