I would like to define some base-class.cls, with some options and their defaults, and then provide some mechanism so that other derived classes can reuse the existing options and change the defaults. Furthermore, I would like that options added to the base-class in the future also propagate to the derived classes without any further change.

This question is somewhat related to an existing question about new and existing class options. In essence, How to replace the default set of options when defining a new class?.

As an example, assume that there is some base article.cls with three mutually exclusive options: 10pt, 11pt and 12pt. Where 10pt is the default option. Now one wants to define a new document class, say nice-article which has the same three options, but 11pt is the default.

From the answer to the linked question, the solution would be to declare the three options within nice-article.cls using \DeclareOption which store the selected action in some if's or macros, then call \ExecuteOptions{11pt} to set the new default, and finally call \PassOptionsToClass{...}{article} with the appropriate saved option.

But all this seems too cumbersome and is not very modular. Say for example that later article adds a new 13pt option. Ideally I would also like nice-article to also benefit from this new option; in particular if I explicitly said


However using that solution I would also have to go and modify nice-article.cls to make it aware of the new existing 13pt.

So the question is (a) hasn't this problem been already solved? i.e. is there some package or extension or command which I'm missing and allows to do this? and, if not, (b) how should I go about implementing such feature?

Assume that I'm implementing a class base-class.cls which can have any kind of code and macros needed; but then I want to be able to define new classes on top of that (say nice-class.cls, bright-class.cls, funny-class.cls) which can use options from base-class, defining their own defaults and being automagically upgraded with more options if I happen to change the base-class.

Hope that the question makes sense.

  • Your question would benefit if you could summarize what you try to achieve in about two lines at the beginning (that part is also shown in the overview page), before you talk about the background. Your last paragraph is the actual question, right? Jun 28, 2011 at 14:20
  • 1
    Thanks for the advice, I've edited the question with a short summary at the top. Jun 28, 2011 at 14:28
  • Nice edit and also nice question in general. Jun 28, 2011 at 14:32

1 Answer 1


You could declare a string option that accepts the font size and defaults to 11pt. However, this will come at the expense of the top class no longer being aware of what exactly it is doing. But that's a principal problem of upwards compatibility. E.g.


% Declare a string option `fntsize' that is unique to the derived
% class `atop'. It will accept anything assuming `11pt' if
% unspecified.
% probably more options...

% Assume that any unknown option will be understood by the base class:

% Now load the base class with the `fntsize' option and any unknown
% option:

If you happen to be the author of the base class and hence have the freedom to make it "a good base class", you might do some fancier things. For example, you could add a macro that allows executing options after the class has been loaded. (Like hyperref's \hypersetup or geometry's \geometry.) Then you could further add a macro, say \getOptionList, that returns a comma separated list of all options. You may then retrieve the list of options accepted by the base class in the derived class and use it to make further decisions without hardcoding the status quo of base options.


  • Thanks for the answer, this is more or less what I ended up doing: using key-value options and storing (or changing) the default value for a given key. I'm accepting your answer, but I still hope there was a more "direct" solution which worked with plain (non-keyvalue) options. Jul 18, 2011 at 8:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .