Howto write a thesis using LaTeX, Part 2: Create the document structure

In part 1 of this tutorial, we managed to set up software that helps us creating our thesis with LaTeX. It’s time to get started with the real LaTeX stuff. This is not going to be an introduction to LaTeX as there are plenty of very good LaTeX tutorials; you can easily find them using google. This tutorial is rather a guide on which packages are helpful to be used, how you can organize your files, how to insert graphics, create tables and write algorithms in LaTeX. To understand the commands provided in this tutorial, I strongly recommend doing some general introduction to LaTeX first!

1. Folder structure

We start with creating a new folder (our project directory), preferably directly using our cloud service. I use Dropbox and hence create a new folder in my Dropbox folder called Thesis. Within this folder, let’s add some additional folders:

  • fig (will contain all figure)
  • tex (will contain LaTeX files)
  • bib (will contain bibliography files)

Separating your source files will help you keeping the overview about your files.

2. Creating the main LaTeX document 

First, open Texmaker and click New icon to create a new file. Each Latex document has to define a document class, indicating what kind of document we are about to create, this may be a book, a thesis or even a presentation. We are using document class report and define it by writing

Hello World!

to the very top of the file. We defined the document to be a report and added some additional parameters. As I am European, I use A4 paper size and a default font size of 12pt. If you prefer using the letter paper size, just replace a4paper with letterpaper. Next, save the document into your projects root directory as Thesis.tex. The directory should now look like


Please note that the little green check mark is indicating that the files are in sync with my Dropbox account.

Now we are going to translate the document by Tools->PDFLaTeX from the top menu or by simply pressing [F6] on the keyboard. If you have activated the messages and log window in Texmaker, you see some output written there. For sure, you will need the outputs later if you note that you have some errors in your LaTeX code and the messages window is presenting shiny red error messages. If we have a look at our project directory, we note that some additional files have been created by LaTeX. Don’t care what they mean at all! The only thing to note is that there is a PDF document called Thesis.pdf which can be displayed directly in Texmaker on the most right column. The PDF view is refreshed by selecting Tools->View PDF from the menu or by clicking [F7]. Doing so, Texmaker shows a PDF file containing only the text Hello World!

Let’s create the main document structure for our thesis. Many universities do provide LaTeX templates, but unfortunately, mine did not. So I created by own structure to be:

  • Title page
  • Abstract
  • Table of contents
  • Introduction
  • Material
  • Some real boring stuff for at least 99.9% of people
  • Discussion
  • Conclusion
  • Acknowledgment
  • Appendices
  • List of Algorithms
  • List of Figures
  • List of Tables
  • Bibliography

Let’s model this structure in our main Thesis.tex file. First we create the table of contents which is easily done by putting the command


inside the begin and end document tags. After translating the document and refreshing the PDF file, a headline with Content appeared. Not surprisingly, the table of contents is empty as we did not yet insert any content. Thus, lets add some by adding an introduction. I organized my files by creating a new .tex file for each chapter of my thesis. You would be able to write all your stuff into only a single file (directly to Thesis.tex), but will pretty sure end in smashing your head against the keyboard if your document gets very large. Not only that you have real trouble in navigating through your document, but also Texmaker is getting slow if the files are getting too big. Hence, I recommend to distribute the document over several files. Lets create a new file and save it as Introduction.tex into the SUBFOLDER tex we created previously. Add

I was motivated to write a Phd thesis because I did not want to work directly after finishing my study
This thesis is organized as follows, ...

to Introduction.tex and save the file. As you note, we have just created a new chapter containing two sections. All we have to do know is to import the file into our main document. Thus, write


after \tableofcontents to Thesis.tex file. The command tells LaTeX that there is another file that we want to put into exactly that place where we wrote the command to and the file to be injected can be found in the sub directory tex and is called introduction. Note that no file extension is given! The command is followed by \newpage which tells LaTeX that we want to have a new page started after this chapter and \cleardoublepage telling that all figures, tables etc. that belong to that chapter are inserted to a new page before the next chapter starts. Press [F6] and [F7] again to translate and update and you will see that there is a new page containing the Introduction. But, are you kidding me LaTeX! Why is my table of contents still empty? Cool down, this is because LaTeX is creating references while compiling but at the moment the table of contents is created, the references have not been added yet. You do not have to understand that, you only need to know, that if you add anything that is reference at any other position in the document, you have to translate twice. So simply press [F6] wait until it finished, press [F6] and then [F7] and your table of contents will be fine.

