LaTeX equations: to number, or not to number

How to make all equations numbered, even in starred environments…    #latex #equations #starred #numbered

When writing equation-laden documents, it is good practice to number only those equations that are actually referred to. However, it is often useful—especially when writing with (remote) co-authors—to have everything numbered, so as to be able to say: “there is an error in equation 3.5.1.” This is much easier than saying, for example, “look at page 58, the second equation counting from the bottom has a mistake.”

The way I deal with this, is using starred environments—equation*, align*, etc.—unless I really need to refer back to some equation (in which case, I use the starless version). When I need to get everything numbered, I call upon the wisdom of \renewenvironment, by dumping the following in the preamble:

\NewCommandCopy\oldequation\equation
\NewCommandCopy\oldendequation\endequation
\renewenvironment{equation*}{\oldequation}{\oldendequation}

\NewCommandCopy\oldalign\align
\NewCommandCopy\oldendalign\endalign
\renewenvironment{align*}{\oldalign}{\oldendalign}

\NewCommandCopy\oldgather\gather
\NewCommandCopy\oldendgather\endgather
\renewenvironment{gather*}{\oldgather}{\oldendgather}

These are the environments I use most, and so are the ones I tested—but it may work for others. Happy writings!

June 26, 2023. Got feedback? Great, email is your friend!