Bibliographies with LaTeX using Biblatex

For decades people have used bibtex to produce bibliographies, used in combination with several packages. Now the biblatex package is beginning to replace these. It

• has newer types of items - e.g. @online for online documents
• has newer fields - e.g. eprinttype, url, urldate
• is more easily controllable
• makes it easy to use multiple bibliographies, selective bibliographies, etc.

The package isn't quite official yet, so brief installation notes are included below. The biblatex documentation is very extensive. This document quotes freely from it but also refers to bibtex because more people know about it and the documentation is still useful.

Installation

biblatex might not yet be part of standard LaTeX distributions. If (from the command line) you type

   kpsewhich biblatex.sty


and don't get a filename as a reply, you don't have biblatex installed. You can download from the usual CTAN sites. Once you've done that you'll need to install all the files under the latex and bibtex subdirectories. Put them in your working directory if you don't have write-access to the system directory.

Overview

Initially, using the biblatex package is only slightly different from using traditional BibTeX styles and related packages. You need to have a file containing information about the items you're citing. Copy the following simple example into a file called refs.bib

@BOOK
{KandR,
AUTHOR  = "Kernighan, Brian W. and Ritchie, Dennis M.",
TITLE   = "{The C Programming Language Second Edition}",
PUBLISHER = "Prentice-Hall, Inc.",
YEAR = 1988
}


The @BOOK bit shows that you're describing a book (there are many other types of entries you can have). The first field (in this case KandR) is the tag used when you \cite the item. The other fields are some of the many available. Only a few are compulsory.

Then you need to create a LaTeX file. Here's a minimal example. Let's call it test1.tex

\documentclass{article}
\usepackage{biblatex}
\bibliography{refs}
\begin{document}
Hello\cite{KandR}
\printbibliography
\end{document}


With traditional BibTeX, the \bibliography command served two purposes - it controlled where the bibliography would appear in the text and also specified the file containing the bibliography information. With biblatex however, the \bibliography command only reads the file in and needs to be before \begin{document}; the position of the \printbibliography command controls where the bibliography appears.

Next the file needs to be run through latex. If you want to produce a PDF file you might do this by typing

   pdflatex test1.tex


You'll get warning messages about an undefined citation and empty bibliography. That's normal the first time you process a document. Then run

   bibtex test1.aux


This shouldn't produce any error messages. Then do

   pdflatex test1.tex


again. The resulting PDF file should look like this.

After that, maybe all you'll need to do is add further entries to the database file and cite them in your latex file. When you add to the database file you'll need to re-run bibtex, otherwise you'll only need to run latex. If you need to re-run a command you'll usually be told.

Behind the scenes

If things go wrong you may need to know about the extra files produced. When you run latex, requests for citations will be put into the *.aux file that latex normally produces. When bibtex processes that file, it extracts from the database file the required information and puts it into a *.bbl file (in this case test1.bbl). When latex is run again it looks in test1.bbl to get the information required for the citations and the bibliography. Some other files might be produced, especially if you're producing multiple bibliographies, but you probably don't need to worry about them.

Options

The format of both references and citations required by your readers may not match biblatex's default. To show some of the options, first add another entry to the database file so that it reads

@BOOK
{KandR,
AUTHOR  = "Kernighan, Brian W. and Ritchie, Dennis M.",
TITLE   = "{The C Programming Language Second Edition}",
PUBLISHER = "Prentice-Hall, Inc.",
YEAR = 1988
}
@ONLINE
{CUEDCplusplus,
AUTHOR  = "Love, T.P.",
TITLE   = "{CUED C++}",
URL = "http://www-h.eng.cam.ac.uk/help/tpl/languages/C++.html",
URLYEAR = 2010,
PRESORT="aa"
}


And change test1.tex so that it contains

\documentclass{article}
\usepackage[style=authoryear,citestyle=alphabetic,sorting=nty]{biblatex}
\defbibnote{books}{Only books!}
\bibliography{refs}
\begin{document}
Hello\cite{KandR} and Goodbye\cite{CUEDCplusplus}
\printbibliography[prenote=books, type=book]
\printbibliography
\end{document}


This isn't a very sensible combination of features, but shows some common configuration changes. If you run latex, bibtex and latex again you should end up with

Several things have changed

• 2 bibliographies have been printed. The first has a "prenote" defined near the top of the file and only includes books.
• The format of the citations has changed (from [1] to KR88 for example).
• The format of items in the bibliography has changed (the year's in a different place).
• The usual sorting order has been changed. sorting=nty means that sorting is done by name, title then year. In this example though, the online item has a "PRESORT" field which overrides other considerations (useful in emergencies). By default, entries have a "PRESORT" field of "mm".

Further details on these options and many others is in the biblatex documentation

• © Cambridge University, Engineering Department, Trumpington Street, Cambridge CB2 1PZ, UK (map)
Tel: +44 1223 332600, Fax: +44 1223 332662
Contact: helpdesk