Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Possible Duplicate:
How do I number equations only if they are referred to in the text?

I would like to number only the equations I actually refer in a manuscript. I know plenty of ways to do this manually, but as the manuscript progresses and I change which equations I refer to later I am likely to forget to change the display style of those equations.

I would really like a way to make latex automatically recognize that an equations is being referred and typeset all equations not referred unnumbered, and typeset all equations that are referred using \ref{} with numbers in the right margin.

share|improve this question
add comment

migrated from stackoverflow.com Aug 16 '11 at 10:40

This question came from our site for professional and enthusiast programmers.

marked as duplicate by Seamus, lockstep, Caramdir, Alan Munn, Martin Scharrer Aug 17 '11 at 16:57

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1 Answer

Add this to your preamble:

\usepackage{mathtools}
\mathtoolsset{showonlyrefs}

Awkwardly, as pointed out in the comments, this only works if each equation is referenced at least once with \eqref. (As long as there is one \eqref, other \refs to the same equation will work.

share|improve this answer
1  
Please note this may have a sideeffect: Sadly this turns of the proximity detection system within the amsmath environments. In other works the equation will act as if there is no equation number with regard to horizontal positioning of the equation. There is currently no solution to this problem. –  daleif Aug 16 '11 at 12:34
1  
(Originally a proposed edit by user7295) You might also have to use \eqref instead of \ref. –  lockstep Aug 17 '11 at 12:09
add comment

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