Thesis formatting in Latex

After four years of experimental design, data acquisition and analysis I just finished putting together everything into my PhD thesis. I did not find any templates that really worked for me (although classicthesis looks quite nice), so I put together my own set of random LaTex commands. I’m not a graphics designer but I’m quite happy with the end results – so here are the choices I made and the corresponding LaTex code.

Let’s go!

General setup

I used the memoir class, which gives easier control over page styles, and easily toggles between one- and two-sided print (which I needed for specific graduate school requirements).

% give the inner margin a bit more space for binding into a book
% \usepackage[top=2.4cm, bottom=2.4cm, left=2.9cm, right=1.9cm,marginparwidth=0cm]{geometry}
% for an on-screen pdf, set all to 2.4

\pagenumbering{gobble} % dont start page numbering until I say so
\usepackage{multicol} % for bibliography
\counterwithout{figure}{chapter} % dont number figures across chapters
\counterwithin*{equation}{section} % dont number across chapters
\raggedbottom  % dont force the same page length by increasing space between paragraphs

% items table of contents not bold
\renewcommand*{\cftchapterfont}{\normalfont} % titles not bold

% caption will take over, even in memoir class

% Figure 1. instead of Fig 1.
\renewcommand{\fnum@figure}{Figure \thefigure}

  % make sure each chapter is on the right hand side, and has an empty page before - only matters in twosided print

Footnotes without numbering

I wanted to indicate contributions as a footnote, but without referring to this in the text. If you put this in your preamle,

% footnotes


\blfootnote{This chapter was reprinted under a CC-BY 4.0 license. doi: 10.1038/ncomms14637. \fauxsc{Author contributions:}
Conceptualization, A.E.U. and T.H.D.; Investigation, A.E.U.; Formal Analysis, A.E.U. and A.B.;
Software, data curation and visualization, A.E.U.; Writing, A.E.U. and T.H.D.; Supervision, T.H.D.}

will result in


At the start of some chapters, I included quotes which are called epigraphs. This preamble

\setlength\epigraphrule{0pt} % no line between
\setlength\beforeepigraphskip{1\baselineskip} % space before and after epigraph

with this code

