# Reference equation in align* environment with cleveref

In order to control equations numbering I use the Align* environment where I put \numberthis at the end of the equation that I want to number. After, I label the numbered equation but when I want to make a reference to that equation using \cref command of the cleveref package I obtain a wrong reference (to another page). It is working with the minimal working example below, but it is not working in my thesis document (the reference send me to a figure in the page before the equation). Could some one say to me if there is something wrong ?

\documentclass[12pt,a4paper,english,french]{book}
\usepackage{amsmath}
\newcommand\numberthis{\addtocounter{equation}{1}\tag{\theequation}} % for numbering in  the align* environment
\begin{document}
Text
\begin{align*}
a & = b \numberthis \label{eqn413} \\
c & = d \\
e & = f \\
\end{align*}
\newpage
The \cref{eqn413} show that bla bla.
\end{document}

• you could use the align (not starred) environment, and put \notag on the lines you don't want numbered. that should keep everything in synch. – barbara beeton Jan 5 '14 at 23:31

You should use \refstepcounter{equation} to get links correctly:

\documentclass[12pt,a4paper,english,french]{book}
\usepackage{amsmath}
\newcommand\numberthis{\refstepcounter{equation}\tag{\theequation}} % for numbering in  the align* environment
\begin{document}
Text
\begin{align*}
a & = b \numberthis \label{eqn413} \\
c & = d \\
e & = f \\
\end{align*}
\newpage
The \cref{eqn413} show that bla bla.
\end{document}


Further, it may be better label like \label{eq:<some name you will easily remember>} instead of numbers. eq says that it is an equation label and the name is unique to that equation. Please refer to: this Q and its answers.

• It's working good !. For your comment, I'd say it is not possible for me to use the : in the label equation. For exemple when I use label{eq:exemple} there will be an error message ! Missing \endcsname inserted. <to be read again> \penalty. But it is working with label{eqexemple} without the :. – Houssem Jan 5 '14 at 23:44
• @user40953 That was some advertisement on good habits :-) I don't know why it throws an error for you though unless there is some mwe for it ;-). I doubt it on babel. – user11232 Jan 5 '14 at 23:46
• You have right :-). I use babel in my thesis deocument and when I added \usepackage[frenchb]{babel} to the MWE above I get the error message. Do you suggest a solution for that :-) ? – Houssem Jan 5 '14 at 23:53
• What I do in such a case is to use \label{eq-exemple} instead. This is because with frenchb, ‘:’ is an active character, while ‘-’ is not. – Bernard Jan 5 '14 at 23:58
• @user40953 That will be a candidate for a separate new question, I believe. But, if it doesn't affect other things for you, you may put \shorthandoff{:} after the \begin{document}. – user11232 Jan 6 '14 at 0:01