# Add option to class with command

Is it possible add at the loaded class some options? look at the example below:

\documentclass{scrbook}

\begin{document}

test

\end{document}

-
I would do a \def\MyClassOptions{} before \documentclass, and use \documentclass[MyClassOptions]{scrbook}. This could also allow (with some additional logic) for a way to specify the class options on the command line, if so desired. – Peter Grill Oct 1 '12 at 21:06

If a class or package is loaded, LaTeX does not load them again (the exception is package fontenc). It only checks the options, if there are new ones and then LaTeX throws an error because of the option clash. That also means, you can't give options later to the class or package. But it is possible to do it before:

\PassOptionsToClass{headinclude,footinclude}{scrbook}
\documentclass{scrbook}


Some classes and packages provide setup commands that allow to change the behaviour of the class or package at a later time, e.g.:

\documentclass{scrbook}
\recalctypearea

-

The solution I have been using is:

\ifdefined\ClassOptions
\else
\def\ClassOptions{draft}
\fi

\documentclass[\ClassOptions]{article}


This allows you to change the options via the command line if so desired.

-