kks32 / phd-thesis-template

A LaTeX / XeLaTeX / LuaLaTeX PhD thesis template for Cambridge University Engineering Department (CUED)
http://www-h.eng.cam.ac.uk/help/tpl/textprocessing/ThesisStyle/
MIT License
827 stars 398 forks source link
cambridge latex latex-template lualatex phd-thesis-template xelatex

CUED PhD thesis template

Join the chat at https://gitter.im/kks32/phd-thesis-template

A LaTeX / XeLaTeX / LuaLaTeX PhD thesis template for Cambridge University Engineering Department.

Build Status License MIT Version

Author(s)


Features


Building your thesis - XeLaTeX

Using latexmk (Unix/Linux/Windows)

This template supports XeLaTeX compilation chain. To generate PDF run

latexmk -xelatex thesis.tex
makeindex thesis.nlo -s nomencl.ist -o thesis.nls
latexmk -xelatex -g thesis.tex

Building your thesis - LuaLaTeX

Using latexmk (Unix/Linux/Windows)

This template supports LuaLaTeX compilation chain. To generate PDF run

latexmk -pdflatex=lualatex -pdf thesis.tex

Building your thesis - LaTeX / PDFLaTeX

Using latexmk (Unix/Linux/Windows)

This template supports latexmk. To generate DVI, PS and PDF run

latexmk -dvi -ps -pdf thesis.tex

Using the make file (Unix/Linux)

The template supports PDF, DVI and PS formats. All three formats can be generated with the provided Makefile.

To build the PDF version of your thesis, run:

make

This build procedure uses pdflatex with bibtex and will produce thesis.pdf. To use pdflatex with biblatex, you should run:

make BIB_STRATEGY=biblatex

To use XeLaTeX, you should run:

make BUILD_STRATEGY=xelatex

or with biblatex

make BUILD_STRATEGY=xelatex BIB_STRATEGY=biblatex

To use LuaLaTeX, you should run:

make BUILD_STRATEGY=lualatex

or with biblatex

make BUILD_STRATEGY=lualatex BIB_STRATEGY=biblatex

To produce DVI and PS versions of your document, you should run:

make BUILD_STRATEGY=latex

This will use the latex command to build the document and will produce thesis.dvi, thesis.ps and thesis.pdf documents. You will need psutils installed

Clean unwanted files

To clean unwanted clutter (all LaTeX auto-generated files), run:

make clean

Note: the Makefile itself is take from and maintained at here.

Shell script for PDFLaTeX (Unix/Linux)

Usage: sh ./compile-thesis.sh [OPTIONS] [filename]

[option] compile: Compiles the PhD Thesis

[option] clean: removes temporary files - no filename required

Using the batch file on Windows OS (PDFLaTeX)


Usage details

Thesis information such as title, author, year, degree, etc., and other meta-data can be modified in thesis-info.tex

Class options

The class file, PhDThesisPSnPDF, is based on the standard book class

It supports the following custom options in the documentclass in thesis.tex:

(Usage \documentclass[a4paper,11pt,print]{PhDThesisPSnPDF})

Title page

The front page (title page) resizes to fit your title length. You can modify the options in thesis-info.tex.

If \college is defined, the bottom of the title page will look like this:

    King's College                                                   2014

If \college is undefined or blank, the degreedate will be centered.

                                    2014

The template offers support to having both the college and university crests or just one of the crests.

Abstract separate

Chapter mode

Draft

draft adds a watermark draft text with timestamp and version number at the top or the bottom of the page. Pagewise line numbering is added on every page. draft settings can be tweaked in the preamble.tex.

Choosing the fonts

PhDThesisPSnPDF currently supports three fonts Times, Fourier and Latin Modern (default).

Choosing the bibliography style

PhDThesisPSnPDF currently supports two styles authoryear and numbered (default). Citation style has to be set. You can also specify custombib style and customise the bibliography.

Choosing the page style

PhDThesisPSnPDF defines 3 different page styles (header and footer). The following definition is for twoside layout. To choose a page style, include it in the documentclass options: \documentclass[PageStyleI]{PhDThesisPSnPDF}. Alternatively, page style can be changed by adding \pagestyle{PageStyleI} or \pagestyle{PageStyleII} in thesis.tex. Note: Using \pagestyle command will override documentclass options when used globally.

Changing the visual style of chapter headings

The visual style of chapter headings can be modified using the titlesec package. Edit the following lines in the preamble.tex file.

    \RequirePackage{titlesec}
    \newcommand{\PreContentTitleFormat}{\titleformat{\chapter}[display]{\scshape\Large}
    {\Large\filleft{\chaptertitlename} \Huge\thechapter}
    {1ex}{}
    [\vspace{1ex}\titlerule]}
    \newcommand{\ContentTitleFormat}{\titleformat{\chapter}[display]{\scshape\huge}
    {\Large\filleft{\chaptertitlename} \Huge\thechapter}{1ex}
    {\titlerule\vspace{1ex}\filright}
    [\vspace{1ex}\titlerule]}
    \newcommand{\PostContentTitleFormat}{\PreContentTitleFormat}
    \PreContentTitleFormat

Custom settings

Nomenclature definition

Alternatively, you can use the compile-thesis-windows.bat file or run make on Unix / Linux / MacOS

To-do Notes

To include custom to-do notes in your pdf document use \mynote{Hey! I have a note} anywhere in your chapters. To activate this feature, you need to uncomment the following lines in preamble.tex. To-do notes will be available only in the draft or draftclassic and not in the final thesis.

\ifsetDraft
    \usepackage[colorinlistoftodos]{todonotes}
        \newcommand{\mynote}[1]
        {\todo[author=kks32,size=\small,inline,color=green!40]{#1}}
\else
    \newcommand{\mynote}[1]{}
    \newcommand{\listoftodos}{}
\fi

Git hooks

You rarely want to commit changes to your TeX files which are not reflected in the PDF included in the repo. You can automate this process, among other things, with a git hook. Install the hook with make hooks (or see how to do it in ./hooks/install.sh). Now every time you commit, if any files affecting your build have changed in this commit and those changes are more recent than the last modification of thesis.pdf, the default make target will be run and changes to thesis.pdf will be git added.

Currently, changes to any tex/pdf/eps/png/cls files are picked up. This can be changed in ./hooks/pre-commit.

Skip the hook with git commit --no-verify.

bash-only.

General guidelines

Why is it important to follow good practices and not get killed by a Velociraptor ;)


Frequently Asked Questions

Q1: Where can I find the thesis formatting guidelines this class is based on?

https://www.admin.cam.ac.uk/students/studentregistry/exams/submission/phd/format.html

Q2: Where can I find newer versions of the University of Cambridge crest/logos?

The university updates its crest every now and then. You can find up-to-date logos on this page (subject to change without notice).

Download and exchange the new logos with University_Crest.eps and/or University_Crest.pdf. I'll try to keep the crest up to date.

Q3: Where can I find the guidelines to submit my thesis and requirements?

Preparing to submit:

Formatting styles:

Submitting the dissertation

Q4: How can I count the number of words in my thesis?

You can run the following command (Linux/Unix): ps2ascii thesis.pdf | wc -w (eg., result 2713 words)

or pdftotext thesis.pdf | wc thesis.txt -w (eg., result 2690 words)

or texcount -inc *.tex (eg., result 2341 words)

Q5: How do I use a system font (libertine)?

To use a system font (open type) font with XeLaTeX, please select customfont option in the documentclass in thesis.tex. Add the path and font name to the custom font definition in preamble.tex

\ifsetCustomFont
  \setmainfont[
    Path              = ./libertine/opentype/,
    Extension         = .otf,
    UprightFont = LinLibertine_R,
    BoldFont = LinLibertine_RZ, % Regular Semibold
    ItalicFont = LinLibertine_RI,
    BoldItalicFont = LinLibertine_RZI, % Regular Semibold Italic
  ] {libertine}
  \newfontfamily\libertinesystemfont{Linux Libertine O}
\fi

Please use XeLaTeX tool chain with LaTeXmk.

Q6: I found a bug in the template. Where do I report bugs?

You can report issues at our GitHub repository.

You can also mail the developer directly or contact Tim Love, CUED


Troubleshooting warnings

W1:I get the package Fancyhdr Warning: \fancyhead's E option without twoside option is useless on input line # or #. What should I do?

Nothing. The warning is because the twoside option is also defined in the class, although only the oneside option is currently used.

W2: I get the Class PhDThesisPSnPDF Warning: Unknown or non-standard option 'something'. Will see if I can load it from the book class. If you get a warning unused global option(s): something then the option is not supported! on input line #.

You are either trying to use a undefined option or a non-standard option which is in the book class but not defined in the PhD Thesis Template. If it can be used it will be loaded and you will get no further warnings. If not, the option you chose is unavailable.

W3: I get LaTeX Warning: Unused global option(s):[something].

You are trying to load an option that is not supported in the PhDThesisClass and the Book Class. Are you sure you are using the right option? Check your spelling!

W4: I get I'm skipping whatever remains of this command line # of file thesis.aux \@input{Chapter1/chapter1.aux}

If you are generating a separate abstract for your thesis submission, ignore this warning and good luck with your submission. If you are compiling your thesis and see this warning, please remove the option abstract from the document class.

W5: I get blank pages between chapters

This is normal for a book class. Usually, a new chapter in a book always starts on the right hand side, which is why you see a blank page. You can remove the extra blank page by passing openany option to the documentclass. This works for double sided printing. However, if you are printing on a single side, please pass oneside option to the document class.

W6: My references aren't listed in the ordered in which I cite them

This is controlled by the bibliography style. Please use \bibliographystyle{unsrt} in thesis.tex instead of apalike. This applicable only for numerically sorted references.


Known issue(s) / Bugs / Feature requests

ChangeLog

The history of releases can be viewed at ChangeLog


Inspirations/Based on

Acknowlegments