Yong Wan
Yong Wan

Reputation: 13

Latex package conflict between {cleveref} and {amsmath}

I upgraded the package “amsmath” to its latest version 72739 through texlive on November 4, 2024. After this, I run my tex file through pdflatex by using texstudio. However, please see the following code:

\usepackage{amsmath}
\usepackage{cleveref}

\begin{align}
 \label{oneo}
 x&=y,\\
 z&=u,\\
 \label{cnoe}
 t&=m,\\
 n&=b.
\end{align}

Although all the above code can be compiled, the result of the code outputs:

the output when using both packages of {cleveref} and {amsmath}

If I delete \usepackage{cleveref}, I get:

The output when only using package {amsmath}

Please note that, if I use the old version of {amsmath}, there is no any problem.

I have tried to use another package to substitute {cleveref}, but I have not found an appropriate package for this.

Upvotes: 1

Views: 110

Answers (1)

This is the same problem as in https://tex.stackexchange.com/a/730127/36296

\documentclass{article}

\usepackage{amsmath}
\usepackage{cleveref}

\RemoveFromHook{label}[firstaid/cleveref]
\makeatletter
\AddToHook{label}[firstaid/cleveref]
         {\ifx
           \@currentcounter\@empty
          \else
           \firstaid@cref@updatelabeldata{\@currentcounter}%<--- was missing
          \fi} 
\makeatother

\begin{document}

\begin{align}
\label{oneo}
 x&=y,\\
 z&=u,\\
\label{cnoe}
 t&=m,\\
 n&=b.
\end{align}

\end{document}

enter image description here

Upvotes: 0

Related Questions