Cleveref and breqn packages don't play nice together

An alternative answer, which allows you to use \label as normal:

The problem is caused by the fact that cleveref relies on redefining \refstepcounter, while breqn doesn't actually use this to advance the equation counter. Fortunately the cleveref code for dealing with footnotes, which don't use \refstepcounter either, provides a basis for dealing with dmaths as another special case by adding some code to \eq@setnumber:

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

Including this code in the preamble yields the correct result for the MWE.


I used to use Ant's makeatletter method, but with the packages contained in the Feb 2014 MikTex 2.9 installation:

Package: cleveref 2013/12/28 v0.19 Intelligent cross-referencing
Package: breqn 2012/05/10 v0.98b Breaking equations

this starts causing:

TeX capacity exceeded, sorry [input stack size=5000]

errors.

It also seems like dmath and cleverref now play together well by default, so upgrading the latex packages now appears to be a viable solution.


Not ideal, but a workaround is to add an optional argument equation to each label:

\label[equation]{equ:test}