Open cfr42 opened 3 weeks ago
It's the \refstepcounter[plemma]{chapter}
used by \begin{plemma}
that throws the error.
cleveref
assumes the hyperref
-patched \refstepcounter
always call \H@refstepcounter
, thus it further patches \H@refstepcounter
to add its own logic, especially the logic to update \cref@currentlabel
.
But now hyperref
doesn't redefine \refstepcounter
anymore and \H@refstepcounter
is never used in it. This leaves the \cref@currentlabel
in its initial value (which is empty) and an error is thrown when it's updated by
\protected@edef\cref@currentlabel{%
\expandafter\cref@override@label@type%
\cref@currentlabel\@nil{#1}}%
It's so messy that I don't fully understand the patching dependencies.
The LaTeX firstaid
already contains some patch for cleveref
(see for example https://github.com/latex3/latex2e/commit/3d8c18544c01f88703fd88ce77118d82df32aa23), so perhaps the fix will eventually go into firstaid
too.
I guess same kind of issue with:
\documentclass{article}
\usepackage{listings}
\usepackage{hyperref}
\usepackage{cleveref}
\begin{document}
\begin{lstlisting}
Foo
\end{lstlisting}
\end{document}
which fails to compile with:
^C
! Interruption.
\lsthk@EveryPar ...entprefix {\cref@currentprefix
}
l.7 Foo
?
@dbitouze I have a fix for this in a branch. I will handle that later today.
I'm not sure where this bug belongs. I also can't reproduce locally because even a new install of TL is out of date. Simplified version of this example:
I realise this is probably not really
hyperref
's fault and it should be fixed incleveref
but .... In any case, apologies for reporting it here.