
に基づいてドキュメント クラスを作成していますmemoir
。このため、いくつかのクラス オプションをコードに渡すことを許可します。認識されないオプションは、単に に渡されますmemoir
。
ここで質問です。a4paper
クラスのユーザーが をletterpaper
オプションとして渡した場合でも、どうすれば強制できるでしょうか。言い換えると、やなどのオプションを渡すことは可能なまま、他のドキュメント サイズ オプション ( letterpaper
、a5paper
、ebook
など) を無効にすることは可能でしょうか。ms
fleqn
答え1
私は次のことを提案します:
% 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}