
我正在創建一個基於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}