1

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}
\setlength{\headheight}{1.1\baselineskip}
\usepackage[english,german]{babel}
\usepackage[german]{datenumber}
\usepackage{scrpage2} \pagestyle{scrheadings}
\usepackage{totpages}
\clearscrheadfoot 
\ifoot{\selectlanguage{german}\today}
\begin{document}
\SweaveOpts{concordance=TRUE}
\end{document}
15
  • german is outdated. Use ngerman
    – user31729
    Dec 7, 2015 at 12:04
  • @ChristianHupfer Should it cause an error, though?
    – cfr
    Dec 7, 2015 at 12:08
  • @cfr: I don't know. The fragments by the user do not reveal much.
    – user31729
    Dec 7, 2015 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, 2015 at 12:09
  • 1
    @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, 2015 at 13:31

1 Answer 1

3

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}

enter image description here

with

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

enter image description here

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}

enter image description here

5
  • That is not my problem but explain what you can do with the package
    – b4154
    Dec 7, 2015 at 14:06
  • Well did you try out what happen if you add \shorthandoff{"} before the \SweaveOpts{concordance=TRUE} in your example? Dec 7, 2015 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, 2015 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, 2015 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. Dec 8, 2015 at 11:14

You must log in to answer this question.

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