Writing a PhD Thesis in LaTeX

As you might have guessed from my last post I am currently getting familiar with LaTeX, a typesetting platform that enables you to create all kind of documents. Compared with other possibilities to create a document, e.g Microsoft Word, I find that using LaTeX allows me to be more creative and I get exactly the document I wanted to. In addition the documents look so much better and after I spent all this time researching stuff I want to present it in a nice way! For this post I assume that you already know what LaTeX is and that you might be interested in writing a thesis with its help and I will try to give you some ideas how you can do this.

As I am using Windows as a operating system (shame on me!) I use the MiKTeX distribution of (La)TeX. For your operation system of choice you can download a TeX distribution here. As editor I use the open source TeXStudio.

When I started using LaTeX I had a look around the web to see how others handled thesis writing, what kind of packages they use and what I could learn from them. There are quite a few thesis templates out there and I found these two some of the more useful ones:

  • Charly Stamper a PhD student at the University of Bristol put together this little guide, which is very good. I actually used her template as the base for “my” thesis template.
  • Alex Barnet has put a template online which is for students at Harvard but I found it quite useful to get a feel for what is needed.
  • Last but not least there is a a LaTeX template for a University of Edinburgh PhD thesis created by Magnus Hagdorn. It was helpful to see what was needed for a UoE template but it is a bit outdated as he got his PhD in 2003!

Handling your bibiliography

One of the things that has taken me the longest was to identify a list of packages (or add-ons) that provide a lot of help when writing a thesis. On top of that list was, no surprise here, a package that would allow me to cite and print references. I covered in my last post how to create .bib files with EndNote, these files are the source for getting references into your LaTeX document. Now there are basically two paths (well, there are more, but these are the most common two) to get the information from your .bib file into your document:

  • Use the combination of Bibtex and Natbib. Here Bibtex is an external program that essentially processes the information of your .bib file and the LaTeX document. Natbib is a package for LaTeX that allows you to format citations and bibliographies.
  • Or use the combination of Biber and Biblatex. Here Biber takes over from Bibtex and Biblatex is the package that lets you format citations and bibliographies.

Bibtex and Natbib have been around for quite a while now and have commonly been used in many thesis templates. However, they are also very limited in what they let you do to your bibliographies and citations. For a good overview that compares the capabilities of all four read this. I first thought that Natbib (and Bibtex) would be good enough for me but I soon ran into a problem that I could only solve by switching to Biber and Biblatex. So thats that problem solved for me, Biblatex and Biber it is!  If you chose the same, make sure that your version of Biber and Biblatex are able to communicate (or you spend quite a while to figure out that this is the reason why nothing is working…).

Useful packages

Some other packages that are very useful (or so I think) are the following. Please read the package documentations if you wonder how to use them in detail. Yes, writing stuff in LaTeX includes loads of reading up at the start. But the more you know the more powerful you document will be!

  • \usepackage[utf8]{inputenc} This package “translates” input encodings into a LaTeX internal language. Don’t ask, just use it. If you have a Umlaut somewhere in your references and you don’t have this package, good luck to you….
  • \usepackage[T1]{fontenc} Enables loads of fonts. Recommended.
  • \usepackage[english]{babel} Makes life a lot easier. Many different languages available if you want to write part of your PhD in anything but English.
  • \usepackage{geometry} This is how you make sure that you have the right margins for the UoE rules. Very powerful and easier to use than altering the options manually as many thesis templates do.
  • \usepackage[toc, page, header]{appendix} Makes the creation of an appendix much easier (well better looking that is).
  • \usepackage{fancyhdr} Makes manipulating of headers and footers easier.
  • \usepackage[plain]{fancyref} Allows for easier referencing within your documents.

There are loads more of useful packages and while you write your thesis I am sure you will add some more, just because they are helpful! You can find literally thousands of packages on CTAN. And if you find a problem that needs a certain package noone has writen yet you can create your own ;-).
Paddy pointed out that I missed the very helpful Detexify page which allows you to draw a symbol and get the right LaTeX code for it! Thanks for that.

Need help?

When I started using LaTeX I was very lost. Thankfully there are loads of websites that help you out! I found two sites very helpful:The Wikibooks section on LaTeX explains most things in great detail. From how you make a word bold to how to create bib tables, nearly everything you need is there! And as we are talking about tables: They can be  quite a pain to create in LaTeX but thankfully some kind soul has coded this very useful Excel plugin which transforms your excel file into LaTeX code!

Quite often you change something on your LaTeX code and some kind of error message pops up. From my experience it has nearly always something to do with a missing [{}} or other missing (or too many) characters. Just go through your code again and find it. If you can’t find it delete parts of your code until it works again and then fix the bit that was not working. If you think you ran into a dead end, google your problem and 99% of the time someone has asked the question before on TeX Stack Exchange! I found that site very helpful and you get loads of ideas what could be wrong with your code.

Folder structure for your thesis

LaTeX makes it possible to have different files for each chapter. This means that you don’t need to compile your whole thesis all the time and makes the handling of files much easier. I recommend the following folder structure:

Flowchart tex

Folder organisation: In your main Thesis folder have a folder for each of your chapters/appendices.

Have one main folder (here called thesis folder) in which you have a subfolder for each chapter. Within each of the subfolder you have a .tex file which is your chapter document and any files you want to associate with this chapter (e.g. images). In your main thesis folder you also have three files: the main thesis.tex, your bibliography (a .bib file) and a .tex file called custom_com. In this file you can create very handy shortcuts for things like chemical formulas or units.

FolderTEX

Thesis template

Edit: There is now a new template, please read this post for more infos.

I made a thesis template (procrastinating…) which is, as mentioned above, mainly on Charly’s template but also others and adjusted it to my needs. The outcome looks like this:

As you can see there are two versions of the chapter pages just to give you an idea how you can change the look of your document by playing around a bit. You can download the templates here. I tried to make as many comments as possible so it should be pretty straight forward. Any questions just ask.

Advertisements

6 thoughts on “Writing a PhD Thesis in LaTeX

    • Hi Yassine,

      I did the folder organisation in using the Windows Explorer. Just right click and create new folders!

      Hope that helps 🙂

      Johannes

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s