5

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}
  • 3
    Sorry, I do not understand the concept of the exclusive numbering of labeled equations. The purpose of the numbers is to identify an equation easily. The numbers are not for the writer of a paper, but for the reader, who can then reference equations, discuss them with others or the author, ... If equations do not have numbers, then they are either too unimportant and can be removed saving time for writing and reading. Or the missing numbers are an annoyance for the readers. (Or it is a write-only document?) – Heiko Oberdiek Sep 2 '15 at 20:08
  • I respectfully disagree. I find redundant equation numbers distracting, plus in my two disciplines, it is common to number only equations that are referenced. – JPi Sep 2 '15 at 20:24
  • @JPi: out of curiosity, what are your disciplines? – onewhaleid Sep 2 '15 at 23:47
2

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 i.e. whether the document contains a \ref{} referring to that equation. \cref{} is also supported, if cleveref is loaded.

For example:

\documentclass{article}
\usepackage{amsmath,cleveref,autonum}
\begin{document}
\begin{multline}\label{eq:a}
 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}\label{eq:b}
 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:c}
 x=y
\end{gather}
\begin{gather}\label{eq:d}
 x=y
\end{gather}
We reference the first \verb|multline| environment, but not the second, and the second \verb|gather| environment, but not the first.
Hence. only \cref{eq:a} and \cref{eq:d} will be numbered, even though all equations are labelled.
\end{document}

only referenced equations are numbered

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.

| improve this answer | |
  • No, I did not misunderstand. I've given up on autonum since it's way too fussy about other packages and want a work around. – JPi Sep 3 '15 at 2:22
  • 1
    @JPi But do you want something which does the job it is supposed to do? Or do you want something which works in the way you explain in your question? Because those are quite different: autonum would not label any of the equations in your MWE because none of them are ever referenced. Yet your comments there indicate that you think that two of them should get numbered. That's a misunderstanding of the job autonum is intended to do. If you want something which does something different, that's another matter. – cfr Sep 3 '15 at 11:49
  • Yes, I know that. Ideally, I want autonum that works. On this forum, it's too much to ask for someone to provide me with that. Given that I only ever label the equations that I reference anyway, I'm ok with a solution that only gives numbers to equations that I label. (I understand I can manually tag/untag). – JPi Sep 3 '15 at 12:21
  • 1
    @JPi So why not just use the starred versions? – cfr Sep 3 '15 at 13:26
  • @JPi Less typing, though - how can it be more hassle? – cfr Sep 3 '15 at 19:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.