12.14.14 \ProcessOptions



Execute the code for each option that the user has invoked. Invoke it in the class file as \ProcessOptions\relax (because of the existence of the starred version, described below).

Options come in two types. Local options have been specified for this particular package in \usepackage[options], \RequirePackage[options], or the options argument of \PassOptionsToPackage{options}. Global options are those given by the class user in \documentclass[options]. If an option is specified both locally and globally then it is local.

When \ProcessOptions is called for a package pkg.sty, the following happens:

  1. For each option option so far declared with \DeclareOption, \ProcessOptions looks to see if that option is either global or local for pkg. If so, then it executes the declared code. This is done in the order in which these options were given in pkg.sty.
  2. For each remaining local option, it executes the command \ds@option if it has been defined somewhere (other than by a \DeclareOption); otherwise, it executes the default option code given in \DeclareOption*. If no default option code has been declared then it gives an error message. This is done in the order in which these options were specified.

When \ProcessOptions is called for a class it works in the same way except that all options are local, and the default code for \DeclareOption* is \OptionNotUsed rather than an error.

The starred version \ProcessOptions* 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.

Unofficial LaTeX2e reference manual