Class option processing is a tricky business for at least two reasons:
- All options accumulate in the
\@classoptionlist macro, and it is relatively hard to remove items from that list,
- Standard classes, like
article, define their default class options in a rather hard way, via the \ProcessOptions\relax directive.
Consequently, later declared options in the standard class article, our concern here, tend to overrule earlier ones, even if they appear together in the \@classoptionlist.
So, in my case, the solution goes through being very careful about how and when to overrule default options, perhaps even appealing to kernel/class macros to achieve the desired result.
\ProvidesClass{foo}
\DeclareOption{handout}{%
\PassOptionsToClass{twocolumn}{article}}% 10pt is default in article,
% no need to declare it again
\DeclareOption{speaker}{%
\PassOptionsToClass{12pt}{article}% overrules default 10pt option,
% without removing it from the list
\AtEndOfClass{\@twocolumnfalse}% overrules default class option twocolumn directly
}
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}}
\ExecuteOptions{handout}
\ProcessOptions*
\LoadClass{article}
\endinput