Surprisingly, I wasn't able to find the list of symbols which can be used for separating fields in BibTeX keys. Many programming languages have their own lists of exceptions, but it seems there is none, neither for BibLaTeX, nor for Biber.
Consider the following example:
@article{Doe1970,
author = {Doe, John},
title = {Lorem ipsum},
volume = {42},
date = {1970-01-01},
pages = {123--456},
}
Common and widely used pattern is [auth][year]
(e.g. Doe1970
), but what if I would like to include a sequence of homogeneous descriptors (text or numerical fields following one another)? For example, [auth][year][volume][firstpage]
would result in Doe197042123
, which looks clunky and hard to read; or [auth][shorttitle][year]
DoeLoremipsum1970
, which also doesn't look great. Can I use something like Doe+1970-42:123
or Doe_Loremipsum;1970
instead?
From what I understand, non-ASCII symbols, white spaces and commas are not allowed, and even though Biber can handle non-ASCII characters, those are usually omitted for better compatibility. However, it would be nice to have a list of characters which are not permitted at all, and a list of recommended symbols which are safe to use and won't cause any troubles upon compilation.
Best Answer
First of all, spaces are not allowed in key names, so we can concentrate on other special characters.
BibTeX
I have prepared the following test file:
and a small test file with a
\cite
for each entry. Compiling with LaTeX shows problems fora&#
because ofwhich is not really surprising. Going past the two related errors and running BibTeX shows
and
again not really unexpected. So I conclude that curly braces, even if balanced, and
#
are not allowed (but if#
was made of category code 12 in the LaTeX document it would go through).Now I removed the curly braces and the
#
from the relevant keys. The compilation was successful.Next experiment is to add
\usepackage[czech,turkish,ngerman,french]{babel}
to the LaTeX document, which would make several of the characters active, but I got no problem. Note that the.aux
file containsNext experiment is to have the
\cite
commands in the argument to another command, I used\emph
. Again no problem.Conclusion
The forbidden characters in the seven bit ASCII range are
{ } , ~ # % \
. I didn't text comma, percent and backslash because they're obviously not acceptable: the first on the BibTeX side, the other two on the LaTeX side.Also
~
is disallowed (do yourself a test).Biber
See https://tex.stackexchange.com/a/96918/2388 where it is specified that
are disallowed. I guess that also
~
cannot be used (for problems on the LaTeX side like for BibTeX). It goes without saying that the backslash is also out of the question.