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?

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}
| improve this answer | |

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.