3

I'm creating a document class based upon memoir. For this, I allow several class options to be passed to my code. Options that are not recognized will simply be passed to memoir.

Now my question is: how can I force a4paper even if the user of my class passes letterpaper as an option? In other words: is there a possibility to disable the other document size options (letterpaper, a5paper, ebook, etc.) while keeping it possible to pass on options such as ms or fleqn?

jub0bs
  • 58,916
  • related: http://tex.stackexchange.com/questions/21171/mutually-exclusive-options-in-packages – jub0bs May 09 '14 at 00:24
  • also related: http://tex.stackexchange.com/questions/64710/article-wrapper-class-that-locks-down-some-options-passes-others-through – jub0bs May 09 '14 at 00:35

1 Answers1

3

I suggest the following:

% declare options that should be passed to your code
% ...

% now specify which memoir options should not be used, using the following helper macro
\newcommand\warningoptionnotused@myclass
{%
  \OptionNotUsed%
  \ClassWarning{myclass}%
  {%
    Option '\CurrentOption'\space is incompatible with class
    `myclass' and will be ignored.
  }
}
\DeclareOption{letterpaper}{\warningoptionnotused@myclass}
\DeclareOption{a5paper}{\warningoptionnotused@myclass}
\DeclareOption{ebook}{\warningoptionnotused@myclass}
% do the same for all options that should be discarded...

% pass all other options to memoir
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{memoir}}

% process options
\ProcessOptions\relax

% then load memoir with the desired options
\LoadClass[a4paper]{memoir}
jub0bs
  • 58,916