# problem with cross reference an equation using cleveref

I want to refer to an equation through my document, so I thought it is beter to use cleveref package, the problem is when I refer to an equation it refer to the section where the equation is.

I work on my thesis so it would be very helpful to use cleveref instead of the regular \ref command.

here, a small example.

\documentclass[a4paper, 14pt,]{extreport}
\usepackage{color, xcolor}
\usepackage{amsmath}
\usepackage{breqn}
\usepackage{varioref}
\usepackage{hyperref}
citecolor=red,
urlcolor=magenta,
\usepackage{cleveref}
\crefname{equation}{equation}{equations}
\newcommand{\p}{\partial}
\newcommand{\beqa}{\begin{eqnarray}}
\newcommand{\eeqa}{\end{eqnarray}}

\begin{document}
\chapter{Mathematical Modelling}\label{ch:math}

\section{Reynolds equation}\label{sec:Reynolds}

The well known Reynolds equation in dimensional form is given below:
\beqa \label{eq:rey_car}
\frac{\p}{\p x}\left(h^3 \frac{\p p}{\p x}\right) + \frac{\p}{\p y}\left(h^3 \frac{\p p}{\p y}\right) = 6\mu U \frac{\p h}{\p x} +12 \mu \frac{\p h}{\p t}
\eeqa
transform ~\cref{eq:rey_car} to polar coordinate by using the following relations:
$$\theta = x R ~~ , ~~ z = \frac{L}{2} y$$
\beqa\label{eq:rey_polar}
\frac{\p}{\p \theta}\left(h^3 \frac{\p p}{\p \theta}\right) + \left(\frac{D {L}\right)^2 \frac{\p}{\p z} \left(h^3 \frac{\p p}{\p z}\right) = 6 \mu U R \frac{\p h}{\p \theta} + 12 \mu R \frac{\p h}{\p t}
\eeqa
now, to get the dimensionless form of \vref{eq:rey_polar}
\end{document}


this is the output

• Never ever use eqnarray: you have discovered one of the reasons why. Jul 30 '16 at 19:49
• @egreg well, what else could I use, with the same features of eqnarray? Jul 30 '16 at 19:52
• I work on my thesis, so I usually need to use eqnarray. Jul 30 '16 at 19:53
• No, you don't need it. With amsmath you have many other possibilities which also work with cleveref. Jul 30 '16 at 19:57

You have discovered one of the many reasons eqnarray should be avoided.

1. Never use eqnarray (see eqnarray vs align)
2. Never use $$ (see Why is $...$ preferable to$$ ... ?)
3. Never have two consecutive displays
4. For single equations, use equation

In order to comply with 2 and 3 in your case, use gather.

\documentclass[a4paper, 14pt]{extreport}
\usepackage{color, xcolor}
\usepackage{amsmath}
\usepackage{varioref}
\usepackage{hyperref}
\hypersetup{
citecolor=red,
urlcolor=magenta,
}
\usepackage{cleveref}
\crefname{equation}{equation}{equations}

\newcommand{\p}{\partial}

\begin{document}

\chapter{Mathematical Modelling}\label{ch:math}

\section{Reynolds equation}\label{sec:Reynolds}

The well known Reynolds equation in dimensional form is given below:
$$\label{eq:rey_car} \frac{\p}{\p x}\left(h^3 \frac{\p p}{\p x}\right) + \frac{\p}{\p y}\left(h^3 \frac{\p p}{\p y}\right) = 6\mu U \frac{\p h}{\p x} +12 \mu \frac{\p h}{\p t}$$
transform~\cref{eq:rey_car} to polar coordinate by using the following relations:
\begin{gather}
\theta = x R, \quad z = \frac{L}{2} y \nonumber \\
\frac{\p}{\p \theta}\left(h^3 \frac{\p p}{\p \theta}\right) +
\left(\frac{D}{L}\right)^2 \frac{\p}{\p z} \left(h^3 \frac{\p p}{\p z}\right) =
6 \mu U R \frac{\p h}{\p \theta} + 12 \mu R \frac{\p h}{\p t}
\label{eq:rey_polar}
\end{gather}
Now, to get the dimensionless form of \vref{eq:rey_polar}
\end{document}


• @egred thanks a lot, if I want to right a couple of equations I was useing eqnarray, now what should I use? Jul 30 '16 at 20:01
• @MuhammadAbdulrasool You can use align; there are many examples on the site. Jul 30 '16 at 20:02