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 :-)

6
  • Welcome to TeX.SE!
    – Cragfelt
    Commented Dec 12, 2017 at 1:36
  • I am just welcoming. You did not do anything wrong, yet ;-)
    – Cragfelt
    Commented Dec 12, 2017 at 6:30
  • Put the filecontents environment before \documentclass
    – egreg
    Commented Dec 12, 2017 at 7:21
  • Incidentally this is the same problem as the recent tex.stackexchange.com/q/405610/35864. You should not use " for quotation mark, use csquotes and its \enquote{foo} or ``foo''.
    – moewe
    Commented Dec 12, 2017 at 7:34
  • I assume it pops up from time to time. The " thing is probably mentioned in any good introduction to TeX, so many people know it.
    – moewe
    Commented Dec 12, 2017 at 9:28

2 Answers 2

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}}
2
  • @emmi474 Yes, " should never be used in LaTeX for quotes.
    – egreg
    Commented Dec 12, 2017 at 9: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
    Commented Dec 12, 2017 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.

You must log in to answer this question.

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