§ 4.1.6 Packages and Options

The following declarations are useful for defining  bindings, including option handling. As when defining  packages, the following, if needed at all, need to appear in the order shown.

  • DeclareOption($option,$handler) specifies the handler for $option when it is passed to the current package or class. If $option is undef, it defines the default handler, for options that are otherwise unrecognized. $handler can be either a string to be expanded, or a sub which is executed like a primitive.

  • PassOptions($name,$type,options) specifies that the given options should be passed to the package (if $type is sty) or class (if $type is cls) $name, if it is ever loaded.

  • ProcessOptions(keys) processes any options that have been passed to the current package or class. If inorder=>1 is specified, the options will be processed in the order passed to the package (\ProcessOptions*); otherwise they will be processed in the declared order (\ProcessOptions).

  • ExecuteOptions(options) executes the handlers for the specific set of options options.

  • RequirePackage($pkgname,keys) loads the specified package. The keyword options have the following effect: options=>$options can provide an explicit array of string specifying the options to pass to the package; withoptions=>1 means that the options passed to the currently loading class or package should be passed to the requested package; type=>$ext specifies the type of the package file (default is sty); raw=>1 specifies that reading the raw style file (eg. pkg.sty) is permissible if there is no specific  binding (eg. pkg.sty.ltxml) after=>$after specifies a string or (LaTeXML::Core::)Tokens to be expanded after the package has finished loading.

  • LoadClass($classname,keys) Similar to RequirePackage, but loads a class file (type=>’cls’).

  • AddToMacro($cstoken,$tokens) a little used utilty to add material to the expansion of $cstoken, like an \edef; typically used to add code to a class or package hook.