如果用户使用给定选项,我的一个类将加载biblatex
包。为此,该类过去依赖它\AtEndPreamble{\RequirePackage{biblatex}}
,我猜它曾经工作得很好。现在情况不再如此,如以下 MCE 所示:
\listfiles
\documentclass{article}
\usepackage{etoolbox}
\AtEndPreamble{\usepackage{biblatex}}
\begin{document}
\end{document}
返回以下(第一个)错误:
! Undefined control sequence.
<argument> ...ndpreambleonly \ifnum \blx@hyperref
=\thr@@ \else \ifnum \blx@...
l.503 \let\do\noexpand}
这文件列表存在:
article.cls 2020/04/10 v1.4m Standard LaTeX document class
size10.clo 2020/04/10 v1.4m Standard LaTeX file (size option)
etoolbox.sty 2020/10/05 v2.5k e-TeX tools for LaTeX (JAW)
biblatex.sty 2020/12/31 v3.16 programmable bibliographies (PK/MW)
pdftexcmds.sty 2020-06-27 v0.33 Utility functions of pdfTeX for LuaTeX (HO)
infwarerr.sty 2019/12/03 v1.5 Providing info/warning/error messages (HO)
iftex.sty 2020/03/06 v1.0d TeX engine tests
ltxcmds.sty 2020-05-10 v1.25 LaTeX kernel commands for general use (HO)
keyval.sty 2014/10/28 v1.15 key=value parser (DPC)
kvoptions.sty 2020-10-07 v3.14 Key value format for package options (HO)
kvsetkeys.sty 2019/12/15 v1.18 Key value parser (HO)
logreq.sty 2010/08/04 v1.0 xml request logger
logreq.def 2010/08/04 v1.0 logreq spec v1.0
ifthen.sty 2014/09/29 v1.1c Standard LaTeX ifthen package (DPC)
url.sty 2013/09/16 ver 3.4 Verb mode for urls, etc.
blx-dm.def 2020/12/31 v3.16 biblatex localization (PK/MW)
blx-compat.def 2020/12/31 v3.16 biblatex compatibility (PK/MW)
biblatex.def 2020/12/31 v3.16 biblatex compatibility (PK/MW)
standard.bbx 2020/12/31 v3.16 biblatex bibliography style (PK/MW)
numeric.bbx 2020/12/31 v3.16 biblatex bibliography style (PK/MW)
numeric.cbx 2020/12/31 v3.16 biblatex citation style (PK/MW)
biblatex.cfg
l3backend-pdftex.def 2021-01-09 L3 backend support: PDF output (pdfTeX)
english.lbx 2020/12/31 v3.16 biblatex localization (PK/MW)
expl3.sty 2021-01-09 L3 programming layer (loader)
blx-case-expl3.sty 2020/12/31 v3.16 expl3 case changing code for biblatex
xparse.sty 2020-10-27 L3 Experimental document command parser
***********
作为一种解决方法,并且现在可能是一种更好的做法,人们可以利用新的钩子管理系统:
\documentclass{article}
\AddToHook{env/document/begin}[mydoc/loadbiblatex]{%
\RequirePackage{biblatex}%
}
\DeclareHookRule{env/document/begin}{mydoc/loadbiblatex}{before}{hyperref}
\begin{document}
\end{document}
其编译效果非常好。
因此,我倾向于在课程的新版本中使用这些钩子。但我想确保使用此新版本的人拥有足够新的 LaTeX 版本来提供这些钩子。在课程中指定以下内容是否足够:
\NeedsTeXFormat{LaTeX2e}[2020-10-01]
此日期由以下人员给出:
texdef -t latex fmtversion