3

What characters are valid in a biblatex entry key?

I'm asking because Zotero will export entry keys with <i>foo</i> in them, and pandoc-citeproc doesn't like that. But I don't know whether Zotero is too permissive, or pandoc-citeproc is too strict.

This is the error that pandoc-citeproc generates with an entry key like that:

pandoc-citeproc: "stdin" (line 10918, column 2):
unexpected "A"
expecting "c", "C", "p", "P", "s" or "S"
CallStack (from HasCallStack):
  error, called at src/Text/CSL/Input/Bibtex.hs:113:32 in pandoc-citeproc-0.10.4-BdOyQb33rzG2TMOLj4Fbp9:Text.CSL.Input.Bibtex
pandoc: Error running filter pandoc-citeproc
Filter returned error status 1
twsh
  • 2,718
  • 3
    biblatex accepts <i>foo</i> as a bibkey with Biber and BibTeX as a backend. So the problem must lie elsewhere. In general you should try and use only ASCII letters and numbers as well as a few special characters such as -, ., :, _. Avoid non-ASCII letters (ä, ß, É) - even if they might work if you use an engine with full Unicode support and Biber. You should also avoid commas as well as braces (curly and otherwise). – moewe Aug 27 '17 at 18:54
  • 5
    For future reference, we removed html markup in citekeys in bibtex export from Zotero a while ago and it's an oversight that it remains in biblatex. We'll fix that, even if it may take a little time. See https://forums.zotero.org/discussion/comment/284813/#Comment_284813 for discussion. – adam.smith Aug 27 '17 at 21:25

1 Answers1

8

An entry key may contain <, > and / if you use biblatex no matter if you use the legacy BibTeX backend or Biber. So <i>foo</i> is acceptable as part of a entry key.

In general, however, it is a good idea to only use ASCII letters (lowercase a-z and uppercase A-Z; keep in mind that the names are case sensitive), digits and a few special characters such as ., -, :, _, /.

If you use a fully Unicode-aware TeX engine such as XeLaTeX or LuaLaTeX your entry keys may also contain non-ASCII letters (with diacritics, from other scripts etc.) such as é, ß, Ä.

A key may never contain a comma (,) or braces or brackets (curly {, } or round (, )).

moewe
  • 175,683
  • See also https://tex.stackexchange.com/q/243729/35864, https://tex.stackexchange.com/q/96454/35864, https://tex.stackexchange.com/q/408530/35864 – moewe Aug 14 '18 at 13:52