LaTeX Template for Scientific Theses
This template is a general template for scientific theses. Currently, it is the unofficial LaTeX template for Master, Bachelor, Diploma, and Student Theses at following institutions:
- University of Stuttgart, Computer Science
- Paderborn University, Computer Science - to be confirmed.
The template will be extended to support theses from different institutions.
For architectural decision records see docs/adr.
- Characteristics of the template
- Quick start
- Recommended LaTeX environments
- Installation hints for Ubuntu
- Installation hints for Windows
- LaTeX compilation
- FAQ
- Contained Files and Directories
- Resources
- License
Characteristics of the template
- Most recent packages and package configuration based on long-time experience.
lualatex to enable proper typeset ligatures.For older systems, pdflatex is still supported.- Open for contributions.
- latexmk - Reasoning available at https://tex.stackexchange.com/a/249243/9075.
- biblatex+biber instead of plain bibtex, because biblatex fully supports UTF-8 and commands such as
\citeauthor{...}
work out of the box. See also https://tex.stackexchange.com/q/8411/9075. Automatic adjustment of wrong ligatures using the selnolig package- Full Unicode (UTF-8) support
- Optional: Render listings using minted, which provides better output than listings, but requires pygments to be installed.
- Optional: Direct inclusion of PlantUML diagram.s
Even though AuToLaTeX is more powerful than latexmk, it is not included in MiKTeX and therefore it is not used here.
Quick start
- Download
- Go to the development version at https://github.com/latextemplates/scientific-thesis-template/archive/master.zip. Reason: LaTeX packages change so fast over time and we cannot do a release on each change.
- Extract
master.zip
to the directory you want to work. E.g.,c:\users\user\documents\thesis
.
- Start texing
- University of Stuttgart:
- English:
main-english.tex
- German:
main-german.tex
- German advanced usage:
main-minted-german.tex
(see below)
- English:
- Paderborn University:
- Start texing at
main-paderborn-english.tex
ormain-paderborn-german.tex
. - Adapt
logos/UBP-background-picture.pdf
to your needs. It has the format 20cm x 10cm. - Change
!TeX root =
inlatexhints-english.tex
andlatexhints-german.tex
.
- Start texing at
- University of Stuttgart:
Usage at overleaf
See overleaf.
Usage using plain git
We do not recommend to fork this project as a fork denotes that you work on improving the template itself.
Thus, just create a new git repository and populate it using the files provided at source.zip
, which you downloaded at the latest release page.
Recommended LaTeX environments
Offline usage
Grammar and spell checking is available at TeXstudio.
Please download LanguageTool and configure TeXstudio to use it.
Note that it is enough to point to languagetool-server.jar
.
Use JabRef to manage your bibliography.
Quick installation using Chocolatey: choco install texstudio languagetool jabref
.
A comparison to other literature management software is available at https://ultimate-comparisons.github.io/ultimate-reference-management-software-comparison/. See LaTeX Editors/IDEs question on TeX.SX for a complete list of LaTeX editors.
Online usage
overleaf has been tesed by multiple users. It also comes with git support.
Installation hints for Ubuntu
- From Ubuntu 18.10 onwards, the basic version of the template works without issues. Advanced usages such as cool syntax highlighting with minted needs more configuration.
- Ubuntu 16.04 ships biber 2.4, so you have to upgrade your texlive distribution. The easiest way is to uninstall the ubuntu package and use install-tl-ubuntu. Then, you can follow the instructions given at http://tex.stackexchange.com/a/55459/9075 to update your texlive distribution. If you do not want to have an updated installation, but fiddle around with dirty patching your installation, please follow http://tex.stackexchange.com/questions/84624/how-to-upgrade-biblatex-properly.
Always working solution: Use the docker image. This is provides a perfectly configured latex distribution with all required tools.
- Execute
sudo visudo
to edit the sudoers file - Add the line
myusername ALL = (root) NOPASSWD: /usr/bin/docker
. Replacemyusername
accordingly. (Source: https://unix.stackexchange.com/a/13058/18033) - Execute
sudo docker pull danteev/texlive
. This should not ask for any password. Will download approx. 4GB. - Open TeXstudio
- Options > Configure TeXstudio > Commands
- Set “PdfLaTeX” to
docker run --rm -v DIROFTEXDOCUMENT:/home danteev/texlive pdflatex --shell-escape -synctex=1 -interaction=nonstopmode %.tex
, replaceDIROFTEXDOCUMENT
by the directory of your latex document. Example:/home/user/thesis
. - Set “LuaLaTeX” to
docker run --rm -v DIROFTEXDOCUMENT:/home danteev/texlive lualatex --shell-escape -synctex=1 -interaction=nonstopmode %.tex
, replaceDIROFTEXDOCUMENT
by the directory of your latex document. Example:/home/user/thesis
. - Set “Biber” to
docker run --rm -v DIROFTEXDOCUMENT:/home danteev/texlive biber %
, replaceDIROFTEXDOCUMENT
by the directory of your latex document. Example:/home/user/thesis
. - Check if the “docker pull” command from step 3 succeed. If not, wait.
- Try to press the “Compile” (F6) button in TeXstudio.
Installation hints for Windows
Note: The default installation of MiKTeX might ship with incompatible biblatex and biber packages. You have to keep your MiKTeX up to date. In case you followed the linked installation steps, you only have to run “Update MiKTeX”. If you installed MiKTeX other ways, you have to run “Update MiKTeX (Admin)” and “Update MiKTeX” and check in both tools for updates (see http://tex.stackexchange.com/a/108490/9075).
Preparations
- Install chocolatey:
- Open
cmd.exe
as Administartor - Paste and hit Enter
@"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
- Open
- Execute
choco feature enable -n=allowGlobalConfirmation
to get rid off additional installation confirmations. - Execute
choco install texstudio sumatrapdf.install strawberryperl jre8 jabref languagetool
to install necessary tooling. - In case PlantUML should be used, follow the installation instructions at https://koppor.github.io/plantuml/ listed at the “pre-conditions” section.
- For more recommended tooling see https://github.com/koppor/koppors-chocolatey-scripts.
Recommended setup of MiKTeX
- Download the basic installer from http://miktex.org/download
- Start it
- First screen: Read the license conditions and be sure that you really agree.
- Check “I accept the MiKTeX copying conditions”
- Click “Next”
- Second screen: “Shared Installation”: Install MiKTeX for: “Only for:
username
”.- Check first option
- Click “Next”
- Third screen: “Installation Directory”: Install MiKTeX to:
C:\MiKTeX
. This enabled browsing for documentation atC:\MiKTeX29\doc\latex
- Input “C:\MiKTeX” in the input field
- Click “Next”
- Fourth screen: “Settings”: Preferred paper: A4 and install missing packages on the fly.
- First combo box: “A4”
- Second combo box: “Yes”:
- Click “Next”
- Fifth screen: Press “Start”
- Now a window “Executing” appears. It will take about 5 minutes until this is finished.
- At the last screen: Click “Close”
- After the installation:
- Open
cmd.exe
- Execute
refreshenv
to make MiKTeX’s binaries known right after the installation - Execute
mpm --update-db
- Execute
mpm --update
- Execute
mpm --install=tex-gyre
(to resolvefontspec error: "font-not-found"
,\setmainfont{TeX Gyre Termes}
) - Execute
mpm --install=tex-gyre-math
- Execute
mpm --install=cm-super
- Execute
initexmf --update-fndb
(ensure that no other MiKTeX tooling such as the MiKTeX Console is run in parallel - see https://github.com/MiKTeX/miktex/issues/98#issuecomment-375952270) - Execute
initexmf --mklinks --force
- Open
LaTeX compilation
The template is compiled using normal compilation commands. Your LaTeX environment (such as TeXStudio) should take care about the compilation transparently.
If you open main-minted-german.tex
, there will be a warning that the compilation command will be overridden.
Please answer (a) allow for this document
:
At “Build & View”, there will be a question to update to biber.
Please answer (a) allow for this document
:
When the “Package Installation” dialog pops up at TeXStudio, choose your username at “The package will be installed for:” and uncheck “Always show this dialog before installing packages.” If you want to include .svg graphics, inkscape has to be in your path.
Attention! The first compilation will take at least 30 seconds, because there will be some LaTeX packages installed.
Using the command line
For debugging, it might be better to use the command line for latexing.
Use lualatex --shell-escape main-minted-german
to compile the main document.
Run biber main-minted-german
to get the bibliography rendered (execute lualatex
afterwards).
Automatic compilation is also possible:
latexmk main-german
If you want automatic compilation use following command:
latexmk -pvc main-german
This will also open a Sumatra PDF and only works with the supplied configuration.
latexmk configuration
This repository ships a .latexmk
which is read by latexmk.
It is configured for Windows and especially sets Sumatra PDF as default PDF viewer.
You can make this local configuration a global configuration, when you put it at the right place.
If you want to add more packages, configure it there. For instance, for support of makeglossaries see http://tex.stackexchange.com/questions/1226/how-to-make-latexmk-use-makeglossaries.
FAQ
Q: What is the issue with ligatures?
A ligature is the joining of letters to look better. There are rules that there should be no ligatures at “morpheme boundaries”. See english.stackexchange.com for a long discusisson.
Example with correct ligatures:
Example with wrong ligatures:
See ADR-0004 for a discussion on the technical solution possiblities.
Q: There is an output that biber/biblatex too old
See installation hints of how to update them at different systems.
Q: Overleaf complains about missing .sty
files.
Google for the name of the sty
and upload it to overleaf.
As of 2018-02-17, these are:
lccaps.sty
- can be downloaded from https://latextemplates.github.io/stys-for-overleaf/.scientific-thesis-cover.sty
- can be downloaded from https://raw.githubusercontent.com/latextemplates/scientific-thesis-cover/master/scientific-thesis-cover.sty.
Q: MiKTeX complains about missing .sty
files.
Use the MiKTeX console to refresh the package index. Then, automatic installation should work again.
Q: I cannot get minted to run. There is this -shell-escape
warning.
Please ensure that your compiliation command includes -shell-escape
.
E.g., lualatex -shell-escape -synctex=1 main-minted-german.tex
.
When compiling main-minted-german.tex
with TeXStudio, you will see a dialog warning about overriding the comipiliation command.
Just anser “(a) allow for this document” and it will work.
Q: My Paderborn title page is strange. The boxes seem to be located arbitrarily.
Just run pdflatex again.
Q: I get the error ! pdfTeX error (font expansion): auto expansion is only possible with scalable fonts.
Install the cm-super
package using the MiKTeX package manager. Then, run initexmf --mkmaps
on the command line. (Long description: http://tex.stackexchange.com/a/324972/9075)
Q: How do I change the appearance of chapter headings?
Edit preambel/chapterheads.tex
.
Q: How to include Excel charts properly?
- Select the excel chart you want to use.
- Print to PDF with the option “Print Selected Chart”.
- Remove empty space of the created PDF page with
pdfcrop chart.pdf chart_cropped.pdf
(install via MikTex first, if not available; check viapdfcrop --version
). - Use pdfscissors (https://sites.google.com/site/pdfscissors) to crop the borders and title (maybe you have to allow https://sites.google.com in the Java security center in the control panel).
- Include the PDF in LaTex via
\includegraphics{chart_cropped.pdf}
.
Q: Do I need to take special care because of Visual Studio Code?
Please remove the magic comments (% !TeX program ...
) at the top of the main-....tex
file.
Although LaTeX-Workshop supports magic comments, it currently does not work reliably.
Without the magic comments, compilation works.
Q: Do I have to do something special for the final version?
- If you included some version control statements, please remove them. Currently, the template does not support any, but it used to support SVN.
- By using
\largepage
and\shortpage
, single lines at the bottom or at the top of the page can be manually fixed. - Search the PDF for “TODO” or similar things. Remove
\usepackage{todonotes}
inconfig.tex
. - Ensure that you run
lualatex
at least three times and that there are no “undefined references”. - The margins are intended for good screen reading. Do not change them (or do exactly know what you are doing).
Q: I want to use make instead of latexmk
For those, who have cygwin installed or run a linux machine, this template offers a simple LaTeX makefile. It is not as sophisticated as other projects, but does its job.
make
Make targets:
pdf
(default): Generates ausarbeitung.pdfaspell
: Checks all files using aspell.clean
: Removes all temporary files.mrproper
: Cleans up and removes also editor backup files.stand
: Creates a new PDF with the current status of the thesis.view
: Opens the configured viewer6
: Generates a 3x2 postscriptfile using psnup.
Q: Are there any other alternatives to latexmk and make?
- https://github.com/akerbos/ltx2any
- https://github.com/shiblon/latex-makefile
- https://github.com/ransford/pdflatex-makefile
- https://github.com/brotchie/latex-rubber-makefile
- LaTeX-Mk
- See also Recommended build system for latex? and How to properly ‘make’ a latex project?
Q: I want to use minted as its syntax highlighting seems to be better
- Install python and pygments:
choco install python
pip install pygments
- Start with
main-minted-german.tex
- Use
-shell-escape
when texing:lualatex -shell-escape main-minted-german.tex
Q: main-minted-german.tex
does not compile: File `main-minted-german-plantuml.latex' not found. \end{plantuml}
. What can I do?
You did not setup the plantuml package correctly. Please head to https://koppor.github.io/plantuml/ for installation instructions.
Q: Is there any other place to look for further information?
For German users, go to http://texfragen.de/.
Q: I was recommended the Harvard style
This template uses the alphabetic style. That style is explained at the biblatex documentation on page 60:
The alphabetic labels resemble a compact author-year style to some extent, but the way they are employed is similar to a numeric citation scheme. For example, instead of “Jones 1995” this style would use the label “[Jon95]”. “Jones and Williams 1986” would be rendered as “[JW86]”.
We are aware that the University of Stuttgart recommends to use the Hardvard style. However, this style is not common in natural sciences and information science.
Q: How can I reformat my .tex files?
Execute latexindent -l -s -sl -w main-english.tex
Q: How I want to obey the one-sentence-per-line rule.
Execute latexindent -m -l -s -sl -w main-english.tex
.
Attention! This is work in progress and does not always produce best results.
Q: Aren’t there other templates?
Sure. The Hagenberg Thesis Document Collection seems to be the most promising. However, they currently do not support microtype and not the cover of the University of Stuttgart.
We are collecting alternatives at the issue #25 and plan to add a comparison to each other template.
Q: I get Font "LatinModernMath-Regular" not found.
. What can I do?
Error message:
luaotfload | db : Reload initiated (formats: otf,ttf,ttc); reason: Font "LatinModernMath-Regular" not found.
luaotfload | resolve : sequence of 3 lookups yielded nothing appropriate.
! Package fontspec Error: The font "LatinModernMath-Regular" cannot be found.
Install the package lm-math
manually.
Q: I get ! Package fontspec Error: The font "LinuxLibertineO" cannot be found.
. What can I do?
Install the package libertine
manually.
Q: I get ! Package fontspec Error: The font "TeXGyreTermes" cannot be found.
. What can I do?
Install the package tex-gyre
and tex-gyre-math
manually.
Q: I get ! error: (type 1): cannot find encoding file 'ntx-ot1-tlf.enc' for reading
. What can I do?
See https://tex.stackexchange.com/a/240850/9075: Install the packages newpx
and newtxsf
manually.
Q: I get ! TeX capacity exceeded, sorry [main memory size=3000000].
. What can I do?
Follow the steps at https://tex.stackexchange.com/a/548335/9075
Try with following command
pdflatex -shell-escape --extra-mem-top=10000000 --synctex=1 main-german.tex
See https://tex.stackexchange.com/a/124206/9075 for details.
Q: I get Unknown pattern ngerman-x-latest
. What can I do?
On MiKTeX, one can solve it as follows:
- Disable
\RequirePackage[ngerman=ngerman-x-latest]{hyphsubst}
- Compile the document. This way, miktex downloads additional packages. Including
hyphsubst
. - Enable
\RequirePackage[ngerman=ngerman-x-latest]{hyphsubst}
Contained Files and Directories
Directories
- graphics Directory containing the figures. By using LuaLaTex/PDFLaTeX it is possible to use PDFs, JPGs, PNGs, … We recommend to use PDFs to enable smooth scaling.
Files
main-*.tex
- Start file for theses- The files follow the pattern
main-[institution-][feature-][language].tex
, whereinstitution
is empty orpaderborn
feature
is empty orminted
language
isenglish
orgerman
- main-german.tex for German
- main-english.tex for English
- main-paderborn-german.tex for German theses at Paderborn University
- main-paderborn-english.tex for English theses at Paderborn University
- Add text here
- Adjust title etc. here
- The files follow the pattern
- bibliography.bib - Bibliography. biblatex format. Manage it with JabRef.
- acronyms.tex - Abbreviations.
- commands.tex - Example macros
- config.tex - The place to add packages etc.
Following additional files are included, which do not need to be adapted:
- Makefile - The Makefile. Builds on latexmk.
- README.md - minimal file pointing to this documentation.
Resources
- Lutz Hering, Heike Hering: How to Write Technial Reports, Springer, 2010; also available in German Technische Berichte - verständlich gliedern, gut gestalten, überzeugend vortragen. - Highly recommended, because it guides through all aspects of a report (such as a Master Thesis).
- Marcus Deininger et al.: Studienarbeiten - Ein Leitfaden zur Erstellung, Durchführung und Präsentation wissenschaftlicher Abschlussarbeiten am Beispiel Informatik, vdf. - Recommended as guideline for planning and working on the whole thesis.
- Charles Lipson, Cite Right, Second Edition: A Quick Guide to Citation Styles–MLA, APA, Chicago, the Sciences, Professions, and More, Chicago Guides to Writing, Editing, and Publishing, 2011. - Recommended in case you are unsure about how to correctly cite something.
License
The license of this work is CC0, which corresponds to “public domain”.
Exceptions
The images in logos
are subject to other copyright from other parties:
UPB_LOGO_GB_RGB_15.pdf
andUPB_Logo_RGB_D_2012.pdf
are copyright Paderborn University. Refer to https://www.uni-paderborn.de/universitaet/marketing/design-vorgaben-templates/ for proper use.UBP-background-picture.*
are demonstration files generated using an educational edition of Microsoft Office. They can be used in a scientific context only. For commercial use, please change them.UBP-background-picture.pdf
is generated out ofUBP-background-picture.pptx
and is free for personal use only.