hyperref
hyperref copied to clipboard
hyperref + \newlist from enumitem has stopped working against LaTeX2e <2024-11-01> pre-release-4
MWE (works fine with pdflatex)
\documentclass{article}
\usepackage{enumitem}
\newlist{sequence}{enumerate}{2}
\usepackage{hyperref}
\begin{document}
\begin{enumerate}[label=\arabic*]
\item Item 1.
\label{enum:1}
\item Item 2.
\label{enum:2}
\end{enumerate}
Item~\ref{enum:1} precedes item~\ref{enum:2}.
\begin{sequence}[label=\arabic*]
\item Step 1.
\label{seq:1}
\item Step 2.
\label{seq:2}
\end{sequence}
Step~\ref{seq:1} precedes step~\ref{seq:1}.
\end{document}
Building with pdflatex-dev ends up with this error:
! You can't use `\relax' after \the.
<recently read> \c@sequencexcii
l.18 \item S
tep 1.
?
Commenting out \usepackage{hyperref} can work around the error, but that wouldn't work for me.
I'm sorry but I have no idea which of hyperref, enumitem or latex2e pre-release-4 is to blame.
Can you please have a look into this?
LaTeX2e pre-release-4 is to blame. I've reported it to https://github.com/latex3/latex2e/issues/1508.
In your example, the \theHsequencei was illy defined.
\documentclass{article}
\usepackage{enumitem}
\newlist{sequence}{enumerate}{2}
\def\fooname{foo}
\newcounter{\fooname}
\show\theHsequencei
\show\theHfoo
\begin{document}
\end{document}
\show\theHsequencei
expected: ->\the \value {sequencei}
actual: ->\the \value {\enit@c \romannumeral \count@}
\show\theHfoo
expected: ->\the \value {foo}
actual: ->\the \value {\fooname}
BTW in the original example, \refstepcounter{sequencei} raises the same error.
@muzimuzhi Thank you for the quick triage and the fix to latex2e! As https://github.com/latex3/latex2e/issues/1508 was closed, I'm closing this issue now.