I've defined the macro \linkedLabels below to give me linked equation numbers
What I've done works ok, but there are two problems with it
1) I'd like to define \newcounter inside the macro, rather than separately in the preamble, but it appears that newcounter has to be in the preamble
2) It's silly to have arguments #2 and #3 be separate since obviously #3 is determined by #2. However, the command \tag{\the#2$\empty_\text{#4}$} doesn't work. Nor does \tag{\value{#2} etc}
So to summarize, my questions are:
1) is there away to define counters in the body of the document
2) is there a way in a macro to reference the value of a counter whose name is passed to the macro as an argument?
Thanks very much for any help!!
The code below includes the macro and illustrates the way I want to use it.
Code: Select all
\documentclass{amsart}%
\usepackage{ifthen}
\def\linkedLabels#1#2#3#4{\ifthenelse{#1=1}
{\addtocounter{equation}{1}
\setcounter{#2}{\theequation}}{}
\label{eq:#2-#4}
\tag{#3$\empty_\text{#4}$}}
\newcounter{tmpCounter}
\begin{document}
\begin{align}
a = b
\end{align}
\begin{align}
\linkedLabels{1}{tmpCounter}{\thetmpCounter}{sym}
a = b
\end{align}
\begin{align}
a = b
\end{align}
\begin{align}
\linkedLabels{2}{tmpCounter}{\thetmpCounter}{sb}
a = b
\end{align}
Referring to equations \eqref{eq:tmpCounter-sym} and \eqref{eq:tmpCounter-sb}, we find
\end{document}