Take the 2-minute tour ×
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.

\ProcessOptions and \ProcessKeyvalOptions

Which comes first? Does it matter?

\ProcessOptions\relax or \ProcessOptions*

What's the difference? Apparently for keyval there is only the starred version. Which should I use? I looked at the docs and they were not extremely helpful.

I'm creating my own class based on article. I'm using kvoptions for the easy creation of boolean options (\DeclareBoolOption and \DeclareComplementaryOption).

share|improve this question

2 Answers 2

Without package kvoptions

An option is defined by


The star form defines the behavior for unknown options:


Options are processed by


that processes the options in the order of declaration in the package file (seldom useful) or


that process the options in calling order (usually recommended).

With package kvoptions

With package kvoptions the replacement for \ProcessOptions* is \ProcessKeyvalOptions. Neither \ProcessOptions nor \ProcessOptions* should be used together with \ProcessKeyvalOptions.

Package options are now interpreted as key value options. They can be defined with \define@key of package keyval. But package kvoptions provides some shortcuts: \DeclareBoolOption, \DeclareStringOption, ...

\DeclareOption is replaced by \DeclareVoidOption and \DeclareOption* is replaced by \DeclareDefaultOption.

For a more complete example, see section "3 Example" of package kvoptions.

share|improve this answer
I'd still be curious why almost all examples add \relax after \ProcessOptions, even though this is supposed to be a no-op? –  Florian Echtler Jul 3 at 18:26
@FlorianEchtler The syntax of \ProcessOptions knows an optional star. The \relax acts as stopper that the command is finished and no optional star is following. –  Heiko Oberdiek Jul 3 at 18:32

Testing this on examples, the order of \ProcessOptions and \ProcessKeyvalOptions does not seem to matter, unless of course the code of one set options directly affects that of the other.

For \ProcessOptions\relax vs. \ProcessOptions*, clsguide explains that the order the options is processed in is different:

\ProcessOptions*: This is like \ProcessOptions but it executes the options in the order specified in the calling commands, rather than in the order of declaration in the class or package. For a package this means that the global options are processed first.

As to which you should use, if you are writing the class completely from scratch, I would advise that you use just one style; either use kvoptions for all of your own options or use exclusively the classical style. If your are building your class on top of an existing one, then it depends on the details: if you are only adding new options then \LoadClassWithOptions may well be sufficient to deal with the old options of that class and you can stick to the kvoptions style for your own additions.

share|improve this answer

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.