cref reference format for label type `' undefined
You have to put the \label
command after the \caption
. Then, both \vref
and \cref
will work.
The reason for the error is that cleveref
and varioref
cannot determine the type of the label unless \caption
is issued first. Putting the label after the caption will tell cleveref
and varioref
that the object's type is, in both of the examples you give, figure
.