5

In the MWE below cleveref produces `section 1' instead of a reference to equation 2. What's the easiest fix? (other than using \eqref or (\ref))

\documentclass{article}


\usepackage{cleveref}
\usepackage{cases}


\begin{document}

\section{Intro}

\begin{numcases}{}
 a=b \\
 c=d. \label{c=d}
\end{numcases}

Cleveref produces a reference to the section: \cref{c=d} 

Regular ref produces a reference to the equation: \ref{c=d}.
\end{document}
JPi
  • 13,595

1 Answers1

7

Without the use of cases and with much code copied from Thorsten Donig:

% arara: pdflatex
% arara: pdflatex

\documentclass{article}
\usepackage{empheq} % loading `mathtools` % loading `amsmath`
\usepackage{cleveref} % load this as very last package

\begin{document}    
    \section{Intro} 
    \begin{empheq}[left={=\empheqbiglbrace~}]{align}
    a&=b\\
    c&=d\label{eq:equation} 
    \end{empheq}
    Cleveref produces a reference to the section: \cref{eq:equation} 

    Regular ref produces a reference to the equation: \ref{eq:equation}.
\end{document}

enter image description here


PS: The package cases isn't maintained (referring to uploads on CTAN) since 2002 and the problem with cleveref has been spotted already but not fixed. So maybe you should not use this package for your case.

Mensch
  • 65,388
LaRiFaRi
  • 43,807