2

I reduced the problem to the following minimal working example (MWE):

\begin{filecontents}{library.bib}
  @misc {test1,
    author = {Author},
    note = {{This note is "bad"}},
    }
\end{filecontents}

\documentclass[12pt]{article}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}

\usepackage[ngerman, english]{babel}
%\usepackage[english, ngerman]{babel}

\usepackage[backend=biber]{biblatex}
\addbibresource{library.bib}

\begin{document}
\cite{test1}
\printbibliography[]
\end{document}

The code above works fine. However, if I change the main language with \usepackage[english, ngerman]{babel} I get the following error:

! Argument of \language@active@arg" has an extra }.
  • Ideally, I'm looking for a solution which doesn't include changing the .bib files, because they're external and I don't have control over them. Even though the problem seems to be with " and } inside the .bib file. (I realized that note = {This note is "bad"} or note = {{This note is bad}} or note = {{This note is "bad".}} seem to work with both languages. But note = {{This note is "bad"}} isn't malformed, or is it? It should work, right?)
  • So, maybe I can just set the main language for the .bib resource back to english as a workaround?

Thanks for any ideas :-)

finefoot
  • 529
  • 5
  • 15

2 Answers2

5

This example reproduces the issue

\documentclass{article}

\usepackage[ngerman]{babel}

\begin{document}
{"bad"}
\end{document}

When ngerman is active, " is a shorthand character whose action depends on what follows it. For instance "a is translated into \"a for the umlaut and "| sets a morpheme boundary for breaking ligatures. What should never follow " is } and your .bbl file will contain

\field{note}{{This note is "bad"}}

Removing the unneeded braces does not solve the issue. Use proper quoting

note={This note is ``bad''}

or, better, use csquotes facilities:

note={This note is \enquote{bad}}
moewe
  • 175,683
egreg
  • 1,121,712
  • @emmi474 Yes, " should never be used in LaTeX for quotes. – egreg Dec 12 '17 at 09:51
  • @emmi474 In general you will need csquotes for \enquote. biblatex defines a poor man's version of \enquote if csquotes is not loaded. You can turn off csquotes' language detection if you don't want it. – moewe Dec 12 '17 at 10:14
1

I should take the time to read some basic introduction to LaTeX to avoid these problems. The error seems to come from bad quoting. Quoting with " is generally a bad idea. On https://en.wikibooks.org/wiki/LaTeX/Text_Formatting#Quote-marks for example, it says

Don't use the " for right double quotes: when the babel package is used for some languages (e.g. German), the " is redefined to produce an umlaut accent

and there are some possible alternatives shown, too.

finefoot
  • 529
  • 5
  • 15