12

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

  1. \usepackage{hyperref},
  2. \usepackage{cleveref}, or
  3. [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)
  • What do you mean with[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 if cleveref is loaded after \newtheorem…. – Bernard Jun 18 '16 at 22:28
  • 2
    That's exactly what I mean. In the document, everything shares the same counter---theorems, lemma, equations, propositions, etc.. This perhaps isn't the most logical choice, but I chose to number things this way because it makes things easiest to find---if you're looking for Theorem 5.6.24 and you see Equation 5.6.37, you know you need to look back/up.. In any case, even if I were to change this design decision, presumably the problem would remain. I can't imagine that changing the counter here would fix things. Then again, I couldn't imagine this happening in the first place . . . – Jonathan Gleason Jun 18 '16 at 22:38
  • @Bernard That it compiles when cleveref is loaded after \newtheorem is a bit odd--- the documentation explicitly says to load cleveref before all \newtheoremss. I'm guessing, while it may compile, you would lose the cleveref functionality? – Jonathan Gleason Jun 18 '16 at 22:50
  • As I said, load 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? – Bernard Jun 18 '16 at 22:51
  • Your last comment was posted while I was writing mine. To answer your question, you'll lose the cleveref functionality by design, unless you find a way to explain to cleveref which structure corresponds to such and such value of the counter. – Bernard Jun 18 '16 at 22:54
12

UPDATE

This is fixed in hyperref release 6.83q 2016-06-24


The change to hyperref was to fix this issue

https://github.com/ho-tex/hyperref/issues/11

which I have just re-opened, pointing here.

I will update hyperref to address this (somehow:-) but meanwhile, this works:

\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}

You do however get the warning

pdfTeX warning (ext4): destination with the same identifier 
  (name{equation.0.1}) has been already used, duplicate ignored

But that warning was also issued with the texlive 2015 hyperref.

Which was the issue that github issue #11 was trying to fix.

For now I have just reopened the issue, will look later for a safe fix, if anyone has any suggestions feel free to comment here or on github:-)

  • This works perfectly. Thank you! In fact, had you not mentioned the warning, I would not have even noticed---Texmaker doesn't `report' it and I had to look in the log file itself to find it. I actually never noticed this before, and maybe ShareLaTeX has been doing it too all along? This isn't really related to the original question, but why does Texmaker not list this along with other warnings (e.g. an overfull hbox warning)? – Jonathan Gleason Jun 22 '16 at 8:44
  • 1
    @JonathanGleason You'd have to ask the texmaker devs about that:-) probably because the warning comes from pdftex internals, not from hyperref and unlike a latex package warning it doesn't force a newline, I lied a bit above the actual log looks like [1pdfTeX warning... that is, it comes in the middle of the [1] denoting that page 1 is being shipped out. – David Carlisle Jun 22 '16 at 8:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.