Skip to Content »

Michi’s blog » BibLaTeX — why haven’t I used this earlier!?

 BibLaTeX — why haven’t I used this earlier!?

  • March 7th, 2012
  • 5:01 pm

As any reader of this (now rather occasional) blog might have guessed by now, I do quite a lot of writing in LaTeX. It comes with the territory — I do mathematics research, so I write in LaTeX. I do quite a bit of research, so I spend a lot of time writing up my results.

And I care about the tools I use. I care deeply about the way my citations come out, and I have significant aesthetic opinions on the matter. I like author-date citation styles, much better than the horrible abbreviated alphabet soups so popular in mathematics styles, and much more pleasant to read than [1,2,5-7] as seems to be a dominant style in mathematical literature. If I see (Zomorodian, 2005) or even better (Edelsbrunner-Letscher-Zomorodian, 2000) I’ll know immediately what the reference is about when I read in my own field — whereas a citation of [3] forces me to leaf back to check what they mean.

I have spent a long time either fiddling with natbib, or giving up entirely, or poking around various styles, never quite feeling satisfied with the solutions I ran into. Until today I finally decided to try BibLaTeX on a document I started writing.

And now I wonder why it took me so long to get here.

BibLaTeX is amazing, IMO. It is also currently VERY poorly documented in the blogosphere. The package manual exists, sure, and once you digest it is actually helpful. But when it comes to more tutorial-oriented lightweight introductions, I came up just barely with a very sketchy site from Cambridge that had a few really artificial examples.

So here goes: my own introduction to BibLaTeX.

My first BibLaTeX document

To use BibLaTeX, you can stick with the same BibTeX database you already carefully crafted. However, the way you interact with it in your document changes.

In your preamble, you’ll want something like

\usepackage[citestyle=authoryear]{biblatex}
\addbibresource{mybibfile.bib}

Then, where you would classically have had

\bibliographystyle{abbrv}
\bibliography{mybibfile}

you instead use the command

\printbibliography

So far, so good. The \cite command works just like expected, and everything seems like we make a few random small changes in how and where we write the bibliography-related components of our document. The real power here comes when you start looking at the details of what BibLaTeX provides, and how you can use it.

  1. All citation commands come in two versions. One of them will capitalize the first letter if it isn’t already so you can use them at the beginning of a sentence. Thus, there is both \cite{} and \Cite{}.
  2. Even more than that, there is a host of cite commands:
    • \cite, \Cite: cite using the default settings of your current citestyle.
    • \parencite, \Parencite: enclose citation in parenthesis (or square brackets for numeric citation styles).
    • \footcite: put citation in a footnote.

    Some styles allow other interesting citation commands as well:

    • \textcite, \Textcite: for use when you want to refer to a citation in running text. Will print author names, and then a citation slug in brackets.
    • \smartcite, \Smartcite: gives a footnote if used in the body of the document, and a parencite if used in a footnote.
    • \cite*, \parencite*: only prints year (or title) and not author names.
  3. Speaking of styles, you’ll set those by adjusting the options to the biblatex package inclusion. citestyle=… influences how the inline citations work, and has support for author-year, author-title, with or without ibid. handling, with or without compactification for many citations of the same author groups. Furthermore, there is a nice and mature numeric citation style handling, with optional compacting to [1-3,8] instead of [1,3,8,2], or expansion to individual numbers with no sharing of brackets allowed. There is a couple of different author-abbreviation styles: one that mimics the [VeJ03] styles of the classic BibTeX styles, and one that compacts the author slugs as much as possible. And there are styles specifically for including full bibliography dumps at each citation and for building reading lists.

    Each such style you set will setup the styles for the bibliography at the end on its own. You can override those choices by adding bibstyle=… to the biblatex package options. These approximately match the styles for citestyle=… with less fiddling with inline appearances.

    And finally, there is a lot of control over how the bibliography entries are sorted. Whether to include specific fields in the BibTeX file — including doi and url.

To pick an appropriate style, you really, really should refer to the package manual. Go straight (using the ToC hyperlinks) to 3.3 Standard Styles in the Users Guide section, and the style options are cleanly and clearly described for you.

So, how does it turn out then?

The results, let me show them to you.

This is all from an extended abstract I’m writing for a conference this summer. I used

\usepackage[citestyle=authoryear-icomp,doi=true,url=true]{biblatex}
\addbibresource{gts2012.bib}

in the preamble, and both \cite and \parencite inline.

Inline citations came out like:
biblatex-inline

And the full reference lists came out like:
biblatex-reflist

I am noticing that depending on the quality of your database, there might be redundancies in the DOI and URL-enabled references — but you always have to do some cleanup of the references, and it can hardly be blamed on the software at this stage.

Now what?

Go and try it out yourself. Skim the package manual. Start using it in a few documents yourself.

There are snags when you need to interface with memoir — the manual talks about this. Essentially it boils down to biblatex replacing memoir as far as bibliography styling goes. Other than that, so far, I am only happy with discovering this piece of LaTeX authoring support.

4 People had this to say...

Gravatar
  • Ricardo Gomez
  • April 6th, 2012
  • 20:41

Michi, thanks for posting this. Citatations have always been a pain for me in LaTeX…I came across this by accident and gave it a try…I agree it’s amazing

thanks for sharing

Gravatar
  • Phiri
  • September 21st, 2012
  • 13:07

Thank you very much for sharing this. I especially like the way biblatex handles DOIs :)

Gravatar
  • John
  • October 25th, 2012
  • 23:35

I use different patched bst-scripts. How I can to deal with it?

Gravatar
  • aerial
  • December 19th, 2012
  • 18:06

try typing “texdoc biblatex” in a linux-shell while having texlive-base installed
there is a good documentation with around 200 pages of content for biblatex

Want your say?

* Required fields. Your e-mail address will not be published on this site

You can use the following XHTML tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>