Bibliography style
The 'thesis' template defaults to using the
biblatex
package (ieee
style) and the Biber engine to
generate bibliographies and citations.
The following resources may help with the biblatex configuration:
- Biblatex bibliography styles
- Biblatex citation styles
- Biblatex manual
- Wikibook: Bibliographies with biblatex and biber
- LaTeX/Bibliography Management
To change the bibliography style, just redefine the style in the document header:
\documentclass[language=finnish,mainfont=none,bibstyle=ieee]{utuftthesis}
...
\end{document}
Preview of the default (ieee
) bibliography style:
Citations:
For example, to use the alphabetic
style, replace the code with:
\documentclass[language=finnish,mainfont=none,bibstyle=alphabetic]{utuftthesis}
...
\end{document}
Preview of the alphabetic
bibliography style:
Citations:
For more advanced configuration, the relevant biblatex configuration entries
can be found in the
utuftthesis.cls
file:
%% bibliography, new engine
\ifdefstring{\utuftthesis@biburlbreak}{ragged}{
\RequirePackage[style=\utuftthesis@bibstyle,backend=biber,block=ragged]{biblatex}
}
{
\RequirePackage[style=\utuftthesis@bibstyle,backend=biber]{biblatex}
}
Two-side document
Preliminary support for two-side documents was added in 2023/08/02. The two-side
document reverses the left and right margins for even pages. To enable this mode,
add the sides=twoside
key-val pair to the document class configuration line:
\documentclass[language=finnish,sides=twoside]{utuftthesis}
Please note that the two-side document still has issues switching between even
and odd page formatting when switching between sections (e.g. TOC, main document,
bibliography, appendices). You can manually add empty pages with the \newpage
command to the end of each section when needed.
This suggested solution can also be used to automatically add the necessary empty pages.
Extra packages
The LaTeX ecosystem provides a variety of extra packages that are not available in the basic distribution of 'thesis'. Should a required package be missing, see http://www.ctan.org/. Consultation of the manuals of these packages is strongly encouraged.
The TexLive distribution used by the 'thesis' projects provides a package manager of its own. The recommended approach for installing these packages is to either use a local TeX installation or to create a custom Docker image, then to configure the CI/CD script to use this new image.
❗ Installing packages in the GitLab CI/CD script is not recommended as the script is run after after each commit. This can generates extra traffic to CTAN servers and the repositories may even block access to fight the bandwidth costs. ❗
Local installation
Assuming a local LaTeX distribution has been set up, the tlmgr
command
can be used to install more packages:
$ tlmgr update --self
$ tlmgr install MYPACKAGE1 MYPACKAGE2
If the document will be recompiled multiple times and/or one needs to experiment with new packages, the local installation is probably the most efficient approach.
R and LaTeX
Knitr can be used for embedding R code in TeX files. Knitr supports caching of the generated figures to improve performance. A previously installed R distribution is required to use Knitr.
One can begin with this simple example.Rnw
:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\begin{document}
You can type R commands in your \LaTeX{} document and they will be
properly run and the output printed in the document.
<<>>=
X = 2:10
summary(X)
@
\end{document}
First, process the embedded R code with R & Knitr:
$ Rscript -e "library(knitr); knit('example.Rnw')"
The script generates all the figures, and produces a normal .tex
file with the textual content pre-rendered inline:
...
\begin{document}
You can type R commands in your \LaTeX{} document and they will be
properly run and the output printed in the document.
\begin{knitrout}
\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}\begin{kframe}
\begin{alltt}
\hlstd{X} \hlkwb{=} \hlnum{2}\hlopt{:}\hlnum{10}
\hlkwd{summary}\hlstd{(X)}
\end{alltt}
\begin{verbatim}
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 2 4 6 6 8 10
\end{verbatim}
\end{kframe}
\end{knitrout}
\end{document}
The generated file can be compiled with LaTeX:
$ latexmk -pdf -shell-escape example.tex
- https://www.tidyverse.org/
- https://ggplot2.tidyverse.org/
- https://yihui.name/knitr/
- https://joshldavis.com/2014/04/12/beginners-tutorial-for-knitr/
- https://gitlab.utu.fi/jmjmak/knitr-examples