I almost always use ShareLaTeX for my LaTeX needs, but I recently began work on a relatively large document, and so I figured I would give a local TeX distribution a try to see if I could speed up the compile times. I thus decided to download MikTeX 2.9.5997 64-bit for Windows and used TeXstudio as my front end. I then simply copy and pasted my project into TeXstudio, expecting it to run, but instead I found a plethora of errors.
I tried downloading TeX Live instead, as well as TeXmaker, and tried all four combinations (both front-ends with both distributions), and in all cases, I found the same exact errors.
I then proceeded to simply cut-down my file to try to isolate the problem. What follows is the resulting 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}
This throws about 6 errors, the first being "No counter 't' defined", the second being "Missing number treated as 0", and the remaining being "perhaps a missing \item", all of which are thrown on the \begin{thm}
line except the last error which is thrown on the \end{thm}
line. Furthermore, (I) this document compiles fine in ShareLaTeX, and (II) if you remove any of
\usepackage{hyperref}
,\usepackage{cleveref}
, or[equation]
in the\newtheorem
line,it will likewise compile just fine.
What on earth could be causing such an error?
UPDATE 1: It also complies fine if you remove \usepackage{amsthm}
. I also confirmed that the problem still occurs if you use a different counter.
UPDATE 2: I confirmed that this does compile correctly with TeX Live 2015. After checking the respective CTAN pages, it seems as if the only package being used here which has been updated since 2015 is hyperref
. I suppose this means that a bug must have been introduced into the hyperref
package?
Log file:
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)
[equation]
? Normally a counter in this position is for a shared counter. Equations and theorems sharing the same counter seems strange. That said, it compiles ifcleveref
is loaded after\newtheorem…
.cleveref
is loaded after\newtheorem
is a bit odd--- the documentation explicitly says to loadcleveref
before all\newtheorems
s. I'm guessing, while it may compile, you would lose thecleveref
functionality?cleveref
at the end, and it will compile fine. But in this case, cleveref will be of no use: it is supposed to know (and print) which type of structure a given counter is associated?. How do you want it to find its way if the same counter can correspond to an equation as well as a theorem or a corollary?