3

This question is related to a previous one: assume I am defining a new class dependend on an existing one with the following code:

\ProvidesClass{foo}
%\PassOptionsToClass{11pt}{article}
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}}
%\LoadClass{article}
\ExecuteOptions{11pt}
\ProcessOptions
\LoadClass{article}
\endinput

It's obvious why my custom \ExecuteOptions directive is not complied to: up to that point, all option declarations have been delayed until article is loaded; and at \LoadClass the default options for article override my stated choice. On the referred thread it's been pointed out that in article.cls options are processed with \ProcessOptions, unstarred version, which makes options be processed in the order they are declared, so 10pt takes precedence over my stated 11pt option: since both options are passed, 10pt prevails, having been declared first. Passing 11pt explicitly (uncommenting out the line above) disables 10pt correspondingly, if declared in the document file with \documentclass[10pt]{foo}, since it's been declared first, in the class code. So I have three questions:

  1. Is this a bug or a feature?

  2. Would it make a difference processing options in article.cls with \ProcessOptions* (starred version) instead? Why?

  3. How do I make my \ExecuteOptions prevail? \ExecuteOptions cannot be used after \ProcessOptions, and there are no alternatives out of the box to setup options later in the code: try using \LoadClass before \ProcessOptions in the code above and you'll get an informative error.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.