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

  • Welcome to TeX.SE! – Cragfelt Dec 12 '17 at 1:36
  • @Cragfelt Thank you! Did I do something wrong or do you just always link to the welcome page for first posters? :-) – finefoot Dec 12 '17 at 2:05
  • I am just welcoming. You did not do anything wrong, yet ;-) – Cragfelt Dec 12 '17 at 6:30
  • Put the filecontents environment before \documentclass – egreg Dec 12 '17 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 Dec 12 '17 at 7:34
4

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}}
  • Oh, wow. Thank you! I didn't know that. So using double quotes " in LaTeX is generally bad style? Anything I can do from my .tex file about that? Or should I contact the distributor for the .bib files? – finefoot Dec 12 '17 at 9:14
  • @emmi474 Yes, " should never be used in LaTeX for quotes. – egreg Dec 12 '17 at 9:51
  • Okay, I'll use \enquote{} then. Is it a bad idea to use it without including csquotes? I don't need the quotes to be language-specific. – finefoot Dec 12 '17 at 9:56
  • @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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.