# Unused global option in KOMAscript wrapper class

I want to write several classes, most of them will use KOMA classes as base class.

However I stumbled upon the problem that some options (mainly concerned with layout) are not processed if given in the wrapper class:

  \begin{filecontents}{test.cls}
\ProvidesClass{test}[2015/01/01]
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{scrartcl}}
\ProcessOptions\relax
\end{filecontents}

\documentclass{test}

\usepackage{blindtext}

\begin{document}
\section{Test}
\blindtext
\end{document}


This results in

LaTeX Warning: Unused global option(s): [paper=a5]  If i give the option as \documentclass[paper=a5]{test} it is used correctly, because I pass the options to scrartcl. However I want to change the defaults for the layout.

How can I achieve this?

• All this is passed down to package typearea. I think there was a similar question not long ago. EDIT: texwelt.de/wissen/fragen/12417/… – Johannes_B May 5 '15 at 11:22
• Is the option actually not processed or is it just a warning? I have wrapper classes for the standard classes which produce these warnings but the options are, in fact, handled fine. – cfr May 5 '15 at 11:26
• the resulting pdf document is a4, which is the default for scrartcl – MaxNoe May 5 '15 at 11:27

Using \LoadClass with options is a tricky thing as none of the options are passed to packages, all are meant to be for the class. The paper option is unknown to a KOMA-sclass, as package typearea deals with the layout stuff, hence the warning.

Using documentclass option parsing down to packages is allowed, so this approach works perfectly fine. If you want to set a fixed pagesize, pass options to the package before loading the class, just as the class internally does. This queuing mechanism works well, loading the package with explicit options will fail though.

Of course there is always room for trickery. The KOMA classes know the option a5paper, a4paper and a few more, and will pass the right option to package typearea on their own.

\begin{filecontents}{\jobname.cls}
\ProvidesClass{\jobname}[2015/01/01]
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{scrartcl}}
\ProcessOptions\relax
\PassOptionsToPackage{ paper=a5,pagesize }{typearea}
\end{filecontents}

\documentclass{\jobname}

\usepackage{blindtext}

\begin{document}
\section{Test}
\blindtext
\end{document}


You can of course delay the layout stuff to a later point, and can even change it within the document. One thing to remember, tell typearea to do some recalculations. If you can change the paper size, the 8user* can do it too.

\begin{filecontents}{\jobname.cls}
\ProvidesClass{\jobname}[2015/01/01]
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{scrartcl}}
\ProcessOptions\relax

\KOMAoptions{paper=a3,pagesize,paper=landscape}
\recalctypearea
\end{filecontents}

\documentclass[paper=a5]{\jobname}

\usepackage{blindtext}

\begin{document}
\section{Test}
\blindtext
\end{document}


With KOMA version 3.17, the typearea option pagesize became the default. All users still running an older version (TeX Live 2014 is frozen) need to explicitely give that option. I added it to option list passed to typearea to make their life easier. Thanks to @esdd for dropping me a note.

• According to the KOMA manual all KOMA script classes load typearea, if one uses a KOMA class directly, the options are passed to typearea. Why are they not passed if used in a wrapper class? If I load typearea in the wrapper class I get an option clash for it. – MaxNoe May 6 '15 at 23:38
• @MaxNoe I made some further explanations. – Johannes_B May 7 '15 at 13:07