TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can I pass options of my package in a specific order to another loaded package?

\DeclareOption{others}{% other options are also declared}

Above declaration results in babel being loaded with english,ngerman always regardless whether I load L10n with




How can I manage to have the options ngerman and english in order for babel when loading my package?

share|improve this question
I tried to specify your title a bit, hope you don't mind. The previous wording hinted at a question way simpler than yours actually is. – doncherry Sep 15 '11 at 12:25
\ProcessOptions* is what's needed. – egreg Sep 15 '11 at 12:26
\ProcessOptions* scans through all options. I only want to pass english and ngerman to babel but in the given order. There are other options not being passed to babel but handled by my package. I don't know the way how to handle options differently when using \ProcessOptions* – Sebastian Sep 15 '11 at 12:29
@egreg or Sebastian: Please post this as an answer. I would do it myself you where first. – Martin Scharrer Sep 15 '11 at 12:45
up vote 4 down vote accepted

It mostly depends on what the other options should do. The command


will scan the option code in the order the options are passed to the package, without doing anything for the options not specified at package call. If other options do things that shouldn't depend on the calling order, then you have a problem.

In general it's not a good idea to call babel from a package, as this cuts out languages which are not provided in the package as an explicitly declared option.

A clean way might be to load options with a key-value interface, so


could do the job by passing the languages to babel in the prescribed order and maintaining the possibility to choose any supported language. Many packages use this syntax.

share|improve this answer
Thanks! Sounds good but sadly I got stuck \DeclareOption{languages}{\PassOptionsToPackage{\CurrentOption}{babel}} Doesn't work now. I need to handle the key-value pair correctly. – Sebastian Sep 15 '11 at 14:57
@Sebastian: you should look the documentation of package kvoptions – egreg Sep 15 '11 at 15:10

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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