我几乎总是使用分享LaTeX满足我的 LaTeX 需求,但我最近开始处理一个相对较大的文档,所以我想我会尝试本地 TeX 发行版,看看我是否可以加快编译时间。因此我决定下载适用于 Windows 的 MikTeX 2.9.5997 64 位并使用特克斯工作室作为我的前端。然后我简单地将我的项目复制并粘贴到 TeXstudio 中,希望它能够运行,但我却发现了大量错误。
我尝试下载TeX 直播相反,以及TeXmaker,并尝试了所有四种组合(两个分布的两个前端),在所有情况下,我都发现了完全相同的错误。
然后我继续简单地删减我的文件以尝试隔离问题。以下是生成的 MWE。
\documentclass{article}
\usepackage{amsthm}
\usepackage{hyperref}
\usepackage{cleveref}
\newtheorem{thm}[equation]{Theorem}
\begin{document}
\begin{thm}
This is my theorem.
\end{thm}
\end{document}
这会抛出大约 6 个错误,第一个是“没有定义计数器‘t’”,第二个是“缺失数字被视为 0”,剩下的是“可能缺少 \item”,\begin{thm}
除了最后一个错误外,所有这些错误都会抛出\end{thm}
。此外,(I) 本文档在 ShareLaTeX 中编译良好,(II) 如果您删除任何
\usepackage{hyperref}
,\usepackage{cleveref}
, 或者[equation]
在这\newtheorem
条线上,它同样可以顺利编译。
到底是什么原因导致了这样的错误?
更新 1:如果删除,它也能很好地遵守\usepackage{amsthm}
。我还确认,如果您使用其他计数器,问题仍然会发生。
更新2:我确认了这一点做使用 TeX Live 2015 正确编译。检查了相应的 CTAN 页面后,似乎这里使用的唯一自 2015 年以来更新的包是hyperref
。我想这意味着hyperref
包中一定引入了一个错误?
日志档案:
This is pdfTeX, Version 3.14159265-2.6-1.40.17 (MiKTeX 2.9 64-bit) (preloaded format=pdflatex 2016.6.18) 19 JUN 2016 00:29
entering extended mode
**./stackexchange.tex
(stackexchange.tex
LaTeX2e <2016/03/31>
Babel <3.9r> and hyphenation patterns for 75 language(s) loaded.
("D:\Program Files\TeX\tex\latex\base\article.cls"
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
("D:\Program Files\TeX\tex\latex\base\size10.clo"
File: size10.clo 2014/09/29 v1.4h Standard LaTeX file (size option)
)
\c@part=\count79
\c@section=\count80
\c@subsection=\count81
\c@subsubsection=\count82
\c@paragraph=\count83
\c@subparagraph=\count84
\c@figure=\count85
\c@table=\count86
\abovecaptionskip=\skip41
\belowcaptionskip=\skip42
\bibindent=\dimen102
)
("D:\Program Files\TeX\tex\latex\amscls\amsthm.sty"
Package: amsthm 2015/03/04 v2.20.2
\thm@style=\toks14
\thm@bodyfont=\toks15
\thm@headfont=\toks16
\thm@notefont=\toks17
\thm@headpunct=\toks18
\thm@preskip=\skip43
\thm@postskip=\skip44
\thm@headsep=\skip45
\dth@everypar=\toks19
)
("D:\Program Files\TeX\tex\latex\hyperref\hyperref.sty"
Package: hyperref 2016/05/21 v6.83p Hypertext links for LaTeX
("D:\Program Files\TeX\tex\generic\oberdiek\hobsub-hyperref.sty"
Package: hobsub-hyperref 2016/05/16 v1.14 Bundle oberdiek, subset hyperref (HO)
("D:\Program Files\TeX\tex\generic\oberdiek\hobsub-generic.sty"
Package: hobsub-generic 2016/05/16 v1.14 Bundle oberdiek, subset generic (HO)
Package: hobsub 2016/05/16 v1.14 Construct package bundles (HO)
Package: infwarerr 2016/05/16 v1.4 Providing info/warning/error messages (HO)
Package: ltxcmds 2016/05/16 v1.23 LaTeX kernel commands for general use (HO)
Package: ifluatex 2016/05/16 v1.4 Provides the ifluatex switch (HO)
Package ifluatex Info: LuaTeX not detected.
Package: ifvtex 2016/05/16 v1.6 Detect VTeX and its facilities (HO)
Package ifvtex Info: VTeX not detected.
Package: intcalc 2016/05/16 v1.2 Expandable calculations with integers (HO)
Package: ifpdf 2016/05/14 v3.1 Provides the ifpdf switch
Package: etexcmds 2016/05/16 v1.6 Avoid name clashes with e-TeX commands (HO)
Package etexcmds Info: Could not find \expanded.
(etexcmds) That can mean that you are not using pdfTeX 1.50 or
(etexcmds) that some package has redefined \expanded.
(etexcmds) In the latter case, load this package earlier.
Package: kvsetkeys 2016/05/16 v1.17 Key value parser (HO)
Package: kvdefinekeys 2016/05/16 v1.4 Define keys (HO)
Package: pdftexcmds 2016/05/21 v0.22 Utility functions of pdfTeX for LuaTeX (HO
)
Package pdftexcmds Info: LuaTeX not detected.
Package pdftexcmds Info: \pdf@primitive is available.
Package pdftexcmds Info: \pdf@ifprimitive is available.
Package pdftexcmds Info: \pdfdraftmode found.
Package: pdfescape 2016/05/16 v1.14 Implements pdfTeX's escape features (HO)
Package: bigintcalc 2016/05/16 v1.4 Expandable calculations on big integers (HO
)
Package: bitset 2016/05/16 v1.2 Handle bit-vector datatype (HO)
Package: uniquecounter 2016/05/16 v1.3 Provide unlimited unique counter (HO)
)
Package hobsub Info: Skipping package `hobsub' (already loaded).
Package: letltxmacro 2016/05/16 v1.5 Let assignment for LaTeX macros (HO)
Package: hopatch 2016/05/16 v1.3 Wrapper for package hooks (HO)
Package: xcolor-patch 2016/05/16 xcolor patch
Package: atveryend 2016/05/16 v1.9 Hooks at the very end of document (HO)
Package atveryend Info: \enddocument detected (standard20110627).
Package: atbegshi 2016/05/16 v1.17 At begin shipout hook (HO)
Package: refcount 2016/05/16 v3.5 Data extraction from label references (HO)
Package: hycolor 2016/05/16 v1.8 Color options for hyperref/bookmark (HO)
)
("D:\Program Files\TeX\tex\latex\graphics\keyval.sty"
Package: keyval 2014/10/28 v1.15 key=value parser (DPC)
\KV@toks@=\toks20
)
("D:\Program Files\TeX\tex\generic\ifxetex\ifxetex.sty"
Package: ifxetex 2010/09/12 v0.6 Provides ifxetex conditional
)
("D:\Program Files\TeX\tex\latex\oberdiek\auxhook.sty"
Package: auxhook 2016/05/16 v1.4 Hooks for auxiliary files (HO)
)
("D:\Program Files\TeX\tex\latex\oberdiek\kvoptions.sty"
Package: kvoptions 2016/05/16 v3.12 Key value format for package options (HO)
)
\@linkdim=\dimen103
\Hy@linkcounter=\count87
\Hy@pagecounter=\count88
("D:\Program Files\TeX\tex\latex\hyperref\pd1enc.def"
File: pd1enc.def 2016/05/21 v6.83p Hyperref: PDFDocEncoding definition (HO)
)
\Hy@SavedSpaceFactor=\count89
("D:\Program Files\TeX\tex\latex\00miktex\hyperref.cfg"
File: hyperref.cfg 2002/06/06 v1.2 hyperref configuration of TeXLive
)
Package hyperref Info: Hyper figures OFF on input line 4486.
Package hyperref Info: Link nesting OFF on input line 4491.
Package hyperref Info: Hyper index ON on input line 4494.
Package hyperref Info: Plain pages OFF on input line 4501.
Package hyperref Info: Backreferencing OFF on input line 4506.
Package hyperref Info: Implicit mode ON; LaTeX internals redefined.
Package hyperref Info: Bookmarks ON on input line 4735.
\c@Hy@tempcnt=\count90
("D:\Program Files\TeX\tex\latex\url\url.sty"
\Urlmuskip=\muskip10
Package: url 2013/09/16 ver 3.4 Verb mode for urls, etc.
)
LaTeX Info: Redefining \url on input line 5088.
\XeTeXLinkMargin=\dimen104
\Fld@menulength=\count91
\Field@Width=\dimen105
\Fld@charsize=\dimen106
Package hyperref Info: Hyper figures OFF on input line 6342.
Package hyperref Info: Link nesting OFF on input line 6347.
Package hyperref Info: Hyper index ON on input line 6350.
Package hyperref Info: backreferencing OFF on input line 6357.
Package hyperref Info: Link coloring OFF on input line 6362.
Package hyperref Info: Link coloring with OCG OFF on input line 6367.
Package hyperref Info: PDF/A mode OFF on input line 6372.
LaTeX Info: Redefining \ref on input line 6412.
LaTeX Info: Redefining \pageref on input line 6416.
\Hy@abspage=\count92
\c@Item=\count93
\c@Hfootnote=\count94
)
Package hyperref Message: Driver (autodetected): hpdftex.
("D:\Program Files\TeX\tex\latex\hyperref\hpdftex.def"
File: hpdftex.def 2016/05/21 v6.83p Hyperref driver for pdfTeX
\Fld@listcount=\count95
\c@bookmark@seq@number=\count96
("D:\Program Files\TeX\tex\latex\oberdiek\rerunfilecheck.sty"
Package: rerunfilecheck 2016/05/16 v1.8 Rerun checks for auxiliary files (HO)
Package uniquecounter Info: New unique counter `rerunfilecheck' on input line 2
82.
)
\Hy@SectionHShift=\skip46
)
("D:\Program Files\TeX\tex\latex\cleveref\cleveref.sty"
Package: cleveref 2013/12/28 v0.19 Intelligent cross-referencing
Package cleveref Info: `hyperref' support loaded on input line 2230.
LaTeX Info: Redefining \cref on input line 2230.
LaTeX Info: Redefining \Cref on input line 2230.
LaTeX Info: Redefining \crefrange on input line 2230.
LaTeX Info: Redefining \Crefrange on input line 2230.
LaTeX Info: Redefining \cpageref on input line 2230.
LaTeX Info: Redefining \Cpageref on input line 2230.
LaTeX Info: Redefining \cpagerefrange on input line 2230.
LaTeX Info: Redefining \Cpagerefrange on input line 2230.
LaTeX Info: Redefining \labelcref on input line 2230.
LaTeX Info: Redefining \labelcpageref on input line 2230.
Package cleveref Info: `amsthm' support loaded on input line 2858.
)
No file stackexchange.aux.
\openout1 = `stackexchange.aux'.
LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 9.
LaTeX Font Info: ... okay on input line 9.
LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 9.
LaTeX Font Info: ... okay on input line 9.
LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 9.
LaTeX Font Info: ... okay on input line 9.
LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 9.
LaTeX Font Info: ... okay on input line 9.
LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 9.
LaTeX Font Info: ... okay on input line 9.
LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 9.
LaTeX Font Info: ... okay on input line 9.
LaTeX Font Info: Checking defaults for PD1/pdf/m/n on input line 9.
LaTeX Font Info: ... okay on input line 9.
\AtBeginShipoutBox=\box26
Package hyperref Info: Link coloring OFF on input line 9.
("D:\Program Files\TeX\tex\latex\hyperref\nameref.sty"
Package: nameref 2016/05/21 v2.44 Cross-referencing by name of section
("D:\Program Files\TeX\tex\generic\oberdiek\gettitlestring.sty"
Package: gettitlestring 2016/05/16 v1.5 Cleanup title references (HO)
)
\c@section@level=\count97
)
LaTeX Info: Redefining \ref on input line 9.
LaTeX Info: Redefining \pageref on input line 9.
LaTeX Info: Redefining \nameref on input line 9.
\@outlinefile=\write3
\openout3 = `stackexchange.out'.
! LaTeX Error: No counter 't' defined.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.11 \begin{thm}
Your command was ignored.
Type I <command> <return> to replace it with another command,
or <return> to continue without it.
! Missing number, treated as zero.
<to be read again>
\c@t
l.11 \begin{thm}
A number should have been here; I inserted `0'.
(If you can't figure out why I needed to see a number,
look up `weird error' in the index to The TeXbook.)
! LaTeX Error: Something's wrong--perhaps a missing \item.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.11 \begin{thm}
Try typing <return> to proceed.
If that doesn't work, type X <return> to quit.
! LaTeX Error: Something's wrong--perhaps a missing \item.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.11 \begin{thm}
Try typing <return> to proceed.
If that doesn't work, type X <return> to quit.
! LaTeX Error: Something's wrong--perhaps a missing \item.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.11 \begin{thm}
Try typing <return> to proceed.
If that doesn't work, type X <return> to quit.
! LaTeX Error: Something's wrong--perhaps a missing \item.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.13 \end{thm}
Try typing <return> to proceed.
If that doesn't work, type X <return> to quit.
Package atveryend Info: Empty hook `BeforeClearDocument' on input line 15.
[1
{C:/ProgramData/MiKTeX/2.9/pdftex/config/pdftex.map}]
Package atveryend Info: Empty hook `AfterLastShipout' on input line 15.
(stackexchange.aux)
Package atveryend Info: Executing hook `AtVeryEndDocument' on input line 15.
Package atveryend Info: Executing hook `AtEndAfterFileList' on input line 15.
Package rerunfilecheck Warning: File `stackexchange.out' has changed.
(rerunfilecheck) Rerun to get outlines right
(rerunfilecheck) or use package `bookmark'.
Package rerunfilecheck Info: Checksums for `stackexchange.out':
(rerunfilecheck) Before: <no file>
(rerunfilecheck) After: D41D8CD98F00B204E9800998ECF8427E;0.
Package atveryend Info: Empty hook `AtVeryVeryEnd' on input line 15.
)
Here is how much of TeX's memory you used:
5799 strings out of 493335
96908 string characters out of 3142235
198351 words of memory out of 3000000
9356 multiletter control sequences out of 15000+200000
4294 words of font info for 16 fonts, out of 3000000 for 9000
1141 hyphenation exceptions out of 8191
29i,4n,21p,188b,317s stack positions out of 5000i,500n,10000p,200000b,50000s
<D:/Program Files/TeX/fonts/type1/public/amsfonts/cm/cmr10.pfb>
Output written on stackexchange.pdf (1 page, 14559 bytes).
PDF statistics:
15 PDF objects out of 1000 (max. 8388607)
2 named destinations out of 1000 (max. 500000)
1 words of extra memory for PDF output out of 10000 (max. 10000000)
答案1
更新
此问题已在 hyperref 版本 6.83q 2016-06-24 中修复
对 hyperref 的更改是为了修复此问题
https://github.com/ho-tex/hyperref/issues/11
我刚刚重新打开它,指向这里。
我将更新 hyperref 来解决这个问题(以某种方式:-) 但与此同时,这有效:
\documentclass{article}
\usepackage{amsthm}
\usepackage{hyperref}
\usepackage{cleveref}
\newtheorem{thm}[equation]{Theorem}
\makeatletter
\let\xx@thm\@thm
\AtBeginDocument{\let\@thm\xx@thm}
\makeatother
\begin{document}
\begin{thm}
This is my theorem.
\end{thm}
\end{document}
但你确实收到了警告
pdfTeX warning (ext4): destination with the same identifier
(name{equation.0.1}) has been already used, duplicate ignored
但是该警告也是在 texlive 2015 hyperref 中发出的。
这是 github 问题 #11 试图修复的问题。
目前我刚刚重新打开了这个问题,稍后会寻找一个安全的解决方案,如果有人有任何建议,请随时在这里或在 github 上发表评论 :-)