Question

Have a look at this minimal example. It works fine when the babel package is commented out.

\documentclass{article}
\usepackage[dutch]{babel}

\begin{document}
<<>>=
abc() #a non-existing function
@

\end{document}

With the babel package I get this error. The error depends on the language as well. No error with english, french or italian. Error with dutch, german or danish. The problem seems to occur with languages that have umlauts (ä, ö, ...)

! Argument of \language@active@arg" has an extra }.
<inserted text> 
                \par 
l.67 ...\#\# Error: could not find function "abc"}
                                                  }\end{kframe}
I've run across a `}' that doesn't seem to match anything.
For example, `\def\a#1{...}' and `\a}' would produce
this error. If you simply proceed now, the `\par' that
I've just inserted will cause me to report a runaway
argument that might be the root of the problem. But if
your `}' was spurious, just type `2' and it will go away.
Was it helpful?

Solution

Try:

\usepackage[T2A]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[dutch,english]{babel}

R and LaTeX can have some weird text encoding problems when using non-alphanumeric characters.

OTHER TIPS

Not quite an answer (for that, see @EllisValentiner's), but an explanation:

Here's a minimal reproducible tex document. Seems to be something to do with the ", so your guess about umlaut seems right on.

\documentclass{article}
\usepackage[dutch]{babel}
\begin{document}
"}
\end{document}

@baptiste noticed that babel is making it an active character, what it seems to be doing is "swallowing" the following character to see if it should put an umlaut on it; if so, it does, and if not, it prints the character normally. However, if the next character is a }, it's getting added to the code that figures out what to do, which then complains about having an extra }.

So this minimal example works, I think because it's processing both { and the } in the babel code, and so the braces line up properly.

\documentclass{article}
\usepackage[dutch]{babel}
\begin{document}
"{"}
\end{document}

Not sure if this is a babel bug, or if you're just not supposed to use " for quotes when using babel. That seems reasonable except in the case where you're using a tt family, which is when this problem first arose.

Someone more curious than I should feel free to post this behavior as a question on tex.stackexchange; if you do so, leave a link here so we can find it.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top