通用钩子'package/before/amsmath

通用钩子'package/before/amsmath

更新我的 Miktex 发行版(2023-07-03)后,我无法再编译我的代码。请参阅下面的 MNWE:

\documentclass{article}
  % \usepackage{siunitx}
  \usepackage{unicode-math}       % sisetup uses \mitpi (require unicode-math)

\begin{document}
  Hello world. 
\end{document}

警告:

 LaTeX hooks Warning: Generic hook 'package/before/amsmath' is deprecated.
(hooks)              Use hook 'package/amsmath/before' instead.

! LaTeX Error: Control sequence \g__hook_package/amsmath/before_reversed_tl
(LaTeX)        already defined.

我的另一个观察是,代码可以通过xelatex不是lualatex我的情况)。

该库中可能存在一个错误unicode-math,但不幸的是我没有足够的知识来修复它。

通过命令编译后的完整日志文件lualatex myfile.tex

This is LuaHBTeX, Version 1.17.0 (MiKTeX 23.5) (format=lualatex 2023.7.3)  3 JUL 2023 12:13
 restricted system commands enabled.
**grain0093.tex
(./grain0093.tex
LaTeX2e <2023-06-01> patch level 1
L3 programming layer <2023-06-16>
Lua module: luaotfload 2022-10-03 3.23 Lua based OpenType font support
Lua module: lualibs 2022-10-04 2.75 ConTeXt Lua standard libraries.
Lua module: lualibs-extended 2022-10-04 2.75 ConTeXt Lua libraries -- extended c
ollection.
luaotfload | conf : Root cache directory is "C:/Users/z0037rdx/AppData/Local/MiK
TeX/luatex-cache/generic/names".
luaotfload | init : Loading fontloader "fontloader-2022-10-03.lua" from kpse-res
olved path "C:/Users/z0037rdx/AppData/Local/Programs/MiKTeX/tex/luatex/luaotfloa
d/fontloader-2022-10-03.lua".
Lua-only attribute luaotfload@noligature = 1
luaotfload | init : Context OpenType loader version 3.120
Inserting `luaotfload.node_processor' in `pre_linebreak_filter'.
Inserting `luaotfload.node_processor' in `hpack_filter'.
Inserting `luaotfload.glyph_stream' in `glyph_stream_provider'.
Inserting `luaotfload.define_font' in `define_font'.
Lua-only attribute luaotfload_color_attribute = 2
luaotfload | conf : Root cache directory is "C:/Users/z0037rdx/AppData/Local/MiK
TeX/luatex-cache/generic/names".
Inserting `luaotfload.harf.strip_prefix' in `find_opentype_file'.
Inserting `luaotfload.harf.strip_prefix' in `find_truetype_file'.
Removing  `luaotfload.glyph_stream' from `glyph_stream_provider'.
Inserting `luaotfload.harf.glyphstream' in `glyph_stream_provider'.
Inserting `luaotfload.harf.finalize_vlist' in `post_linebreak_filter'.
Inserting `luaotfload.harf.finalize_hlist' in `hpack_filter'.
Inserting `luaotfload.cleanup_files' in `wrapup_run'.
Inserting `luaotfload.harf.finalize_unicode' in `finish_pdffile'.
Inserting `luaotfload.glyphinfo' in `glyph_info'.
Lua-only attribute luaotfload.letterspace_done = 3
Inserting `luaotfload.aux.set_sscale_dimens' in `luaotfload.patch_font'.
Inserting `luaotfload.aux.set_font_index' in `luaotfload.patch_font'.
Inserting `luaotfload.aux.patch_cambria_domh' in `luaotfload.patch_font'.
Inserting `luaotfload.aux.fixup_fontdata' in `luaotfload.patch_font_unsafe'.
Inserting `luaotfload.aux.set_capheight' in `luaotfload.patch_font'.
Inserting `luaotfload.aux.set_xheight' in `luaotfload.patch_font'.
Inserting `luaotfload.rewrite_fontname' in `luaotfload.patch_font'.
Inserting `tracingstacklevels' in `input_level_string'. (C:/Users/z0037rdx/AppD
ata/Local/Programs/MiKTeX/tex/latex/base/article.cls
Document Class: article 2023/05/17 v1.4n Standard LaTeX document class
(C:/Users/z0037rdx/AppData/Local/Programs/MiKTeX/tex/latex/base/size10.clo
File: size10.clo 2023/05/17 v1.4n Standard LaTeX file (size option)
luaotfload | db : Font names database loaded from C:/Users/z0037rdx/AppData/Loca
l/MiKTeX/luatex-cache/generic/names/luaotfload-names.luc.gz)
\c@part=\count183
\c@section=\count184
\c@subsection=\count185
\c@subsubsection=\count186
\c@paragraph=\count187
\c@subparagraph=\count188
\c@figure=\count189
\c@table=\count190
\abovecaptionskip=\skip48
\belowcaptionskip=\skip49
\bibindent=\dimen139
)
(C:/Users/z0037rdx/AppData/Local/Programs/MiKTeX/tex/latex/unicode-math/unicode
-math.sty
(C:/Users/z0037rdx/AppData/Local/Programs/MiKTeX/tex/latex/l3kernel/expl3.sty
Package: expl3 2023-06-16 L3 programming layer (loader) 

(C:/Users/z0037rdx/AppData/Local/Programs/MiKTeX/tex/latex/l3backend/l3backend-
luatex.def
File: l3backend-luatex.def 2023-04-19 L3 backend support: PDF output (LuaTeX)
\l__color_backend_stack_int=\count191
Inserting `l3color' in `luaotfload.parse_color'.
\l__pdf_internal_box=\box51
))
Package: unicode-math 2020/01/31 v0.8q Unicode maths in XeLaTeX and LuaLaTeX

(C:/Users/z0037rdx/AppData/Local/Programs/MiKTeX/tex/latex/unicode-math/unicode
-math-luatex.sty
Package: unicode-math-luatex 2020/01/31 v0.8q Unicode maths in XeLaTeX and LuaL
aTeX

(C:/Users/z0037rdx/AppData/Local/Programs/MiKTeX/tex/latex/l3packages/xparse/xp
arse.sty
Package: xparse 2023-02-02 L3 Experimental document command parser
)
(C:/Users/z0037rdx/AppData/Local/Programs/MiKTeX/tex/latex/l3packages/l3keys2e/
l3keys2e.sty
Package: l3keys2e 2023-02-02 LaTeX2e option processing using LaTeX3 keys
)
(C:/Users/z0037rdx/AppData/Local/Programs/MiKTeX/tex/latex/fontspec/fontspec.st
y
Package: fontspec 2022/01/15 v2.8a Font selection for XeLaTeX and LuaLaTeX
Lua module: fontspec 2022/01/15 2.8a Font selection for XeLaTeX and LuaLaTeX
(C:/Users/z0037rdx/AppData/Local/Programs/MiKTeX/tex/latex/fontspec/fontspec-lu
atex.sty
Package: fontspec-luatex 2022/01/15 v2.8a Font selection for XeLaTeX and LuaLaT
eX
\l__fontspec_script_int=\count192
\l__fontspec_language_int=\count193
\l__fontspec_strnum_int=\count194
\l__fontspec_tmp_int=\count195
\l__fontspec_tmpa_int=\count196
\l__fontspec_tmpb_int=\count197
\l__fontspec_tmpc_int=\count198
\l__fontspec_em_int=\count199
\l__fontspec_emdef_int=\count266
\l__fontspec_strong_int=\count267
\l__fontspec_strongdef_int=\count268
\l__fontspec_tmpa_dim=\dimen140
\l__fontspec_tmpb_dim=\dimen141
\l__fontspec_tmpc_dim=\dimen142

(C:/Users/z0037rdx/AppData/Local/Programs/MiKTeX/tex/latex/base/fontenc.sty
Package: fontenc 2021/04/29 v2.0v Standard LaTeX package
)
(C:/Users/z0037rdx/AppData/Local/Programs/MiKTeX/tex/latex/fontspec/fontspec.cf
g))) (C:/Users/z0037rdx/AppData/Local/Programs/MiKTeX/tex/latex/base/fix-cm.sty
Package: fix-cm 2020/11/24 v1.1t fixes to LaTeX
(C:/Users/z0037rdx/AppData/Local/Programs/MiKTeX/tex/latex/base/ts1enc.def
File: ts1enc.def 2001/06/05 v3.0e (jk/car/fm) Standard LaTeX file
LaTeX Font Info:    Redeclaring font encoding TS1 on input line 47.
))
(C:/Users/z0037rdx/AppData/Local/Programs/MiKTeX/tex/latex/amsmath/amsmath.sty
Package: amsmath 2023/05/13 v2.17o AMS math features
\@mathmargin=\skip50

For additional information on amsmath, use the `?' option.
(C:/Users/z0037rdx/AppData/Local/Programs/MiKTeX/tex/latex/amsmath/amstext.sty
Package: amstext 2021/08/26 v2.01 AMS text

(C:/Users/z0037rdx/AppData/Local/Programs/MiKTeX/tex/latex/amsmath/amsgen.sty
File: amsgen.sty 1999/11/30 v2.0 generic functions
\@emptytoks=\toks17
\ex@=\dimen143
)) (C:/Users/z0037rdx/AppData/Local/Programs/MiKTeX/tex/latex/amsmath/amsbsy.st
y
Package: amsbsy 1999/11/29 v1.2d Bold Symbols
\pmbraise@=\dimen144
) (C:/Users/z0037rdx/AppData/Local/Programs/MiKTeX/tex/latex/amsmath/amsopn.sty
Package: amsopn 2022/04/08 v2.04 operator names
)
\inf@bad=\count269
LaTeX Info: Redefining \frac on input line 236.
\uproot@=\count270
\leftroot@=\count271
LaTeX Info: Redefining \overline on input line 399.
LaTeX Info: Redefining \colon on input line 410.
\classnum@=\count272
\DOTSCASE@=\count273
LaTeX Info: Redefining \ldots on input line 496.
LaTeX Info: Redefining \dots on input line 499.
LaTeX Info: Redefining \cdots on input line 620.
\Mathstrutbox@=\box52
\strutbox@=\box53
LaTeX Info: Redefining \big on input line 722.
LaTeX Info: Redefining \Big on input line 723.
LaTeX Info: Redefining \bigg on input line 724.
LaTeX Info: Redefining \Bigg on input line 725.
\big@size=\dimen145
LaTeX Font Info:    Redeclaring font encoding OML on input line 743.
LaTeX Font Info:    Redeclaring font encoding OMS on input line 744.
\macc@depth=\count274
LaTeX Info: Redefining \bmod on input line 905.
LaTeX Info: Redefining \pmod on input line 910.
LaTeX Info: Redefining \smash on input line 940.
LaTeX Info: Redefining \relbar on input line 970.
LaTeX Info: Redefining \Relbar on input line 971.
\c@MaxMatrixCols=\count275
\dotsspace@=\muskip16
\c@parentequation=\count276
\dspbrk@lvl=\count277
\tag@help=\toks18
\row@=\count278
\column@=\count279
\maxfields@=\count280
\andhelp@=\toks19
\eqnshift@=\dimen146
\alignsep@=\dimen147
\tagshift@=\dimen148
\tagwidth@=\dimen149
\totwidth@=\dimen150
\lineht@=\dimen151
\@envbody=\toks20
\multlinegap=\skip51
\multlinetaggap=\skip52
\mathdisplay@stack=\toks21
LaTeX Info: Redefining \[ on input line 2953.
LaTeX Info: Redefining \] on input line 2954.
)
(C:/Users/z0037rdx/AppData/Local/Programs/MiKTeX/tex/lualatex/lualatex-math/lua
latex-math.sty
Package: lualatex-math 2021/07/05 v1.11 Patches for mathematics typesetting wit
h LuaLaTeX

(C:/Users/z0037rdx/AppData/Local/Programs/MiKTeX/tex/latex/etoolbox/etoolbox.st
y
Package: etoolbox 2020/10/05 v2.5k e-TeX tools for LaTeX (JAW)
\etb@tempcnta=\count281
)
Lua module: lualatex-math 2013/08/03 1.3 Patches for mathematics typesetting wit
h LuaLaTeX

LaTeX hooks Warning: Generic hook 'package/before/amsmath' is deprecated.
(hooks)              Use hook 'package/amsmath/before' instead.


! LaTeX Error: Control sequence \g__hook_package/amsmath/before_reversed_tl
(LaTeX)        already defined.

For immediate help type H <return>.
 ...                                              
                                                  
l.139 }
     
? x


Here is how much of LuaTeX's memory you used:
 3955 strings out of 478031
 100000,1977958 words of node,token memory allocated 409 words of node memory still in use:
   3 hlist, 1 rule, 1 dir, 3 kern, 1 glyph, 4 attribute, 51 glue_spec, 4 attribu
te_list, 3 if_stack, 1 write nodes
   avail lists: 2:8,3:2,4:1,7:2,9:2
 24479 multiletter control sequences out of 65536+600000
 16 fonts using 855119 bytes
 90i,0n,97p,223b,148s stack positions out of 10000i,1000n,20000p,200000b,200000s

warning  (pdf backend): no pages of output.

PDF statistics: 0 PDF objects out of 1000 (max. 8388607)
 0 named destinations out of 1000 (max. 131072)
 1 words of extra memory for PDF output out of 10000 (max. 100000000)

答案1

根据 samcarter_is_at_topanswers.xyz 的观察,问题似乎出在我的 Miktex 发行版中的旧包中(由于某种原因,它尚未自动更新):

Package: lualatex-math 2021/07/05 v1.11 Patches for mathematics typesetting with LuaLaTeX

更新后

lualatex-math.sty    2022/01/01 v1.12 Patches for mathematics typesetting with LuaLaTeX

它运行正常。

相关内容