I'm writing a new class file that is based on book, and thought of making it available both in an English and in a Dutch version. Easiest to do seemed passing the arguments, so I constructed following class file :

\ProvidesClass{UGentCourse}[2011/07/28 v1.0 UGentCourse]

\ProcessOptions \relax

\RequirePackage{babel} %francais, polish, spanish, ...

Which I believed would allow me to do :


Strange thing, it doesn't work completely. If I switch it from dutch to English (or back), I get an error :

Package babel Error: You haven't loaded the option english (dutch) yet.

If I rerun the file, the error is gone. I have a faint idea about what is going on, but not really a clue of how I can prevent this from happening. All help appreciated.

  • 5
    It's normal; babel writes the language in the .aux file. If you change from Dutch to English, at the subsequent compilation LaTeX finds the annotation about Dutch and doesn't know about the language. – egreg Jul 29 '11 at 11:40
  • I realized. I just need a way to get rid of that. Which @mhp gave me, thanks for that. – Joris Meys Jul 29 '11 at 13:26

You can avoid this error by modifying your class definition as follows:

\ProvidesClass{UGentCourse}[2011/07/28 v1.0 UGentCourse]





\RequirePackage[dutch, english]{babel}

The last language in the option list passed to the babel package (i.e. english here) is the default language. It is active at the beginning of the document if no language has been specified in the optional argument of \documentclass.

  • Thx, this works smoothly. – Joris Meys Jul 29 '11 at 13:26

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.