latex3 / hyperref

Hypertext support for LaTeX
168 stars 37 forks source link

hyperref + \newlist from enumitem has stopped working against LaTeX2e <2024-11-01> pre-release-4 #357

Open akiyks opened 3 hours ago

akiyks commented 3 hours ago

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?

muzimuzhi commented 2 hours ago

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}