1

This question already has an answer here:

I have a file which compiles fine with TeX Live 2015, but which bugs on TeX Live 2016. When compiling with TeX Live 2016, (after I clean up all the non-source files) I get the following error:

! LaTeX Error: No counter 'd' defined.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.27 \begin{defn}

? 

Please have a look at the following minimal working example, in which I encounter this bug.

\documentclass{article}

\usepackage{amsthm}

\usepackage{aliascnt}

\usepackage[colorlinks,citecolor=darkgreen,linkcolor=darkgreen,unicode]{hyperref}

\usepackage[capitalize]{cleveref}

\def\defthm#1#2#3{%
  %% Ensure all theorem types are numbered with the same counter
  \newaliascnt{#1}{thm}
  \newtheorem{#1}[#1]{#2}
  \aliascntresetthe{#1}
  %% This command tells cleveref's \cref what to call things
  \crefname{#1}{#2}{#3}}

\newtheorem{thm}{Theorem}[section]
\crefname{thm}{Theorem}{Theorems}

\theoremstyle{definition}
\defthm{defn}{Definition}{Definitions}

\begin{document}

\begin{defn}
This definition causes trouble in TeX Live 2016, but not in TeX Live 2015.
\end{defn}

\end{document}

marked as duplicate by David Carlisle, user13907, Werner, Stefan Pinnow, Community Jun 23 '16 at 12:10

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • I've marked it as a duplicate, but actually the title here is more informative, I may change the title of the other one. – David Carlisle Jun 23 '16 at 11:23
  • @DavidCarlisle: When you do, also remove the sharelatex tag. – Werner Jun 23 '16 at 11:49
  • I cannot yet confirm that the solution in the other question indeed solves the problem. It solves it for the MWE, but not for the file I'm actually interested in, although I cannot really pin down the problem yet. – Egbert Jun 23 '16 at 12:02
  • Actually it works. – Egbert Jun 23 '16 at 12:09
  • 1
    @Egbert can you drop me an email (google my name should show my gmail) I have a version you could test. – David Carlisle Jun 24 '16 at 9:22