2

I am on a Linux system running TeX Live 2023 installed manually (not through the distro's repo), and up to date at the time of this writing (2023-04-21).

The following short document has started erroring after the most recent upgrade:

\documentclass[11pt]{article}

\usepackage{mathtools}

\usepackage{hyperref}

\usepackage{ntheorem} \usepackage{cleveref}

\theoremstyle{plain} \newtheorem{lemma}{Lemma}[section]

\title{}

\begin{document}

\maketitle

\begin{lemma}

\end{lemma}

\end{document}

Specifically, the error I receive is

ERROR: LaTeX Error: No counter '[' defined.

It goes away under any of the following circumstances:

  1. I comment out \usepackage{hyperref}

  2. I comment out \usepackage{cleveref}

  3. I move \usepackage{cleveref} above \usepackage{ntheorem}

I would like to use all three packages, so that 1. and 2. aren't really fixes. As for 3., it too has drawbacks: if it loads before ntheorem, cleveref seems to lose track of environment types when cross-referencing: \Cref{blah} always produces Lemma <blah> even if <blah> was something else (theorem, proposition, definition, etc.).

This is not happening on other systems I have access to (still Linux, still TeX Live 2023), which update their respective TeX Live distributions more rarely. I distinctly remember hyperref received a very recent upgrade that may have introduced this.

Edit

I have followed the advice in one of the comments below to roll back hyperref. Since I did not immediately how to do this, I am recording that here (per this other answer):

One first lists abvailable versions to revert to:

$ tlmgr restore hyperref
Available backups for hyperref: 65758 (2023-04-21 17:23)

and then, to actually effect the restoration:

$ tlmgr restore hyperref 65758
Do you really want to restore hyperref to revision 65758 (y/N): y

This will do fine for now: the file compiles all right on this earlier version of the package.

grobber
  • 181
  • FWIW, I can confirm that this issue arises in a fully up-to-date MacTeX2023 distribution as well. Since neither ntheorem nor cleveref have received an update of late, a change in hyperref (which was updated most recently on Apr 20, i.e., just two days ago) may be the source of the issue. Note that I'm not going as far as calling it a "bug". – Mico Apr 22 '23 at 05:36
  • I will look later today. – Ulrike Fischer Apr 22 '23 at 06:24
  • 1
    grr, I forgot that cleveref redefines \refstepcounter to use an optional argument (and then redefines ntheorems @thm to inject that). I will send a fix to ctan later today or tomorrow, for now at best use the backup option of tlmgr to revert to the previous hyperref version. – Ulrike Fischer Apr 22 '23 at 08:34
  • Thanks! The reversion suggestion worked fine. I have edited the original post to spell out how to do this, for anyone who might find their way here (I was unaware of the reversion capability myself; have never had to do it). – grobber Apr 22 '23 at 10:14
  • 1
    I have uploaded a new version which should fix that. Sorry. – Ulrike Fischer Apr 22 '23 at 12:39

0 Answers0