Writing a Law PhD with Latex (3)

Sun 29 June 2014 | tags: Latex, Free Software, PhD, Social Sciences, Oscola, -- (permalink)

Your main Latex file

Before you start writing your thesis, you will need to set up the main thesis file. Don't worry too much if this seems scary - this is the most complicated part, everything after this will be easier...

The preamble

In my structure, I set up different files for the individual chapters and an overarching thesis.tex file that combines them all. To make everything neat and tidy, I have one extra file that contains the style that both the chapter file and the thesis file rely on. All these files are in the "text" folder.

The thesis.tex file begins like this:

\documentclass[12pt, oneside]{scrbook}






This part in the beginning of a Latex file (everything before \begin{document}) is called the "Preamble". Here, you load the necessary packages, set the necessary parameters and so on. We are using the COMA script book layout, as it is a bit more adapted to European styles and makes some things a little easier, and we are telling it to use 12pt fonts and a one-sided layout. If you are allowed to print your thesis doublesided, leave this setting out - it will look nicer on doublesided paper without the parameter.

We then tell it to use biblatex, the programme that generates our bibliography, and we point it to the OSCOLA package by Paul Stanley. The defaults are perfectly fine, all we tell it here is to reset the citations at the beginning of each chapter. This means that if a reference has already been in a previous chapter, it will be cited in full and not as "Fudd (n 33)". You can use quite a few more settings here, and all possible settings are well documented.

The csquotes package sets the British style for quotation marks, and the setspace package allows us to use the \doublespace command that sets all following text to double spacing. The commands that follow tell Latex how the chapters should be numbered, contrary to the more natural science like defaults (1., 1.3, 1.3.5 and so on). In these settings, sections should begin with capital Roman numbering (I, II, III, IV), subsections with Arabic numbering (1, 2, 3, 4) and subsubsections should be numbered with small letters (a, b, c, d). Feel free to change this however you want.

Finally, the \addbibresource points to the bibliography file that we will set up later.

At the moment, you don't need to worry too much - the settings should be fine for most usecases. If you want to fine tune these settings later to adapt the thesis to your institution's requirements, you will probably have to do this here. I, for example, had to add these lines to adjust the page margins:


This loads the "geometry" package and gives it the settings - the margins in mm. Pretty straight forward, but only needed if your University is particular with this.

You could also change the font here. The default Latex font is called "Computer Modern" and is a very well designed font, but if you would like to change it, you can easily do that by adding a line like \usepackage{baskervald} for Baskerville or, if you have to, \usepackage{times} for the most boring font in the world, Times New Roman. For a more modern look, you could try a sans serif font like Helvetica, but you would have to switch the font family to sans serif as well:


The title page

In any case, you will need to continue with the document after this. First, you start with the line \begin{document}, then you set up your title page. Obviously, you will change this quite a bit according to your taste - this is only a suggestion:


        \huge{Rabbit Season? Duck Season!}


        \large{The Evolution of British Hunting Laws in the 19th Century}


        Bugs Bunny


        Submitted for the Degree of Doctor of Philosophy
        \\at Acme University
        \\June 2015

The frontmatter

After this, you start with the "frontmatter" part, which simply tells Latex to use lower case roman letters for the page numbers and to reset the page counter for the mainmatter that follows.



%    \input{abstract/abstract}



You will have noticed the many \ characters so far, and maybe also the % character. Basically, everything that you write after \begin{document} will be in the final document, unless it begins with a \, which tells Latex that a command will follow, or if it begins with %, which indicates a comment that will not turn up in the final document. Once you wrote your abstract and your acknowledgments, all you need to do is to remove the percentage sign, and they will be in your document.

The abstract is in a "quotation" environment, similar to the titlepage being in a "center" environment. What quotation means is that the abstract is slightly indented, which is what it should be. You can use the same way of writing for a longer quotation as well (according to OSCOLA, everything over three lines long).

\addchap creates a chapter headline both in the text and in the table of contents. Contrary to the \chapter command below, the chapter will not be numbered. The \input command shows some of the magic of Latex: instead of having to squeeze all text into one file, you can simply "input" other files, which makes editing much easier. The filename you want to include is in the curly brackets - in these cases a file called abstract.tex in the folder "abstract" and a file named "acknowledgments.tex" in the folder "acknowledgements".

\tableofcontents is pretty straight forward - this will generate a nice table of contents.

The actual content

Now you need to add your chapters. To make my life easier with having separate scripts to generate chapters on their own and the thesis as a whole, I wrote some slightly overengineered scripts, so that I only have to change a chapter heading once instead of having to have separate files for the different chapters. Therefore, I use placeholders (chaptertitle_1) for the chapter titles here:




% add all other chapters in a similar way
% ...



The \doublespacing sets the distance between the lines. If you are not required to leave that much space, \onehalfspacing might be enough.

And that's basically it... Of course, we should get into the habit of using version control as often as possible:

git add .
git commit -m "Wrote main thesis.tex file"

In the next part, we will set up a file for generating a PDF from an individual chapter.