Tell me more ×
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.

Is is possible to use only equation or align environments without the * and then automatically suppress the equation number if there is nothing refering to that equation? It would make the LaTeX-life much easier I think.

share|improve this question
1  
possible duplicate of How to organize labels when there are too many equations? – Lev Bishop Apr 14 '11 at 14:06
2  
See also tex.stackexchange.com/questions/4728/… – Lev Bishop Apr 14 '11 at 14:12

2 Answers

up vote 13 down vote accepted

see package mathtools and section "3.2.2 Showing only referenced tags". You'll get the documentation by running texdoc mathtools or run texdoctk if you run Linux

share|improve this answer
Thanks! The package looks very useful. – Jonas Teuwen Apr 14 '11 at 13:31

I coded up a workaround before I noticed Herbert's answer. Here it is anyway:

\documentclass{article}
% TEX.SE \url{http://tex.stackexchange.com/q/15820/1402}
\usepackage{amsmath}
\usepackage{etoolbox}

\makeatletter
\appto{\equation}{%
  \notag
  \preto{\label}{%
    \refstepcounter{equation}
    \tag{\arabic{equation}}%
  }
}
\makeatother

\begin{document}

\begin{equation}
A = A
\end{equation}

\begin{equation}\label{B}
B = B
\end{equation}

\begin{equation}
C = C
\end{equation}

Proof: See Equation~\ref{B}.

\end{document}

It's my first use of the etoolbox macros to prepend and append code to hooks. This method first appends \notag to every equation beginning, thus suppressing equation numbering; then prepends to \label the code which steps the counter and resets the tag.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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