如何将选项(或加载)类传递给新包?这可能吗?

如何将选项(或加载)类传递给新包?这可能吗?

我计划构建一个新包,我称之为abntstyle,它可以实现巴西的学术论文写作规范。已经有一个名为 的类abnTeX2可以实现这一点。这个类每天都在不断发展和改进,因为它仍在积极开发中。然而,这个类有许多在大多数类或包中并不常见的新定义(宏),这最终会成为一个问题,因为如果用户想通过简单地更改类来更改其学术作品的格式,那么不可避免地会因为这些新宏(仅存在于 中abnTeX2)而出现错误,从而迫使用户对其 TeX 源进行繁琐的扫描以使其重新适应新类。

我的想法是,这个新包应该能够使用最少的新定义(宏)。从这个意义上讲,我希望优先使用现有最多样化的包和类中最多样化的现有定义,以便新包与任何类兼容。这就是我选择制作包而不是新类的原因。

例如,该类memoir有一些有趣的宏,我想将它们移到这个新包中。该类的原生环境titlingpage和是现有宏的示例,它们可用于开发这个新包。因此,我希望能够在不进行新定义的情况下使用它们,但如果可能的话,只能从类中调用它们。adjustwidthmemoirmemoir

研究它时,我发现在一些类模型中,该\LoadClass{<class name>}命令有时用于调用另一个类中的类,从而使其宏和选项可供新类使用:这是该类的开发人员abnTeX2所做的——他们加载了该类memoir。从下面的最小示例中可以看出,我尝试使用该\LoadClass{<class name>}命令将memoir类调用到包中,但正如预期的那样,出现了错误。我不知道是否有办法做到这一点,将类调用到包中,但如果可能的话,我想尝试一下。正是这种尝试激发了这个标题问题。

下面是一个简单的例子。

%%%%%%%%%%%%%%%%%%%%%%%%%%%%     Identitication     %%%%%%%%%%%%%%%%%%%%%%%%%%%%
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{abntstyle}[%
   2023/02/17 v1 Standard ABNT rules to typesseting of Academic Works%
]%
%\ProvidesFile{name}[release information]

%%%%%%%%%%%%%%%%%%%%%%%%%%%%     Initial   Code     %%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%% Declaration of Options %%%%%%%%%%%%%%%%%%%%%%%%%%%%
\DeclareOption*{%
   \PassOptionsToPackage{\CurrentOption}{memoir}%
}%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%  Execution of Options  %%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%    Package  Loading    %%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\RequirePackage[T1]{fontenc}
%\RequirePackage{geometry}
%   \geometry{vdivide={30mm,*,20mm},hdivide={30mm,*,20mm}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%    Special Commands    %%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\LoadClass{memoir}
%\PassOptionsToPackage{abntstyle}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%       Main  Code       %%%%%%%%%%%%%%%%%%%%%%%%%%%%

相关内容