To see our video based on this blog post click here.

For years LaTeX users have been using BibTeX along with multiple additional packages such as natbib to write bibliographies. However now there’s a new option, biblatex. It’s designed to give you many more options to easily configure your bibliographies/citations. Conveniently existing ‘.bib’ files are unlikely to need much altering to work with biblatex.

Unfortunately there isn’t much useful information available online other than the extensive documentation which you can access here. But in case you don’t fancy trawling through all of its 253 pages, here are a few things to get you started.

Basic Commands and Styles

Firstly the commands you use in the tex file to add a bibliography into the document are quite different. In the pre-amble you need to use the following code:

\usepackage{biblatex}
\addbibresource{}

The first command just loads up the biblatex package. The second is used to specify which bib files you want to use. You simply enter the file name in the curly brackets including the ‘.bib’ extension. Then in the body of the document instead of using a \bibliography command to construct the bibliography, you use the \printbibliography command. When using BibTeX you specify the bibliography style by using the \bibliographystyle command. In biblatex we no longer use this command, instead we specify style options by passing more arguments into the \usepackage command. To do this we enter ‘style=’ followed by a style name into square brackets immediately before the curly brackets. For example:

\usepackage[style=numeric]{biblatex}

Alternatively if you want to declare one style for the citations and a different style for the bibliography, you use the words ‘citestyle’ and ‘bibstyle’. Here’s an example:

\usepackage[citestyle=alphabetic,bibstyle=authortitle]{biblatex}

Before moving on I will quickly show you what some of these styles look like for both the citations and the actual bibliography entry. However you can see pages 61-65 of the documentation for a full list of styles.

The numeric style:

numeric

The alphabetic style:

alphabetic

The reading style:

reading

The authoryear style:

authoryear

Another argument you can give the \usepackage command is the sorting option. For example:

\usepackage[style=authoryear,sorting=ynt]{biblatex}

This would use the author-year style and then sort the bibliography entries by year, name, title. Here’s a list of some of the different sorting options available:

nty - Sorts entries by name, title, year.

nyt - Sorts entries by name, year, title.

nyvt - Sorts entries by name, year, volume, title.

anyt - Sorts entries by alphabetic label, name, year, title.

anyvt - Sorts entries by alphabetic label, name, year, volume, title.

ynt - Sorts entries by year, name, title.

ydnt - Sorts entries by year (descending order), name, title.

none - No sorting. Entries appear in the order they appear in the text.

If you don’t specify an order the default is nty.

Citation Commands

The citation commands have also been overhauled in biblatex. These more intelligent commands give you the option of adding a ‘prenote’ and ‘postnote’ in as arguments. A ‘prenote’ is a word or phrase like ‘see’ that is inserted at the start of the citation. A ‘postnote’ is text you want inserted at the end of the citation. To add these notes in you uses two sets of square brackets in the citation command. Here’s an example:

\cite[see][page 12]{latexcompanion}

In this example we’ve already loaded the alphabetic style and ‘latexcompanion’ is just the citation key. This is what the citation would look like in the text:

example citation

If you only open one set of square brackets it will assume the contents of the brackets is a postnote, so if you only want a prenote make sure you still open the second set of square brackets and then just leave it empty.

There are also a number of different citation commands available for you to use. Here are some of the standard ones:

\cite - the most basic one. Prints without any brackets except when using the alphabetic or numeric style when it uses square brackets.

\parencite - prints citations in parentheses except when using the alphabetic or numeric style when it uses square brackets.

\footcite - puts the citation in a footnote.

Subdividing Bibliographies

One of the nice things about biblatex is that you can subdivide bibliographies according to source type. Here’s an example of subdividing by source type:

\printbibheading
\printbibliography[type=book,heading=subbibliography,title={Book Sources}]
\printbibliography[nottype=book,heading=subbibliography,title={Other Sources}]

In this example we are subdividing the bibliography into two sections, one for sources that are books and one for sources that aren’t. Here’s an example output:

example of splitting by types

Another way you can subdivide bibliographies is using a keyword filter. To do this you need to add a ‘keywords’ field into the entries in your bib file. E.g.

@article{key,
	keywords = {keywordA,keywordB,keywordC}

Here’s an example of how you’d then subdivide by keyword:

\printbibheading
\printbibliography[keyword=major,heading=subbibliography,title={Major Sources}]
\printbibliography[keyword=minor,heading=subbibliography,title={Minor Sources}]

And the corresponding output:

example of keyword filter

It looks like one day soon BibTeX will be nothing but a piece of LaTeX history! I hope this has been helpful in getting you started with biblatex.

Posted by Josh Cassidy on 31 Jul 2013