# [Tex/LaTex] How to number equations only if they are referred to in the text

cross-referencingequationsnumbering

I have a paper where all equations are numbered, but I want to number equations only if they are actually referred to in the .tex file using \ref{}. How can I make that happen? Alternatively, how can I make all equations that have no \label next to them (because then I know I don't refer to them) not have a number? Do I have to use \nonumber separately for each such equation?

The mathtools package provides a switch showonlyrefs. You could use that to achieve that only those equations would be numbered which are referred to in the text.

Usage:

\mathtoolsset{showonlyrefs}


or

\mathtoolsset{showonlyrefs=true}


or set it to false this way if desired.