\epigraph{Was there ever in anyone's life span a point free in time, devoid of memory, a night when choice \\was any more than the sum of all the choices gone before? \\ --- \fauxsc{Joan Didion}\small\textup{, Run, River}} 

will result in

Graphics and equations

For math I used the Euler math font, which looks like this.

I chose the Avenir font for the rest of the thesis.

\usepackage{euler} % beautiful math font

% Avenir looks great, have to compile using LuaLatex or XeLaTex
\setmainfont{Avenir} % Also nice: Minion Pro, Open Sans

\usepackage{polyglossia} % to create german environments within LuaLaTex (umlauts etc)

Small caps

I am a great fan of the Avenir font, which did not produce small caps using the normal \textsc command. This bit of code fakes small caps (see the epigraph example for an idea of how this looks).

\newcommand\fauxsc[1]{\fauxschelper#1 \relax\relax}
\def\fauxschelper#1 #2\relax{%
  \if\relax#2\relax\else\ \fauxschelper#2\relax\fi%

Table environment

I define a column type environment for my CV, with a separator line between dates on the left and items on the right.

\usepackage{array, xcolor}
\newcommand\VRule{\color{gray}\vrule width 0.5pt}

Then e.g. this

2013 - 2018&\textbf{PhD}\\
&{Department of Neurophysiology and Pathophysiology, UKE}\\

produces the layout you can see here.

Citations and bibliography using BibLaTex

The settings below mimic the style used by The Journal of Neuroscience. See also below for specific commands that apply only to the bibliography section.

   backend=biber, %instead of bibtex, for own publications list
    style=authoryear-comp, % Author 1999, 2010
    maxcitenames=2,maxbibnames=4, % when does the citation change to et al?
    firstinits=true, % author initials in list
    terseinits=true, % no points between initials
\renewbibmacro{in:}{} % no more "In:" for articles
  \clearlist{language} % don't show "en."
  \clearlist{extra} % clears extra fields such as ISBN nrs

% no comma between last name and initials
\renewcommand*{\bibfont}{\small} % bibliography in smaller font

%-- no "quotes" around titles of chapters/article titles
\DeclareFieldFormat[article, inbook, incollection, inproceedings, misc, thesis, unpublished]{title}{#1}
%-- no punctuation after volume
%-- puts number/issue between brackets
\DeclareFieldFormat[article, inbook, incollection, inproceedings, misc, thesis, unpublished]{number}{\mkbibparens{#1}}
%-- and then for articles directly the pages w/o any "pages" or "pp."
%-- format 16(4):224--225 for articles
% link to the bib file, which I exported from Zotero usign the BetterBibtex package

When reading from screen, turn references (both to citations and labeled figures) grey to indicate that they work as hyperlinks within the document.

% make citations hyperlinks, grey

% hyperlink for \citeauthor as well

% make full author-year into hyperlinks, will be colored grey

This makes citations look like:


See further below for separate commands to format the bibliography section.

This was the preamble, now begin the document itself.

Title page and Table of Contents


% title page


Once the document has started, define the page style using memoir (not sure if this works equally well in the preabmle). See this documentation by Lars Madsen for the ins and outs of page styles in memoir.

% define my own header style - not bold, small caps
% for oneside!topic/comp.text.tex/RSRcSgnqQWk
\aliaspagestyle{chapter}{empty} % no page numbers on the chapter title page
\setlength{\headwidth}{\textwidth} % make sure the companion header extends as far as the text, looks weird otherwise

% only print chapter name on the right side of the document!
\pagenumbering{arabic} % start page numbers here

This creates headers as follows:

Where instead of letting LaTex handle the chapter numbering, I hardcode this manually. \chapter* generates an unnumbered chapter, which by default does not show up in the chaptermark (in the header at the top of the page) or in the TOC, so I do this manually. I liked the vertical line as a separator, which just touches the horizontal line underneath the header.

\chapter*{2.1 $\bigm|$ Pupil-linked arousal is driven by decision uncertainty and alters serial choice bias}
\chaptermark{2.1 $\bigm|$ Pupil-linked arousal is driven by decision uncertainty and alters serial choice bias}
\addcontentsline{toc}{chapter}{2.1 $\bigm|$ Pupil-linked arousal is driven by decision uncertainty and alters serial choice bias}
<span style="font-family: Consolas, Monaco, monospace;">

Chapter specifics

Each chapter went into its own .tex file in the chapters folder, which helped a lot in keeping the overview. In my case:


For each chapter, I made sure I included this to ensure that numbering of figures and equations did not continue (probably possible to do in the preamble but didn’t get that to work).


Moreover, for including supplementary figures at the end of each chapter file I did

\section*{Supplementary Figures}

% add all the supplementary figures

% Set back to normal figure numbering for the next chapter

which will look like this (with both the main and supplementary figure as clickable hyperlinks in grey):



After all chapters, I inserted the bibliography with slightly different formatting rules than the in-text citations, and changed the size and spacing.

\chapter*{5 $\bigm|$ Bibliography}
\addcontentsline{toc}{chapter}{5 $\bigm|$ Bibliography}
\chaptermark{5 $\bigm|$ Bibliography}

\begin{multicols}{2}% two columns
\begin{refcontext}[sorting=nyt] % make sure that bibliography is sorted by last name, year, title

% remove 'and' between 2nd to last and last author in bibliography


which looked like

Add some final pages at the end. That’s it!

% backmatter

That’s it!

You can download the full master tex document, and the first chapter (which is a reprint of this article). Because WordPress does not allow uploading of .tex files, I changed the extension to .odt – make sure to change back to .tex before opening.  Note that I converted the chapter file from Word using Pandoc, so the equation syntax is a bit messier than necessary.

Also, here is a pdf of one thesis chapter to see what the total looks like. I’ll post the whole document after I’ve defended it!

Please note:

  • I use TexShop 3.88 on Mac OS X.
  • Compile using LuaLaTex or XeLaTex (both work afaik), then using BibTex, and again using LuaLaTex/XeLaTex. Some changes (e.g. to hyperlinks and page headers) may only show up after several consecutive compilations.
  • I tried to copy the links to source code into comments. If I forgot somewhere, and you’d like me to add, please let me know in a comment.
  • I’m not a LaTex expert – if you’re stuck, please try these tried-and-tested methods:









5 thoughts on “Thesis formatting in Latex

  1. Wow super nice! I might need this in a few months. Thanks for sharing and good luck with your defense!

    1. You can download the style file and an example chapter, see the links in the final paragraph before ‘please note’. Good luck!

  2. Hi Anne – Excellent post! Thank you for your detailed explanation of the various lines.

    Did you have a terms glossary or acronym in your thesis? If so what is the code you used for that? I’m using glossaries with the glossaries-extra package and have a very large (~2.5″) gap between the top of the page and the glossary title.

    Thanks again!

Leave a Reply

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

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

Facebook photo

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

Connecting to %s