Great, we just started creating our document structure. Lets put all the other chapters in there as well


and don’t forget to create the files, add \chapter{Some Name} and save them. Translate again. By the way, there is a nice trick that you can translate the master document by pressing [F6] even if there is another document open. Just open the Thesis.tex file and click Options->Define Current Document as ‘Master Document’ in Texmaker:


Now, our document is already 7 pages long and contains a table of contents. But I don’t like how the headlines and chapters look like. Thus, I want to change the style of my document and I prefer to use a package called fncychap. The package comes with a bunch of styles where I like Sonny the most. A package is used in LaTeX by calling the \usepackage{} command. In Texmaker, simply write


in the preamble of your document, that is before \begin{document}. The command tells to use the fncychap package with parameter Sonny. If you try to translate, you might note one of the biggest benefits with using Texmaker and MiKTeX. As you are attempting to use a package that is not yet installed, you are asked if MiKTeX should do that for you.install_package_promt

Click install and wait until installation and translation has finished. Updating the PDF will show a newly designed document. Another useful package is loaded by


and leads to the usage more wider page width.

Next we are adding the additional lists to the end of the document:


where the list of algorithms needs package


Obviously, the lists are empty for now.

3. Adding Bibliography

The bibliography is handled a bit different. LaTeX uses so called BibTeX files that contain entries for papers, books and other published stuff. The idea behind is that you have only one big BibTeX file (.bib) with all your publications in it. LaTeX is calling BibTeX with references to the entries using a unique key and BibTeX is creating a file containing only the referenced entries. LaTeX further uses the created file and inserts the entries into the document. Although, it is possible to add several bib files. You can edit the bib files using software or insert entries manually to the bib file. I prefer doing it manually this saves me the time of importing and exporting all the time. Thus, I open the bib file in Notepad++ and copy the references by hand. Let’s create a simply scientific article reference. The BibTeX code might look like

    author  = {Torsten Schoen and Co Author},
    title   = {Ten things you better not say to your wife},
    journal = {Optimizing Husbands},
    volume  = {21},
    year    = {2013},
    pages   = {85--91},

We simply open Notepad++, create a new file, put the code above in there and save it in the Thesis\bib folder by name Literature.bib. Below our lists, we add the bibliography:


Further, we have to define a bibliography style in the preamble


where I prefer the plain style. We can cite entries of the bibliography using the \cite{} command and providing the unique key. For example, write in any of you chapter files:

We refer to Sch\"on \cite{schoen2013} for things you ...

On translating the document, a warning is shown in the message console as the key schoen2013 cannot be found. This is because we have to run BibTeX first by pressing [F11] in Texmaker. Again, as there are references you have to press [F6] and [F11] in turn again and again until the citation finally works. Updating the PDF after persistent pressing of [F6] and [F11] until all warnings disappeared, we can see that a bibliography with one entry has been added at the end of the document and in the text part, \cite{schoen2013} has been replaced with its related number.

A nice source to find papers and get them directly in BibTex format is to search at Google’s scientific search engine called Scholar. If you do a search, you can click on “cite”


and a export citation window appears where you can export the entry as BibTeX code to simply copy and paste it into your bib file.


4. The title page

Next step is to add a title page. Most universities require to use a predefined title page so as my one did. The title page actually consists of two page, the real title page and a page with some formalities. Of course, the title page is nothing else than a normal LaTeX file. Hence, we simply create a new file in our tex folder and name it Title.tex. The only difference is that we should define the title page as title page by inserting:

This is my thesis!

Anything that should be part of the title page is written between the tags. Further we have to input the file into Thesis.tex by writing


right after \begin{document}. Next, we gonna add some empty pages between the title, abstract and table of contents and change the numbering to be roman. The real Arabic page numbering of the thesis therefore start just with the first page of the introduction.
This is a bit more complicated and I will simply provide the code without any explanations. The complete Thesis.tex file is hence defined as:













This is the end of the second part of this tutorial. You can download related source as zip file here:
TS thesis template Part 2

In the next part, I will give you some useful tips and tricks that helped me a lot:

==> Continue with Part 3