Which BibTeX toolkit to use in conjunction with XeLaTeX
26 Aug 2021This post is primarily a note to myself and collaborators, to avoid explaining and looking this up and over and over again. What is the modern way of making use of a .bib
file in a document compiled with XeLaTeX and why?
Let me highlight the main point from this detailed explanation from the SO thread about the differences bibtex vs. biber and biblatex vs. natbib:
The
biblatex
package is being actively developed in conjunction with thebiber
backend.
…while natbib
is pretty much dead and bibtex
’s only advantage is being “very stable and widely used”, while it’s inflexible when it comes to changing the bibliography style. Also, as explained here biblatex
with biber
as a backend gives you access to RIS, Zotero RDF/XML and Endnote XML data sources, remote .bib
files via HTTP, cross-referencing between entries, and full Unicode support, which is the primary reason I use XeLaTeX. We need those äöü and emojis, there is no excuse not to use Unicode/UTF-8 any more.
So, just go for
% Bibliography settings
\usepackage[backend=biber,urldate=iso,seconds=true]{biblatex} % Imports biblatex package with biber backend and ISO dates
\addbibresource{sample.bib} % Import the bibliography file
and \printbibliography % Prints bibliography
.
The .bib
file format
As mentioned in the above SO thread, BibTeX / BibLaTeX may also refer to the file format of the .bib
file. In our configuration, we make use of the more modern BibLaTeX format that is mostly backwards-compatible to BibTeX-formatted files. Read §2.3 Usage Notes from the BibLaTeX documentation for compatibility notes, most notably the different meaning of the @inbook
type and the new date
field.
Magic comments
If you’re on XeLaTeX, you also might want to use these magic comments / TeX directives in the beginning of your files, so some IDEs (including TeXShop, TeXStudio, TeXworks) adjust their compiler and encoding automatically.
% !TEX TS-program = xelatex
% !TEX encoding = UTF-8