Hello,
I am using an align* environment because for nearly all of my lines, i do not want them to be numbered. But for a few certain ones, I do want them numbered. My question is how to get this done automatically.
I do know of two ways to do this, but they are not automatic and somewhat laborious. One is to use the align environment, and put a \notag command on every line where you don't want it numbered. The second way is to use align* and add a \tag{...} on the lines you do want numbered, but then these numbers are not automatically updated.
Any ideas?
Thanks in advance,
Text Formatting ⇒ automatic numbering in align* environment
automatic numbering in align* environment
There is a simple, automatic way to do so, provided that you cite all the numbered equations. This is a reasonable requirement (if you never refer to a numbered equation, why do you number it?). In such a case, load the mathtools package (which replaces amsmath), write \mathtoolsset{showonlyrefs} in the preamble, use always align, add a \label command to the few equations you want to number and, of course, cite them anywhere with, say, \eqref. Look at the following example (compile it several times):
Code: Select all
\documentclass{article}
\usepackage{mathtools}
\mathtoolsset{showonlyrefs}
\begin{document}
Text here
\begin{align}
a&=b, \\
c&=d, \label{eq:1} \\
e&=f.
\end{align}
By \eqref{eq:1}\ldots
\end{document}
The CTAN lion is an artwork by Duane Bibby. Courtesy of www.ctan.org.
Re: automatic numbering in align* environment
Great, works perfectly!