# How to turn equation tags off by default?

I'm writing a document in which very few of the equations actually need tags. So instead of using starred environments, I would much prefer to exchange the meaning of the starred with the non-starred environments. I don't mind if I need to specify each environment for which I want this done, so that I would have something like the following in my preable:

\makeatletter
%some TEX-fu magic that defines \exchangest@renv goes here
\exchangest@renv{equation}
\exchangest@renv{align}
\exchangest@renv{gather}
\exchangest@renv{alignat} %this might be a hard one as it takes an agument!
\makeatother


and then when using I'd get the non-starred version, while the starred version \begin{equation*} would have a tag.

PS. Not sure what tags I should use for this....

-
Not an answer to your question, but you could use this instead. –  Hendrik Vogt Dec 20 '10 at 11:07
This works in a pinch (for now), but if I want to turn on the tag without ref'ing the equation, I'm not sure how to do that (I could use phantom and clap or something crazy I guess) but a starred version for showing tags would be nice. –  Yossi Farjoun Dec 20 '10 at 11:21

\documentclass{article}

\usepackage{amsmath}
\makeatletter
\def\newIF{%
\count@\escapechar \escapechar\m@ne
\let\ifst@rred\iffalse
\def\st@rredtrue{\let\ifst@rred\iffalse}
\def\st@rredfalse{\let\ifst@rred\iftrue}
\escapechar\count@}
\def\ChangeStar{\newIF
\renewenvironment{equation}{%
\incr@eqnum
\mathdisplay@push
\st@rredfalse \global\@eqnswfalse
\mathdisplay{equation}%
}{%
\endmathdisplay{equation}%
\mathdisplay@pop
\ignorespacesafterend
}
\renewenvironment{equation*}{%
\mathdisplay@push
\st@rredtrue \global\@eqnswtrue
\mathdisplay{equation*}%
}{%
\endmathdisplay{equation*}%
\mathdisplay@pop
\ignorespacesafterend
}}
\def\OldStar{\newif\ifst@rred
\renewenvironment{equation}{%
\incr@eqnum
\mathdisplay@push
\st@rredfalse \global\@eqnswtrue
\mathdisplay{equation}%
}{%
\endmathdisplay{equation}%
\mathdisplay@pop
\ignorespacesafterend
}
\renewenvironment{equation*}{%
\mathdisplay@push
\st@rredtrue \global\@eqnswfalse
\mathdisplay{equation*}%
}{%
\endmathdisplay{equation*}%
\mathdisplay@pop
\ignorespacesafterend
}}
\makeatother

\ChangeStar
\begin{document}

$$y=x$$

\begin{equation*}$$y=x$$\end{equation*}

\begin{align}$$y=x$$\end{align}

\begin{align*}$$y=x$$\end{align*}

\OldStar

\begin{align}$$y=x$$\end{align}

\begin{align*}$$y=x$$\end{align*}

\end{document}

-
@Herbert: Works for align, but not for equation.. –  Yossi Farjoun Dec 20 '10 at 14:41
why do you need the equation environment? align does it all –  Herbert Dec 20 '10 at 14:58
I changed the code. On the a quick view I do not see an easy solution, because equation is handled diffrent to the align environments. –  Herbert Dec 20 '10 at 15:26
wowsers....I didn't expect this...OK I guess I'm asking for some serious under-the-hood operation.... –  Yossi Farjoun Dec 20 '10 at 15:47
@Herbert, could there not be a way to do an \g@add@to@env is a similar way to the nifty \g@add@to@macro ? and then to the equation* env you add a \incr@eqnum and to the equation* you add a \let\incr@eqnum\relax...would that work? –  Yossi Farjoun Dec 20 '10 at 15:55

As Hendrik suggested in the comments, you can use mathtools with \mathtoolsset{showonlyrefs} to mark the equations you actually reference. For additional equations that you want to be numbered, but don't want to reference, you use \noeqref. For example,

\documentclass{article}
\usepackage{mathtools}
\mathtoolsset{showonlyrefs}
\begin{document}
$$\label{eq:asdf} adsf$$
\noeqref{eq:asdf}
\end{document}


This requires minimal extra work, but make sure you read the mathtools documentation carefully to make sure you understand the interaction this has with amsmath.

-