Writing a PhD Thesis in LaTeX (part 2)

One of my most popular posts is Writing a PhD Thesis in LaTeX. I wrote that post at the start of my long journey through writing up land and I thought it would be nice of me to share some of the things I have learned about LaTeX during this journey! This also includes an updated version of my thesis template which you can find at the end of this entry. Please read the above mentioned post first ūüôā

What document class you should really use

Most people I know write their thesis using the report class of latex. The class of your document is the first thing you define in your code e.g.

\documentclass[onecolumn,a4paper,12pt, twoside, openright]{report}

this class works just fine, I have written my thesis as a report as well. However, if you like to have more options and, like me, love layouting and making things look really pretty, there are better choices such as the book or memoir classes. These two classes are slightly different in the way you have to structure your documents but it might be well worth it. There are many templates out there for these classes as well. In addition there are the koma script classes which are based on the standard classes but are easier to configurate. In hindsight I would have written my thesis as a memoir, mainly because then it could have looked like a proper book!

Useful things/workarounds

Undefined characters

One of the things that costs you the most time and can get really annoying is when you have characters in your bibliography that are not defined. That can be simple things like æ in a nordic name or space between words that is not a space. The following code works tells you which character it is so you can define it as you wish. Without this bit of code you get a very erratic error message that does not help you at all to figure out what is wrong.

\usepackage{stringenc}
\usepackage{pdfescape}
\makeatletter
\renewcommand*{\UTFviii@defined}[1]{%
\ifx#1\relax
\begingroup
% Remove prefix “\u8:”
\def\x##1:{}%
% Extract Unicode char from command name
% (utf8.def does not support surrogates)
\edef\x{\expandafter\x\string#1}%
\StringEncodingConvert\x\x{utf8}{utf16be}% convert to UTF-16BE
% Hexadecimal representation
\EdefEscapeHex\x\x
% Enhanced error message
\PackageError{inputenc}{Unicode\space char\space \string#1\space
(U+\x)\MessageBreak
not\space set\space up\space
for\space use\space with\space LaTeX}\@eha
\endgroup
\else\expandafter
#1%
\fi
}
\makeatother

You can then define the unknown unicode character with

\DeclareUnicodeCharacter{OutputFromAboveCode}{YourDefinition}

Todonotes

Another very useful thing is the todonotes package. This enables you to add notes to the side of you PDF which is handy. (Do not forget to disable this package before printing the final version of your thesis….).

\usepackage[draft, textwidth=3cm, color=green!40!white]{todonotes}

Keep packages updated

If you add new packages as you find them useful, make sure your old packages are up to date. Often other packages rely on the newest version of packages you already installed ages ago. You can set you latex distribution (e.g. Miktex or texlive) to update periodically which helps!

Final template (report class)

My final template gives you this look, it is for two-sided printing which is now allowed for the University of Edinburgh:

 

Feel free to use it, you can download it here. I might (maybe, eventually) make a template for a memoir class for my final copy of my thesis. If I do, then I will share that template as well!

 

 

Advertisements

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