# Mark key-value class options as used

I have written a wrapper for the scrartcl class in the following way:

\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{mycls}[2012/08/23]

\RequirePackage{kvoptions}

\DeclareStringOption{title}
\DeclareStringOption{subtitle}

\ProcessKeyvalOptions*

\PassOptionsToClass{fleqn, openbib, headings=big, DIV=12}{scrartcl}


This way I can provide some default arguments for scrartcl like DIV=12 and still override them by passing

\documentclass{title=mytitle, subtitle=thesubtitle, DIV=10}


The problem I have, is that srcartcl marks the other options, e.g., title=mytitle as unused

LaTeX Warning: Unused global option(s)

which is certainly false. I tried unsetting the options with

\DisableKeyvalOptions{mycls}{title}


right after \ProcessKeyvalOptions*, but that didn't work. How can I mark those options as used?

-
Sorry, I misread the question completely and my solution is therefore surely wrong. –  yo' Aug 23 '12 at 16:29
Btw, shouldn't doing \LoadClass[fleqn, openbib, headings=big, DIV=12]{scrartcl} instead of \PassOptionsToClass and \LoadClassWithOptions help? –  yo' Aug 23 '12 at 16:31

I took a fresh, thorough look at The LaTeX Companion (A.4.8) and solved the problem myself.

Despite what I previously assumed, \PassOptionsToClass and \LoadClassWithOptions do not work together. The whole point of \LoadClassWithOptions is passing exactly the same arguments as the current class got. So here switching to \LoadClass will now take the default options.

Unfortunately now the user given global options will not overwrite the default ones. Therefore they have to passed manually to the class. Here kvoptions provides \DeclareDefaultOption as a equivalent to the classic \DeclareOption*. All in all the result looks like:

\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{mycls}[2012/08/23]

\RequirePackage{kvoptions}

\DeclareStringOption{title}
\DeclareStringOption{subtitle}

\PassOptionsToClass{fleqn, openbib, headings=big, DIV=12}{scrartcl}

\DeclareDefaultOption{\PassOptionsToClass{\CurrentOption}{scrartcl}}

\ProcessKeyvalOptions*


So whenever \ProcessKeyvalOptions* sees an unknown option, like DIV=10, it passes it along to scrartcl, overwriting any default value in the process. That's why \PassOptionsToClass had to be moved in front of it.
As far as the options you pass to scrartcl does not depend on the global ones, this shall work. But you should at least define the draft option for your class, something like \DeclareVoidOption{draft}{\overfullrule5\p@}. –  yo' Aug 23 '12 at 17:26
@tohecz: That is not necessary. Because of my use of \DeclareDefaultOption, all those global options (like draft) that I'm not handling myself, are passed on to scrartcl. –  canaaerus Aug 23 '12 at 17:29