Since autonum
doesn't play nicely with cleveref
(nor does the mathtools
automatic numbering option work for me), I'm looking for a simpler solution. I'd like equations to be numbered automatically if they have a label in them and not otherwise. How do I accomplish this?
See enter link description here to see what the problem is with autonum
and cleveref
.
\documentclass{amsart}
\usepackage{cleveref}
\begin{document}
\begin{multline} \label{eq:one} % must have a number
z=a+b+c+d+e+f+g\\
+ h+i+j+k+\ell+m+n+o+p+q+r+s+t+u+v+w+x+y.
\end{multline}
\begin{multline} % must not have a number
z=a+b+c+d+e+f+g\\
+ h+i+j+k+\ell+m+n+o+p+q+r+s+t+u+v+w+x+y.
\end{multline}
\begin{gather} \label{eq:two} % must have a number
x=y
\end{gather}
\begin{gather} % must not have a number
x=y
\end{gather}
\end{document}
Best Answer
You have misunderstood the purpose of
autonum
. What determines whether an equation is numbered is not whether it has a\label{}
, but whether it is referenced at any point, in other words - whether the document contains a\ref{}
referring to that equation or not.The
\cref{}
command is also supported, ifcleveref
is loaded.For example:
If you don't want an equation numbered and know you'll never refer to it, you may just as soon use the starred form of the environment. The
autonum
package is intended specifically to avoid the need to alter the equation itself based on whether it is ever referred to. If it depended on the addition or deletion of a\label{}
, the package would lose its point since adding or deleting a star is at least as easy and, arguably, easier.