Skip to content

EBI-predocs/latex-thesis

Repository files navigation

Thesis writing in LaTeX

LaTeX general

  • Install TeXLive. It’s the One True™ TeX distribution system.

  • Need help? texdoc <packagename> on the command line.

    • At the very least skim the documentation of every package you’re using, to look for gotchas and interesting options
  • Still need help? Google, http://tex.stackexchange.com

  • If you are Jon Snow (you know nothing): texdoc lshort – “The not so short introduction to LaTeX”

  • Learn the basics of typography: LaTeX supports you but it won’t coddle you

    • Use typographically correct punctuation and spacing
    • English quotes: “…” (or ``…'')
    • Need a minus sign: math mode!
    • Use wide margins, narrow text
      • But do use the margins when it makes sense
    • By all that’s holy: USE SINGLE LINE SPACING.
    • Correctly typeset gene names, protein names, species names (italic, straight, italic) …
  • Don’t use outdated packages

  • The golden rule of TeX: Use semantic markup: write macros to encapsulate style into semantically meaningful units

  • LaTeX is unforgiving, but not forthcoming with error messages. Use nag to get better warnings (see example template for usage).

  • \figure and \table are floating environments. They float. That is their purpose. If you really want figures with a fixed position (but consider this carefully), don’t use \figure, and use \captionof to create a non-floating caption.

  • Use latexmk to build your document

    • It automatically runs the required auxiliary programs (bibtex, biber …), and the necessary number of times
    • Want live preview? latexmk -pvc
    • Highly configurable, but works well out of the box
  • On OS X? Use Skim as the document viewer instead of Preview.app.

  • Use XeLaTeX/LuaTeX. Do not use pdfLaTeX

    • pdfLaTeX is old and revered – let it rest in peace
    • In particular, no support for UTF-8 (yes: not even with auxiliary packages)
    • No great support for non-8-bit fonts
    • latexmk -xetex
  • Want to change margins/metrics? Do not muck around with lengths, use geometry

  • Don’t use the standard document classes, use the replacements from KOMA-Script

    • Don’t be put off by the fact that KOMA’s \maketitle creates lots of pages. This is intentional – read the relevant section in the documentation.
  • Some bibliography managers allow exporting BibTeX references with custom cite keys (usually of the format Author:Year) – this makes usage with LaTeX vastly easier

  • For numbers and units in text, use siunitx. I recommend not using naked numbers in text at all (always use \num{x} instead).

  • todonotes for “TO DO”s. However, this interacts badly with classicthesis.

  • Avoid writing non-simple macros: programming in LaTeX is a nightmare. Use existing packages instead.

Thesis writing

  • Use Git from the start, commit changes religiously and have a look at gitinfo2 (helpful for the revision phase)

  • Organisation

    • One file per chapter
      • Use logical names, not chapter1.tex etc so the otder can be changed effortlessly
    • Have an outline handy (separate document)
    • Configuration separate from main document
  • Use classicthesis in combination with KOMA’s scrbook.

    • Based on best practices of print design and typography
    • No, its margins are not too wide
  • University of Cambridge templates exist. However, they are a typographer’s nightmare (cf. line spacing, text width) and extremely convoluted, thus hard to customise

Example document

The example file thesis.tex contains the outline for a thesis source document. Each chapter has its own file and is included via \input. Configuration and custom macros reside in config.tex. This is also where packages should be loaded.

.latexmkrc is the configuration for latexmk. At the moment it is empty except for a commented-out line which would cause it to pass the -shell-escape option to xelatex. This option is required by certain packages, such as minted.

Finally, the Makefile enables compilation via simple make verbs. To recompile the document, use

make
# or
make thesis

To trigger continuous background compilation for interactive preview, use

make preview

Requirements

The example file requires the following fonts to be available for successful compilation:

Download the fonts (for the last two, go on the website and click the “download”/arrow button) and install them on your system.

And finally

Need inspiration? Take a look here:

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •