# Error using e.g. \usepackage[english,german]{babel} instead of \usepackage[german,english]{babel}

Using

\usepackage[english,german]{babel}


-> ERROR

or

\usepackage[german]{babel}


-> ERROR

rather then

\usepackage[german,english]{babel}


-> COMPILES

Produces an error. Why?

Extended example:

\documentclass[a4paper]{article}
\usepackage[english,german]{babel}
\usepackage[german]{datenumber}
\usepackage{totpages}
\ifoot{\selectlanguage{german}\today}
\begin{document}
\SweaveOpts{concordance=TRUE}
\end{document}

• german is outdated. Use ngerman – user31729 Dec 7 '15 at 12:04
• @ChristianHupfer Should it cause an error, though? – cfr Dec 7 '15 at 12:08
• @cfr: I don't know. The fragments by the user do not reveal much. – user31729 Dec 7 '15 at 12:09
• Welcome! It will be hard to help you very effectively without more information. (Unless the switch to ngerman just works.) We have no context in the form of an example we can compile to reproduce the error. We don't even know what the error is. And why is this tagged r and sweave? Are they required to reproduce the problem? – cfr Dec 7 '15 at 12:09
• @b4154 if you want to notify either one of us in a comment you need to type @ followed by the user name. We still need to see a minimal example if we want to help you – cgnieder Dec 7 '15 at 13:31

Well my crystal ball guesses that you have a problem with quote signs. In german there are active and used for accents. Compare

\documentclass{article}
\usepackage[english,ngerman]{babel}
\begin{document}
"abc
\end{document}


with

\documentclass{article}
\usepackage[ngerman,english]{babel}
\begin{document}
"abc
\end{document}


If your R code contains quote signs, they can break if they are active. You can use \shorthandoff to locally disable the "feature":

\documentclass{article}
\usepackage[english,ngerman]{babel}
\begin{document}
"abc

\shorthandoff{"}
"abc

\shorthandon{"}
"abc
\end{document}


• That is not my problem but explain what you can do with the package – b4154 Dec 7 '15 at 14:06
• Well did you try out what happen if you add \shorthandoff{"} before the \SweaveOpts{concordance=TRUE} in your example? – Ulrike Fischer Dec 7 '15 at 15:43
• Using \shorthandoff{"} before the \SweaveOpts{concordance=TRUE} solves the problem. Now I can use \usepackage[english,german]{babel}. Why? – b4154 Dec 8 '15 at 9:03
• Maybe the problem came beacause I used german ä. ö, and ü directly. So the error came. With \shorthandoff{"} directly using ä. ö, and ü makes no problems instead of using "a, "o, and "u. Am I right? – b4154 Dec 8 '15 at 10:12
• I don't have R and knitr or sweave or whatever you are using to process the R code and I can't test what they are injecting in the latex document, so I'm only guessing: I don't think that ä, ö, ü is a problem but you should load \usepackage[utf8]{inputenc} (assuming your file is in utf8). And you should always put \shorthandoff{"} before every chunk of R code, and \shorthandon{"} after every piece of R code. – Ulrike Fischer Dec 8 '15 at 11:14