6

This is a little different from Cleveref and breqn packages don't play nice together, and may not have a simple answer.

I was experimenting with breqn, and found some of my tagged equations were mislabeled by cleveref:

\documentclass{article}
\usepackage{breqn}
\usepackage{cleveref}

\begin{document}

\begin{dmath}\label{first}
  a = b + c
\end{dmath}
This is \cref{first}.

\begin{dmath}[number = {$\star$}]\label{second}
  a = b + c
\end{dmath}
This is \cref{second}.

\end{document}

The result

I presume this is because cleveref doesn't patch whatever mechanism breqn is using for creating equation tags via [number = {...}].

Is there an easy workaround? If not, it would preclude me from going further with breqn, which would be a pity.

2
  • In what way is the question different from the linked one? It appears to be identical? Aug 28, 2014 at 21:46
  • The linked one doesn't explicitly use [number = {...}]. In any case, the problem discussed there has now been fixed (as can be seen from the first equation in my example).
    – Derek
    Aug 28, 2014 at 22:09

1 Answer 1

4

The solution from Cleveref and breqn packages don't play nice together needs only one small adjustment:

\documentclass{article}
\usepackage{breqn}
\usepackage{cleveref}

\makeatletter
\let\cref@old@eq@setnumberOld\eq@setnumber
\def\eq@setnumber{%
\cref@old@eq@setnumberOld%
\cref@constructprefix{equation}{\cref@result}%
\protected@xdef\cref@currentlabel{%
[equation][\arabic{equation}][\cref@result]\p@equation\eq@number}}
\makeatother

\begin{document}

\begin{dmath}\label{first}
  a = b + c
\end{dmath}
This is \cref{first}.

\begin{dmath}[number = {$\star$}]\label{second}
  a = b + c
\end{dmath}
This is \cref{second}.

\end{document}

gives:

Example output

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .