Because I have many equations in my document and most of them do not need to be referred to, I always use \begin{align*}...\end{align*}. For the times I do need an equation number I have written a command


This works great, only cleveref does not sort it. An example


  foo \nr\label{eq1}\\
  bar \nr\label{eq2}



This outputs "eqs. (2) and (1)" instead of "eqs. (1) and (2)". Is there a way to fix this?


2 Answers 2


(Not a solution, just a deeper analysis of the problem.)

It appears that the problem is related to the way the \tag macro is defined by the amsmath package. In the code given below, the equation numbers are sorted correctly if one (i) defines two unnumbered displayed equations via \[...\] and (ii) uses \eqno (a "primitive" TeX macro) instead of \tag. Unfortunately, the amsmath package does not permit using \eqno in its math environments.

enter image description here

\setlength\textwidth{2in}  % just for this example

\newcommand{\nr}[1]{%  first method uses \tag
\newcommand{\nrx}[1]{% second method uses \eqno


  foo \nr{eq1}\\
  bar \nr{eq2}

\[ newfoo \nrx{eq3} \]
\[ newbar \nrx{eq4} \]

  • thanks for your research. Now I have another question: why does \addtocounter{equation}{1} instead of \refstepcounter{equation} in the second command give me errors? Commented Jan 20, 2015 at 18:57
  • 1
    @NikkiBisschop - I assume you're getting the error message "Missing number, treated as zero." As a rule, use only \refstepcounter to increment a counter if cross-referencing to the numbered item is an objective.
    – Mico
    Commented Jan 20, 2015 at 18:57

Super late answer, but his seems to work well.


% just make sure that cleveref is included last (even after hyperref if used)

  x &= 1 \nonumber \\
  x &= 2 \nonumber \\
  x &= 3.14159 \label{eq:1}\\
  y &= 4 \label{eq:2}

The first two equations are unnumbered (e.g., working out details) and \cref{eq:2,eq:1} are referenced correctly by cleveref.
Note that by default cleveref will sort the list.
Now, if you want to refer to equation 2 before equation 1 you must be explicit with cleveref, like \cref{eq:2} and \labelcref{eq:1}.
This sorting behavior can be changed globally with the option nosort.



You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .