Error resulting from hyperref-cleveref-ntheorem interaction: No counter '[' defined
Stuart Little
achirvasub at gmail.com
Sat Apr 22 04:42:38 CEST 2023
I am on a Linux system running [TeX Live 2023](https://www.tug.org/texlive/) 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.
More information about the texhax
mailing list.