Writing my PhD thesis in LaTeX: my personal experience

A few months ago, I had finally started drafting my PhD thesis. My number one question at that time was: What text editor shall I open? I’m running Ubuntu, so using Microsoft Office Word was not an option, as installing this on a Linux machine can be very troublesome.

Therefore, these were the options that I could choose from and the reason why I didn’t pick those:

  • Libre Office Writer
    It’s not as bad as some people portray it, but it’s hard to collaborate well with Microsoft Office users (read: my supervisors), because it will definitely mess up images and references. I also don’t feel like this program is able to handle big and image-heavy files, such as a PhD thesis.
  • Office Online
    Office Online is the cloud version of our beloved Microsoft Office suite and is available in any Office 365 account. This would allow me to work in MS Word online. At first this looked like a really decent option, but it lacked some main features such as a proper reference manager.
  • Google Docs
    I really like Google Docs. I drafted some early versions of two manuscripts in it because its really easy to use for collaborations. In addition, I have heard good things about Paper Pile being a really good reference manager for Google Docs. However, I was afraid that the complex structure of a PhD thesis, including decent positioning of figures and automatical labelling of 6 chapters, would be too much for Google Docs. Please proof me wrong.
  • Markdown
    I use R Markdown a lot for drafting short reports of R analyses. I like its simple and clear style. I also read about some people who wrote their whole thesis in R Markdown. I would say that that’s quite adventurous, so I passed for this.
  • Notepad
    This is a joke.

So I was left with only one more option:

  • LaTeX

Our Maths professor motivated us to use LaTeX in the Math courses during our bachelor years to digitalise exercises and share them with other students. I liked it back then, but thought it was somewhat of a niche thing used in mathematics and physics departments only. Apparently it’s not:

latex_niche

I learned that its heavily used in bioinformatics as well. So if I had to learn one more thing before finishing my bioinformatics PhD, it was going to be “writing in LaTeX”.

Why did I use LaTeX?

Here are the reasons why I was finally convinced to use LaTeX:

  1. LaTeX is light
    Opening and editing your document is really fast as it contains plain text only. No need to load in the image files, hyperlinked references or complex tables, which can potentially crash your software, resulting in loss of data or formatting. These things are added only when you decide to convert your raw .tex file into a PDF.
  2. LaTeX is fun
    Writing a PhD is a hard job. Finding the right way to phrase your extreme interesting findings can be a troublesome and daunting task. If once in a while you can type a few lines of code to change the visual representation of your text as a diversion, than that’s a nice extra to have. Marton agrees.
  3. LaTeX is flexible
    If you would like to have a unique custom style, LaTeX can do it. This reminds me of the reason why I switched from third party software for data visualisation, to using ggplot2. Coding gives you much more flexibility than pushing several buttons on a user interface. I admit, it takes some time to get to know several commands before you are able to tune the style exactly the way you want it, but the LaTeX community is big and happy to help!
  4. LaTeX removes (some) repetitive styling tasks
    Once you have defined your style (or copied someone else’s), there’s no need to manually format everything. For example, in my thesis, each chapter starts with a large right-justified number followed by the title of the chapter. Furthermore every chapter needs to start on the right page of the booklet. The style guide that I use, does all of this automatically. The only thing I need to do is to define a new chapter using the `\chapter{TitleOfChapter}` command.
  5. LaTeX makes it easy to switch the order of chapters
    At a certain point, we decided to switch the order of my chapters. This means that every reference in that chapter, which starts with the number of that chapter (e.g. Figure 2.1 or Table 2.1), would need to be replaced to the new chapter number. I’m not sure how frustrating this would be in Microsoft Word or LO Writer, but in my case, it was as simple as switching the input commands:\input{Chapter1}
    \input{Chapter 2}
    \input{Chapter 3}

For these reasons, I was very happy with my choice for LaTeX:

Tips and tricks

Convinced to write yours in LaTeX as well? Good! But as you can expect, not everything will run as smooth as you would like to. There were still be many frustrating moments. I think Jaime RGP’s wording was spot on:

My experience is that LaTeX is both powerful and fragile. Obtaining good results is a matter of choosing tens of packages and patches, which can generate confusing results if you do not know what is going on. I still don’t know what is going on, and my thesis has a strong focus on software development.

Jaime RGP

Nevertheless, maybe these tips could get you started and avoid some of the things that I struggled with:

  1. Find a good template
    You need to start somewhere. Figure out whether your university/research institute already provides a LaTeX template that you can use. If not, look online, there are plenty of good free thesis templates available. For example, I decided to start with the TU Delft template as it already looks pretty neat.
  2. Decide whether you’ll be working locally or online
    LaTeX is available for all major operating systems. After finding the right installation instructions, you should pick your favourite LaTeX editor and you can get started! Alternatively, if you want to avoid installing anything, you could use one of the online available LaTeX editors. For example, one popular tool today is Overleaf, which has some pretty nice features, such as collaborative writing and direct submission to journals. For my PhD, I decided to use Overleaf.
  3. Follow a short tutorial
    There are plenty of free good tutorials available on the internet. Maybe find one for the editor that you decided to use. I, for example, heavily used Overleaf’s Tutorial page.
  4. Dare to ask
    If you’re struggling with something, search the web. There are great communities that probably have answered your question, such as the LaTeX Stack Exchange. Can’t find an answer to your question? Dare to ask!
  5. Find a way to share with your supervisor(s)
    I have four (!) supervisors working at three (!) universities. Each of them has their own style of correcting my drafts. I learned a lot from this. Discuss what makes them feel comfortable, but also see what’s possible for you. I gave them several options:

    1. Create a free Overleaf account and track changes in the online editor
    2. Print a hard copy per chapter and mark comments by hand
    3. Convert your LaTeX document to .docx (I’ll write a bog post about how I tackled this somewhere in the near future) and mark changes with the track changes option
  6. References
    Figure out how you will handle your references. For this you will probably need to export a .bib file from your favourite reference manager (Endnote, Mendeley, Paperpile, …). and import that in LaTeX. In my case, I coupled my Mendeley library to my Overleaf account which did all of this automatically. I personally think this is a very neat feature. Furthermore, when an entry was incorrect (e.g. missing the pagenumbers), I just used Mendeley’s DOI search option (the small magnify glass next to DOI) to update these details, which where automatically synced to the .bib file on Overleaf. However, LaTeX was not capable of parsing the html tags that indicate when a species name should be in italics in the title. I solved this by downloading the .bib file, run this helpful python script and reupload my new .bib file. That worked like a charm! Nevertheless, manual curation of the references, was still a necessity.

You should be writing

Now, stop procrastinating and get started!

Cheers,
Sander

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s