The character &
has a special meaning for LaTeX: It marks new table columns or new alignment columns in general (think align
).
As such you can't generally use &
in its meaning as ampersand character in standard LaTeX and must escape it to \&
, see Escape character in LaTeX. There are some exceptions to this rule: In \verb|...|
and other verbatim commands as well as \url
and some related commands you can often use &
without escaping it, but there are some subtle points with those commands (see for example How to use a link as footnote that has special characters inside?).
It's pretty much the same for the bibliography. You should escape &
to \&
in .bib
files except in special verbatim fields like doi
, eprint
and url
.
The best solution™ is to make sure to escape &
to \&
in the .bib
file unless it is in a doi
, eprint
, url
or otherwise verbatim field. E.g. instead of
publisher = {Pub & Co.},
you should write
publisher = {Pub \& Co.},
If for some reason you absolutely cannot bring yourself to fix your .bib
file once for good, you can have Biber do that on the fly for you (but this is at most the second best solution™). (biblatex
uses an XML format to communicate with Biber, where &
is also a special character, so we better escape it as \x{26}
.)
\documentclass[british]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{csquotes}
\usepackage[style=authoryear, backend=biber]{biblatex}
\DeclareSourcemap{
\maps{
\map{
\step[fieldsource=publisher,
match=\regexp{\x{26}},
replace=\regexp{\\\x{26}}]
}
}
}
\begin{filecontents}{\jobname.bib}
@book{appleby,
author = {Humphrey Appleby},
title = {On the Importance of the Civil Service},
date = {1980},
publisher = {Pub & Co.},
}
\end{filecontents}
\addbibresource{\jobname.bib}
\begin{document}
\cite{appleby}
\printbibliography
\end{document}
Related Ampersand in Sourcemap for BibTex.
&
with\&
in the.bib
file is generally the easiest solution (and running Biber again afterwards). With a Replace All function in an editor this can be done very quickly.