我有一个 tex 文件,在几天前更新 MikTex 之前,它一直编译正常(我在管理员和用户模式下都进行了更新)。现在,当我尝试编译时,我总是收到以下错误:
! LaTeX Error: Command \AtBeginEnvironment already defined.
Or name \end... illegal, see p.192 of the manual.
See the LaTeX manual or LaTeX Companion for explanation. Type H <return> for immediate help. ...
l.1752 \csgappto{@begin@#1@hook}}
当我输入 H 时,它说无法提供更多信息。所以我继续按回车键,它继续编译,直到最后完成:
Output written on MWE.pdf (1 page, 11687 bytes).
SyncTeX written on MWE.synctex.gz.
Transcript written on MWE.log.
Sorry, but "MiKTeX Compiler Driver" did not succeed.
The log file hopefully contains the information to get MiKTeX going again:
C:\Users\Rebecca\AppData\Local\MiKTeX\2.9\miktex\log\texify.log
知道为什么会发生这种情况吗?我在底部发布了文档的日志文件。
ctable 包似乎是重现下面我的 MWE 中错误的唯一需要的包。但在 MikTek 更新之前,一切都正常。这是最低限度的工作示例:
\documentclass{article}
\usepackage{ctable}
\begin{document}
blah blah blah
\end{document}
这是日志文件:
This is pdfTeX, Version 3.141592653-2.6-1.40.24 (MiKTeX 22.3) (preloaded format=pdflatex 2022.3.29) 29 MAR 2022 15:07
entering extended mode
restricted \write18 enabled.
%&-line parsing enabled.
**C:/Users/Rebecca/Documents/1.Carleton_PhD/00.rebecca_SVN_repository/My_Public
ations/Journal_Papers/2021-05-13_P1-JBPS/MWE.tex
(C:/Users/Rebecca/Documents/1.Carleton_PhD/00.rebecca_SVN_repository/My_Publica
tions/Journal_Papers/2021-05-13_P1-JBPS/MWE.tex
LaTeX2e <2021-11-15> patch level 1
L3 programming layer <2022-02-24>
(C:\Program Files\MiKTeX 2.9\tex/latex/base\article.cls
Document Class: article 2021/10/04 v1.4n Standard LaTeX document class
(C:\Program Files\MiKTeX 2.9\tex/latex/base\size10.clo
File: size10.clo 2021/10/04 v1.4n Standard LaTeX file (size option)
)
\c@part=\count185
\c@section=\count186
\c@subsection=\count187
\c@subsubsection=\count188
\c@paragraph=\count189
\c@subparagraph=\count190
\c@figure=\count191
\c@table=\count192
\abovecaptionskip=\skip47
\belowcaptionskip=\skip48
\bibindent=\dimen138
)
(C:\Program Files\MiKTeX 2.9\tex/latex/ctable\ctable.sty
Package: ctable 2015/10/17 v1.31 ctable package for flexible typesetting of tab
le and figure floats using key/value directives
(C:\Program Files\MiKTeX 2.9\tex/generic/iftex\ifpdf.sty
Package: ifpdf 2019/10/25 v3.4 ifpdf legacy package. Use iftex instead.
(C:\Program Files\MiKTeX 2.9\tex/generic/iftex\iftex.sty
Package: iftex 2022/02/03 v1.0f TeX engine tests
))
(C:\Program Files\MiKTeX 2.9\tex/latex/etoolbox\etoolbox.sty
Package: etoolbox 2018/08/19 v2.5f e-TeX tools for LaTeX (JAW)
\etb@tempcnta=\count193
! LaTeX Error: Command \AtBeginEnvironment already defined.
Or name \end... illegal, see p.192 of the manual.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.1752 \csgappto{@begin@#1@hook}}
? H
Your command was ignored.
Type I <command> <return> to replace it with another command,
or <return> to continue without it.
? H
Sorry, I already gave what help I could...
Maybe you should try asking a human?
An error might have occurred before I noticed any problems.
``If all else fails, read the instructions.''
?
Package etoolbox Warning: Patching '\begin' failed!
(etoolbox) '\AtBeginEnvironment' will not work.
! LaTeX Error: Command \AtEndEnvironment already defined.
Or name \end... illegal, see p.192 of the manual.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.1766 \csgappto{@end@#1@hook}}
?
Package etoolbox Warning: Patching '\end' failed!
(etoolbox) '\AtEndEnvironment' will not work.
! LaTeX Error: Command \BeforeBeginEnvironment already defined.
Or name \end... illegal, see p.192 of the manual.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.1780 \csgappto{@beforebegin@#1@hook}}
?
! LaTeX Error: Command \AfterEndEnvironment already defined.
Or name \end... illegal, see p.192 of the manual.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.1792 \csgappto{@afterend@#1@hook}}
?
Package etoolbox Warning: Patching '\end' failed!
(etoolbox) '\AfterEndEnvironment' will not work.
) (C:\Program Files\MiKTeX 2.9\tex/latex/xcolor\xcolor.sty
Package: xcolor 2021/10/31 v2.13 LaTeX color extensions (UK)
(C:\Program Files\MiKTeX 2.9\tex/latex/graphics-cfg\color.cfg
File: color.cfg 2016/01/02 v1.6 sample color configuration
)
Package xcolor Info: Driver file: pdftex.def on input line 227.
(C:\Program Files\MiKTeX 2.9\tex/latex/graphics-def\pdftex.def
File: pdftex.def 2020/10/05 v1.2a Graphics/color driver for pdftex
)
Package xcolor Info: Model `cmy' substituted by `cmy0' on input line 1352.
Package xcolor Info: Model `hsb' substituted by `rgb' on input line 1356.
Package xcolor Info: Model `RGB' extended on input line 1368.
Package xcolor Info: Model `HTML' substituted by `rgb' on input line 1370.
Package xcolor Info: Model `Hsb' substituted by `hsb' on input line 1371.
Package xcolor Info: Model `tHsb' substituted by `hsb' on input line 1372.
Package xcolor Info: Model `HSB' substituted by `hsb' on input line 1373.
Package xcolor Info: Model `Gray' substituted by `gray' on input line 1374.
Package xcolor Info: Model `wave' substituted by `hsb' on input line 1375.
)
(C:\Program Files\MiKTeX 2.9\tex/latex/xkeyval\xkeyval.sty
Package: xkeyval 2020/11/20 v2.8 package option processing (HA)
(C:\Program Files\MiKTeX 2.9\tex/generic/xkeyval\xkeyval.tex
(C:\Program Files\MiKTeX 2.9\tex/generic/xkeyval\xkvutils.tex
\XKV@toks=\toks16
\XKV@tempa@toks=\toks17
(C:\Program Files\MiKTeX 2.9\tex/generic/xkeyval\keyval.tex))
\XKV@depth=\count194
File: xkeyval.tex 2014/12/03 v2.7a key=value parser (HA)
))
(C:\Program Files\MiKTeX 2.9\tex/latex/tools\array.sty
Package: array 2021/10/04 v2.5f Tabular extension package (FMi)
\col@sep=\dimen139
\ar@mcellbox=\box50
\extrarowheight=\dimen140
\NC@list=\toks18
\extratabsurround=\skip49
\backup@length=\skip50
\ar@cellbox=\box51
)
(C:\Program Files\MiKTeX 2.9\tex/latex/tools\tabularx.sty
Package: tabularx 2020/01/15 v2.11c `tabularx' package (DPC)
\TX@col@width=\dimen141
\TX@old@table=\dimen142
\TX@old@col=\dimen143
\TX@target=\dimen144
\TX@delta=\dimen145
\TX@cols=\count195
\TX@ftn=\toks19
)
(C:\Program Files\MiKTeX 2.9\tex/latex/booktabs\booktabs.sty
Package: booktabs 2020/01/12 v1.61803398 Publication quality tables
\heavyrulewidth=\dimen146
\lightrulewidth=\dimen147
\cmidrulewidth=\dimen148
\belowrulesep=\dimen149
\belowbottomsep=\dimen150
\aboverulesep=\dimen151
\abovetopsep=\dimen152
\cmidrulesep=\dimen153
\cmidrulekern=\dimen154
\defaultaddspace=\dimen155
\@cmidla=\count196
\@cmidlb=\count197
\@aboverulesep=\dimen156
\@belowrulesep=\dimen157
\@thisruleclass=\count198
\@lastruleclass=\count199
\@thisrulewidth=\dimen158
)
(C:\Program Files\MiKTeX 2.9\tex/latex/graphics\rotating.sty
Package: rotating 2016/08/11 v2.16d rotated objects in LaTeX
(C:\Program Files\MiKTeX 2.9\tex/latex/graphics\graphicx.sty
Package: graphicx 2021/09/16 v1.2d Enhanced LaTeX Graphics (DPC,SPQR)
(C:\Program Files\MiKTeX 2.9\tex/latex/graphics\graphics.sty
Package: graphics 2021/03/04 v1.4d Standard LaTeX Graphics (DPC,SPQR)
(C:\Program Files\MiKTeX 2.9\tex/latex/graphics\trig.sty
Package: trig 2021/08/11 v1.11 sin cos tan (DPC)
)
(C:\Program Files\MiKTeX 2.9\tex/latex/graphics-cfg\graphics.cfg
File: graphics.cfg 2016/06/04 v1.11 sample graphics configuration
)
Package graphics Info: Driver file: pdftex.def on input line 107.
)
\Gin@req@height=\dimen159
\Gin@req@width=\dimen160
)
(C:\Program Files\MiKTeX 2.9\tex/latex/base\ifthen.sty
Package: ifthen 2020/11/24 v1.1c Standard LaTeX ifthen package (DPC)
)
\c@r@tfl@t=\count266
\rotFPtop=\skip51
\rotFPbot=\skip52
\rot@float@box=\box52
\rot@mess@toks=\toks20
)
(C:\Program Files\MiKTeX 2.9\tex/latex/transparent\transparent.sty
Package: transparent 2019/11/29 v1.4 Transparency via pdfTeX's color stack (HO)
(C:\Program Files\MiKTeX 2.9\tex/latex/auxhook\auxhook.sty
Package: auxhook 2019-12-17 v1.6 Hooks for auxiliary files (HO)
))
\@CTframesep=\dimen161
\@dfltCTframesep=\dimen162
\@CTframerule=\dimen163
\@dfltCTframerule=\dimen164
\@CTwidth=\dimen165
\@dfltCTwidth=\dimen166
\@CTcaptionskip=\dimen167
\@dfltCTcaptionskip=\dimen168
\@CTmaxwidth=\dimen169
\@dfltCTmaxwidth=\dimen170
\@CTmincapwidth=\dimen171
\@dfltCTmincapwidth=\dimen172
\@CTfooterwidth=\dimen173
\@dfltCTfooterwidth=\dimen174
\@CTw=\dimen175
\@CTfloatwidth=\dimen176
\@CToldsep=\dimen177
\@CToldrule=\dimen178
\CT@t=\box53
\@CTcurftwidth=\dimen179
)
! Extra \endgroup.
\document ->\endgroup
\let \AtEndPreamble \@firstofone \@endpreamblehook \pr...
l.6 \begin{document}
?
(C:\Users\Rebecca\AppData\Roaming\MiKTeX\2.9\tex/latex/l3backend\l3backend-pdft
ex.def
File: l3backend-pdftex.def 2022-02-07 L3 backend support: PDF output (pdfTeX)
\l__color_backend_stack_int=\count267
\l__pdf_internal_box=\box54
)
No file MWE.aux.
\openout1 = `MWE.aux'.
LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 6.
LaTeX Font Info: ... okay on input line 6.
LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 6.
LaTeX Font Info: ... okay on input line 6.
LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 6.
LaTeX Font Info: ... okay on input line 6.
LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 6.
LaTeX Font Info: ... okay on input line 6.
LaTeX Font Info: Checking defaults for TS1/cmr/m/n on input line 6.
LaTeX Font Info: ... okay on input line 6.
LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 6.
LaTeX Font Info: ... okay on input line 6.
LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 6.
LaTeX Font Info: ... okay on input line 6.
(C:\Program Files\MiKTeX 2.9\tex/context/base\supp-pdf.mkii
[Loading MPS to PDF converter (version 2006.09.02).]
\scratchcounter=\count268
\scratchdimen=\dimen180
\scratchbox=\box55
\nofMPsegments=\count269
\nofMParguments=\count270
\everyMPshowfont=\toks21
\MPscratchCnt=\count271
\MPscratchDim=\dimen181
\MPnumerator=\count272
\makeMPintoPDFobject=\count273
\everyMPtoPDFconversion=\toks22
) (C:\Program Files\MiKTeX 2.9\tex/latex/epstopdf-pkg\epstopdf-base.sty
Package: epstopdf-base 2020-01-24 v2.11 Base part for package epstopdf
Package epstopdf-base Info: Redefining graphics rule for `.eps' on input line 4
85.
(C:\Program Files\MiKTeX 2.9\tex/latex/00miktex\epstopdf-sys.cfg
File: epstopdf-sys.cfg 2021/03/18 v2.0 Configuration of epstopdf for MiKTeX
)) [1
{C:/Users/Rebecca/AppData/Local/MiKTeX/2.9/fonts/map/pdftex/pdftex.map}] (MWE.a
ux) )
(\end occurred inside a group at level 1)
### semi simple group (level 1) entered at line 6 (\begingroup)
### bottom level
Here is how much of TeX's memory you used:
2972 strings out of 478571
46257 string characters out of 2851916
340515 words of memory out of 3000000
21157 multiletter control sequences out of 15000+600000
469259 words of font info for 28 fonts, out of 8000000 for 9000
1141 hyphenation exceptions out of 8191
85i,5n,90p,733b,692s stack positions out of 10000i,1000n,20000p,200000b,80000s
<C:/Program Files/MiKTeX 2.9/fonts/type1/public/amsfonts/cm/cmr
10.pfb>
Output written on MWE.pdf (1 page, 11687 bytes).
PDF statistics:
11 PDF objects out of 1000 (max. 8388607)
0 named destinations out of 1000 (max. 500000)
1 words of extra memory for PDF output out of 10000 (max. 10000000)
答案1
事实证明,问题出在 etoolbox 软件包过时,MiKTeX 控制台无法更新,无论是在用户模式还是管理员模式下。在我的问题下方的评论中指出:“etoolbox 已过时,您使用的是 etoolbox 2018/08/19,当前版本是 etoolbox 2020/10/05 v2.5k”
就我而言,答案是导航到 MiKTeX 控制台中的包,然后手动添加 etoolbox(由于某种原因,它没有显示为“已安装”)。