Aaron Lauterer

# Biblatex - Customizing citations

Recently I had a friend who needs to write essays on a frequent basis for their studies. After hearing how they were struggling with Microsoft Word in combination with the citation style mandated by their university department, I suggested the use of LaTEX.

So one evening we sat together and created a template for her to use which would fit these requirements. After a lot of searching in LaTEX forums and the Tex part of stackexchange.com, we managed to get the citation style the way needed.

This blog posts documents on what we needed to change. Mainly for myself to avoid going down the same rabid hole of stackexchange and forum threads again in the future.

Quite a few commands and fields of BibLaTEX are overwritten in this example. I can recommend the BibLaTEX documentation to read detailed descriptions what these commands and fields are.

Let´s get started with a minimal working example (MWE).

\documentclass{article}
\usepackage[
style=authoryear,
backend=biber,
useprefix=true
]{biblatex}

\begin{filecontents}{cites.bib}
@InBook{einstein,
author =       "Albert Einstein",
title =        "{Mein Weltbild}",
publisher =    "Wisdom Library",
pages =        "110 - 112",
year =         "1935",
}
\end{filecontents}

\begin{document}
Let's have some citation here \parencite[111]{einstein}.

\printbibliography
\end{document}


After running the following commands,

pdflatex -synctex=1 -interaction=nonstopmode sample.tex
biber sample
pdflatex -synctex=1 -interaction=nonstopmode sample.tex


the resulting PDF file looks like this:

There are a few things about the default authoryear style that needed to be changed. The first is how the page number in the citation within the text is presented. Currently this is (Einstein 1935, p. 111). The way it should look is (Einstein 1935: 111).

Adding the following lines will change this.

\renewcommand*{\postnotedelim}{\addcolon\space}
\DeclareFieldFormat{postnote}{#1}
\DeclareFieldFormat{multipostnote}{#1}


The first line changes the delimiter from the comma to a colon with a space. The second two lines change the template and make it place only what we put in the [] brackets of the citation.

Now only the bibliography needs to be adapted. Currently, it looks like this:

Einstein, Albert (1935). “Mein Weltbild”. In: Wisdom Library, pp. 110–112.

What we needed it to be was:

Einstein, Albert (1935): "Mein Weltbild", In: Wisdom Library, pp. 110-112.

Note the colon after the author year part and the comma instead of a dot as separator. This can be achieved by adding the following lines:

\renewcommand{\newunitpunct}{\addcomma\space}


The first line overwrites which delimiter is used while the second line overwrites the delimiter which is placed after the authors name and year.

The final result now look like this:

The final MWE:

\documentclass{article}
\usepackage[
style=authoryear,
backend=biber,
useprefix=true
]{biblatex}

\begin{filecontents}{cites.bib}
@InBook{einstein,
author =       "Albert Einstein",
title =        "{Mein Weltbild}",
publisher =    "Wisdom Library",
pages =        "110 - 112",
year =         "1935",
}
\end{filecontents}