LaTeX Alternatives: BibTeX Part 2, Natbib vs BibLaTeX
In my last post I tried to clear up some confusion around the use of the term “BibTeX” either referencing the reference management software accompanying and built into the LaTeX package or the file format used by this software. Today we continue the series on BibTeX by looking at the LaTeX commands that are available for handling citations and specifically at two packages that extend the basic capabilities of LaTeX in this regard.
Natbib vs BibLaTeX
On their own, the built-in LaTeX macros such as \cite
actually are quite limited to the numerical reference style (e.g. [1]
) or alphanumerical style (e.g. [Pat88]
) that is prevalent in computer science and other technical domains.
LaTeX also only comes with three very basic styles plain.bst
, abbrv.bst
and unsrt.bst
that only differ in the sorting and abbreviation of bibliography entries.
While BibTeX itself is flexible enough to also cover other citation styles such as author-year (e.g. (Patashnik, 1988)
), this needs additional support in the form of .bst
files that define the citation style and LaTeX macros that make using these styles more convenient.
There exist many packages that provide both such as apalike
or jurabib
and there even is a package called custom-bib
that can generate .bst
files based on a list of questions.
One of the most advanced and most widely used packages is natbib
which especially provides support for author-year citations, which are common in the natural sciences.
It defines additional citation macros such as \citet
for citing in text form (e.g. Patashnik (1988)
) and \citep
for citing in parentheses form (e.g. (Patashnik, 1988)
) and provides settings for switching between these styles when using the default \cite
.
It also has other macros such as \citeauthor
which only prints the author or list of authors as it would appear in \citet
, but without the year part.
This is useful when you want to have a citation style with parentheses, but still want to name the authors as part of a sentence.
For example, this
\citeauthor{smith2010} found that eating chocolate is good for your health \cite{smith2010}.
might become
Smith et al. found that eating chocolate is good for your health [1].
natbib
defines its own version of the basic styles called plainnat.bst
, abbrvnat.bst
and unsrtnat.bst
.
It also allows support for URL, DOI, and ISBN fields in .bib
files, which is not included in standard LaTeX.
The .bst
files generated by custom-bib
are compatible with natbib
, which means that there are a lot of .bst
files to choose from.
Up until now you may probably have found a style that works for you if you are looking to write a paper in computer science, engineering, math, or the natural sciences. But what about other disciplines? In the humanities, citations are much more involved, featuring footnotes instead of end notes, a citation style that involves the title of the cited work and a tracking of repeated citations of the same source which are then abbreviated by an ibid. instead of the title and author. This is not possible by “just” extending the capabilities of LaTeX, but it requires a full rewrite of the LaTeX macros for reference management.
Luckily, the biblatex
package does just that.
It was designed to do away with many of the shortcomings of traditional BibTeX, including missing support for internationalization (BibTeX is ASCII-only), the complicated and arcane details of defining bibliography styles in the .bst
format, and missing convenience and customization features.
It still uses .bib
files and can (for now) use the BibTeX tool, but it also includes its own Unicode-aware tool called Biber (which we will discuss in the next part) and allows to define citation styles with pure LaTeX code instead of .bst
syntax.
The .bib
files of BibLaTeX follow the same syntax, but the list of entry types and mandatory and optional attributes differs, with BibLaTeX usually providing more detailed information and support for modern publication aspects such as preprint servers.
BibLaTeX also defines many LaTeX macros and package options that make citations and customization of bibliography styles much more convenient.
Examples include options that control the number of authors shown before et al. is used, sorting mechanisms, punctuation, date formats or ibidem tracking.
Like natbib
, BibLaTex also defines commands like \citeauthor
and can even support all of the natbib
commands with the package option natbib=true
.
Also like natbib
, it supports switching between citations styles based on package settings, but BibLaTeX’s \autocite
command handles many additional styles such as citations as footnotes or superscripts and is aware of punctuation.
The fact that citation styles are defined in LaTeX also adds an entirely different class of functionality:
BibLaTeX can transform and adjust the entries in your .bib
file on the fly while loading it.
This removes a lot of the need to manually adjust .bib
files that are created by other tools like Zotero.
For example, you can keep URLs for journal or conference articles, but when you use a verbose style that would unnecessarily include them in the bibliography, you do not have to remove them in the file but can instead add this piece of code to your LaTeX document.
\AtEveryBibitem{
\ifentrytype{online}{}{ % if not @online
\clearfield{url}
\clearfield{urldate}
}
}
To sum up, the only good reason to still use natbib
over BibLaTeX is that you are forced to do so, because your journal either requires you to copy and paste the .bbl
file into the manuscript file or simply provides a citation style that is only compatible with natbib
.
Of course the grim reality is sometimes, that even journals focusing on engineering use styles that contain practices that have been deprecated for decades or they might not even be compatible with natbib
or BibLaTeX at all, forcing you to fall back to standard LaTeX support for citations.