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

12 thoughts on “Writing my PhD thesis in LaTeX: my personal experience

  1. I’m just curious, in order to connect Mendeley with Overleaf, did you upgrade to a paid subscription? And if so, would you recommend it?

    I’m 3rd year PhD and in the process of writing my Thesis using Latex and I’m wondering about transferring onto Overleaf.

    Thanks, Seren

    Like

    1. Hi Seren,

      Thanks for passing by!

      From what I remember, the Mendeley integration should be available for the free version as well. However I did switch to a paid subscription (students get discounts) rather quickly because I had storage troubles and wanted to make use of the sharing options. The latter did not really work out, but I did need the space as soon as my thesis was getting bigger and bigger.

      Good luck!
      Sander

      Like

  2. Hi Sander,

    Thanks for the nice post. I wonder how you included bibliography in your thesis? I follow your decision to use Delft PhD template, and apparently the bibliography list is not printed. Any idea?

    Thanks, Eko

    Like

    1. Hi Eko,

      Thank you!

      Yes, I did include a bibliography. I connected my Overleaf account with Mendeley and added the following code to the main tex file: “\addbibresource{mendeley.bib}”

      Then I needed some additional tweaking to get the bibliography file the way I wanted.

      Hope this already helps…

      Sander

      Like

  3. think you for this blog Post it was really great help for me.
    can you give me some guidelines on how to convert my LaTeX document to .docx

    Like

    1. Hi Adil,

      I just realised I never wrote that blog post. I’ll try to do that!

      For the time being: I used pandoc with the following command to convert from tex to doc:

      pandoc -s introduction/introduction.tex -o introduction/introduction.docx –bibliography=mendeley.bib –csl ../american-psychological-association-6th-edition-etal2.csl

      Like

  4. Hi,
    I’m currently trying to write my thesis in Latex, because many people had told me that I would run into troubles when writing a long document in Word. I had written the first chapter of my thesis in word, then converted it manually into Latex. This took quite a while, so I decided to write the rest directly in Latex. Which brings other problems with it. I feel like seeing all the code of Latex around the words I will actually see really keeps me from writing well. Did this cause you any trouble? How did you get around this? Thanks.

    Like

    1. HI Jessica,

      Thanks for leaving a comment. First of all, don’t feel pushed to use LaTeX. I understand why people say that you could run into trouble using Word, but I also want to mention that in my previous lab, of the 8 people who got their PhD degree in the last two years, I was the only one not writing in Word. Just to show you that it is perfectly doable to write your thesis in Wordnot. Besides, I ran into many problems writing in LaTeX as well. In a big project like this, I am sure that everybody will run in to some problems, independent of what tool they use to write down their PhD. So why not stick with Word if that fits your needs and habits?

      I also understand that some of the code around the words might be distracting in the beginning, when you just want to write down your train of thoughts. Well, what really worked for me was using the shortcuts, e.g. ctrl + i for italics, ctrl + b for bold, etc… In this way I did not have to type the commands, but they would be automatically generated as soon as I needed them. Secondly, in Overleaf I was used to generating the previews, so as soon as I wanted to edit some of my writing. Therefore, I would actually use the rendered PDF instead of the LaTeX code. Finally, you will get used to it more quickly than you imagine. If you are not doing something fancy, the LaTeX code will be rather simple and the more you write with it, the more used you will get in processing these code chunks quickly.

      But remember: try out some things, but eventually choose what fits the best for you.

      Like

  5. I am also a 3 rd year PhD student and I need to write my thesis in latex but I don’t have any experience of using latex. where can I get the full packages of latex?

    Like

  6. Hello,
    Thank you for this useful article. Is there an easy & automated way of converting latex files to docx? Thank you

    Like

Leave a comment