# Strange Behavior when Inheriting Class Options

I'd like to create a new document class which inherits most of its options from the base class article, but which sets the default font option to 11pt instead of 10pt, and also defines its own new options. I'm most of the way there, but I'm having trouble getting the new class to recognize the inherited options. Currently, my class file resembles

\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{newclass}

\DeclareOption{newoption}{\def\x{x}}
\PassOptionsToClass{11pt}{article}
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}}

\ExecuteOptions{newoption,11pt}
\ProcessOptions\relax



This mostly gets the job done - The default font is 11pt, and calling \documentclass[12pt]{newclass} gives a document in 12pt font. However, calling \documentclass[10pt]{newclass} does not gives a document in 10pt font. Instead, it keeps the default 11pt font.

Test file:

\documentclass
%
[10pt] %11pt...
%[11pt] %
%[12pt] %
{newclass}
\stop


I've also tried using something of the form

\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{newclass}

\DeclareOption{newoption}{...}

\ExecuteOptions{newoption,11pt}
\ProcessOptions\relax

...


This processes all of the options correctly. However, in this case the 11pt option in \ExecuteOptions doesn't seem to be recognized, and loading the calling the class without options gives a document in 10pt font.

My questions are:

1. Why is the 10pt option not recognized when using the first method?

2. Why are inherited options in \ExecuteOptions not recognized when using the second method?

• Please post a complete example which can be used to reproduce the problem.
– cfr
Mar 4 '15 at 13:17

Essentially what goes wrong here is that 10pt is not declared so it gets picked up by the default option which passes 10pt to the list that will be passed to article when it is loaded.

But you also unconditionally do

\ExecuteOptions{newoption,11pt}


so 10pt and 11pt get passed to article.

article uses \ProcessOptions not \ProcessOptions* so it processes options in the order they are declared in article which means that

\documentclass[10pt,11pt]{article}


and

\documentclass[11pt,10pt]{article}


are equivalent, and both select 11pt. The effect of your class is similar, you pass both options to article and 11pt always overwrites 10pt.

In the second example \LoadClassWithOptions is not intended to be used in a class that declares its own options, it just takes the top level list of options and passes them straight to article.

• @erreka why would you call it a bug? May 14 '18 at 22:28
• @erreka sorry I can't guess what the issue is with comments and no example on a two year old answer, please ask a new question with an example if something isn't working. May 15 '18 at 18:39
• What does "unconditionally do" mean in this context? Feb 8 '21 at 20:29
• I mean the code passes 11pt without checking if 10pt or 12pt has been specified by the document author, so article class ends up seeing both options. Feb 8 '21 at 20:33
• @jarnosz \@classoptionslist (doc in source2e.pdf ltclass chapter) Feb 12 '21 at 14:45