3

I'm writing my own class for a thesis... yes, yet another thesis class! XD

This class is based on the standard book class, but I don't want all options of the book class to be available when writing a thesis. How could I achieve that?


My confusion comes with the use of LoadClass with \PassOptionsToClass{\CurrentOptions} versus LoadClassWithOptions, I read their use in clsguide but I'm still off.

If someone can baby feed me the difference, and point me to some examples I'd be grateful.

6

You can use something like

\DeclareOption*{% 
  \ClassWarning{mythesisclass}{Unknown option `\CurrentOption' ignored}%
}

before processing the options and loading the class. The warning is optional, but it's nice to let the user know that something is not being passed through in the usual way.

What this does is ignore all options that are not explicitly declared, so any options that you do want to be passed on must be defined with \DeclareOption.

Here's an example snippet from a class of mine:

\DeclareOption{10pt}{\PassOptionsToClass{10pt}{memoir}}
\DeclareOption{11pt}{\PassOptionsToClass{11pt}{memoir}}
\DeclareOption{12pt}{\PassOptionsToClass{12pt}{memoir}}
\DeclareOption{final}{\PassOptionsToClass{final}{memoir}}
\DeclareOption{draft}{\PassOptionsToClass{draft}{memoir}}
\DeclareOption*{%
  \ClassWarning{mugsthesis}{Unknown option `\CurrentOption' ignored}%
}
\ExecuteOptions{12pt,final} % defaults
\ProcessOptions\relax
\LoadClass[letterpaper,oneside]{memoir} % options here are fixed; no changes allowed
  • @paul-gesser Your explanation was really helpful. Finally I'm cleaning my code XD because I did a lousy jobs the first time. – Dox Mar 11 '15 at 21:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.