[Tex/LaTex] Reference equation in align* environment with cleveref

aligncleverefcross-referencinghyperref

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
\usepackage[colorlinks=true, linkcolor=blue]{hyperref}
\usepackage[nameinlink]{cleveref}
\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}

Best Answer

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
\usepackage[colorlinks=true, linkcolor=blue]{hyperref}
\usepackage[nameinlink]{cleveref}
\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.