0

We're using a bibtex file in XeLaTeX + biblatex that was originally encoded in ASCII, so accented characters are represented by macros. The rest of the text is Unicode UTF-8. One of the accented characters in the .bib file is \"{0}, which XeLaTeX deals with just fine (and this is the way of representing such characters I see in places like https://en.wikibooks.org/wiki/LaTeX/Special_Characters#Escaped_codes. But biber complains:

ERROR - BibTeX subsystem: /tmp/i_hu76qDT8/References.bib_3533.utf8, 
line 2, syntax error: found "{o}", expected end of entry ("}" or ")") 
(skipping to next "@")
INFO - ERRORS: 1

Biber apparently wants the format {\"o}, which XeLaTeX also accepts.

We normally use UTF-8 everywhere, rather than ASCII escaped characters. But when importing old .bib files, we haven't been bothering to convert the escaped character codes to UTF-8--at least until now. In fact I know this worked without our converting the codes for several years; it must be a recent change to biber that broke the \"{o} representation. (We now have biber v2.10.)

Is this expected, or a bug? Minimal example follows. It "compiles" ok in XeLaTeX, but the biber step fails with the above error msg.

===========XeLaTeX file==========

\documentclass{report}
\usepackage{biblatex}
\addbibresource{References.bib}

\begin{document}
John S\"{o}ren wrote \cite{TestEntry}.
\printbibliography
\end{document}

==========.bib file============

@InCollection{TestEntry,
   author    = "John S\"{o}ren",
   booktitle = "Nonesuch",
   publisher = "Some Publisher",
   address   = "Somewhere",
   year      = "1996"
}
1
  • 2
    This wouldn't work even with bibtex. You are using quotes around the field contents and the inner " is confusing the parsing. It must be protected by braces {\"o}. See e.g. tex.stackexchange.com/a/57745/2388 May 22, 2018 at 15:28

1 Answer 1

2

I'm afraid it has never been right to write

author    = "John S\"{o}ren",

in a .bib file - things are different in a normal .tex file, that's what the Wikibook page you linked to applies to.

There are only very few differences between "..." and {...} as field delimiters for .bib files, but one of them is that fields enclosed in "..." can't have an unprotected " in the field contents. Within "..." literal "s have to be protected by enclosing them in braces. This is one of the reasons why you must write {\"o} and not \"{o} in .bib files, see How to write “ä” and other umlauts and accented letters in bibliography? as well as p. 20 of Tame the BeaST or Q5 of the BibTeX FAQ. This has been the case for BibTeX since the start and carried over to Biber.

You can sort of get around this by using braces instead of quotes.

author    = {John S\"{o}ren},

works. This is one of the reasons why I prefer braces over quotes as field delimiters.

But really you should switch to {\"o} or even better ö. Even with old files it should not be too hard to do a search-and-replace on the problematic character macros.

5
  • I didn't go back to an older version of Biber, but it would really surprise me if this ever worked. The limitation of " should be part of the lower-level parsing libraries which haven't changed on that front for years.
    – moewe
    May 22, 2018 at 15:38
  • It was definitely working, I looked at the 'svn blame' output, and this line has been like that since 2014. We've produced many many PDFs since then, and done the yearly updates to our TeXLive distro. I updated our installation again in April this year, out of the normal update cycle, that's probably when this stopped working. May 23, 2018 at 0:44
  • Also, I can of course change this umlauted 'o' wherever it appears, but there are lots of other chars in many .bib files, so changing them all to Unicode will be a lengthy process. May 23, 2018 at 0:45
  • @MikeMaxwell Mhhh, indeed I checked with biblatex 2.8/Biber 1.8 and it worked there ... But still this is against documented behaviour and you can not expect it to work even if it did. I admit that it might take a bit of time to clean up the sources, but with a bit of scripting foo this should be doable.
    – moewe
    May 23, 2018 at 5:48
  • Yeah, I know how to do it, just annoying :-). Probably easiest to convert the outer quotes to {}, although it would be more satisfying to convert the character macros to their corresponding Unicode chars. At any rate, thanks for checking the older version--I was wondering if I was losing my mind, but I think it's still around here somewhere... May 23, 2018 at 13:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .