I would like to pass option conditionally to memoir from my custom class for this I try to do a MWE





\ExecuteOptions{foo} %default is foo

% Based on the memoir class
    \DeclareOption*{\PassOptionsToClass{a4paper,12pt,french,twoside,openright,openbib, final}{memoir}}
    \DeclareOption*{\PassOptionsToClass{a5paper,10pt,french,twoside,openright,openbib, final}{memoir}}





I would like keep thesis@foo flag to make later conditionally title page.

This MWE produce always a pdf with US Letter as page size (I think it is the default)

Thanks for your help

  • 2
    DeclareOption* is what to do with an unknown option, and your example has no such option, I think you just want \PassOptionsToClass, not \DeclareOption*{\PassOptionsToClass – David Carlisle Jan 13 '17 at 18:48

I think, you mixed up your new class. (BTW: you should give it a more descriptive name!)

As David pointed out, you should always define the \DeclareOption* to define, what to do with undeclared options. In your case, it would make sense, to hand the unknown option to class memoir, as it might know, what to do with it.

Next, bear in mind, you really have to declare, what should happen, when you use the option in your class. Your declaration only set the boolean value, but nothing else is happening. By \ExecuteOption you don't get a reasonable result, whatsoever.

Instead, you have to put the \PassOptionsToClass-commands inside the \DeclareOption, to have it executed, when you are actually using that options.

So your class should look like this:


%% Actually, you declare this boolean, but you never use it!

  \typeout{Declare Option Foo!}

  \typeout{Declare Option NoFoo!}

%% What to do, if an unknown option is entered?

\ExecuteOptions{foo} %default is foo

% Based on the memoir class
  • 1
    My pleasure, if it helped you. – Jan Jan 13 '17 at 20:48

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.