# [texhax] 3x3 array of alighned equations

Novak Elliott N.S.J.Elliott at warwick.ac.uk
Wed Nov 9 16:06:22 CET 2005

I've figured out a work-around solution: simply wrap the whole thing up in a subequations environment and put a \label after the \begin{subequations} and before \begin{alignat}.  This also eliminates the need for the stepcounter command.

Here is the real set of equations that I wanted to display all along, copy and paste the code for quite a nice bit of texing!

\begin{subequations}
\label{eqn:strains}
\begin{alignat}{3}
\epsilon_{xx} & = \frac{\partial u}{\partial x},&
\epsilon_{yy} & = \frac{\partial v}{\partial y},&
\epsilon_{zz} & = \frac{\partial w}{\partial z},\tag{\theequation a,b,c}\\
\epsilon_{yz} & = \frac{\partial w}{\partial y} + \frac{\partial v}{\partial z},&
\epsilon_{zx} & = \frac{\partial u}{\partial z} + \frac{\partial w}{\partial x},&
\epsilon_{xy} & = \frac{\partial v}{\partial x} + \frac{\partial u}{\partial y},\tag{\theequation d,e,f}\\
2\bar{\omega}_x & = \frac{\partial w}{\partial y} - \frac{\partial v}{\partial z},&
\quad 2\bar{\omega}_y & = \frac{\partial u}{\partial z} - \frac{\partial w}{\partial x},&
\quad 2\bar{\omega}_z & = \frac{\partial v}{\partial x} - \frac{\partial u}{\partial y}.\tag{\theequation g,h,i}
\end{alignat}
\end{subequations}

The individual equations may be referred to by \ref{eqn:strains}a, \ref{eqn:strains}b, etc.

So the subequations environment was only used to gain access to the overall equation number, while the tags are made manually using the \tag command, which I think is a reasonable solution.  The overall equation number may change if the document was reordered but it is unlikely that the order of the subequations would ever change so referencing via \ref{mainequationlabel}a would be in keeping with the tex spirit!

cheers,
Novak

>>> Barbara Beeton <bnb at ams.org> 11/09/05 14:37 PM >>>
what you're asking for is labeling each element of an
array.

i don't know of any package that will do that.
certainly it wasn't even thought of when amsmath was
created from the ams-tex math facilities, nor was it
considered (or probably even envisioned) when ams-tex
was written.

for future reference: has anyone ever seen this level
of referencing in a published work?  i'd like to have
some concrete evidence to put into the ams list of
features that have been requested as extensions to
amsmath.  (that's not a promise for such requests to
be implemented, only that they will be put on a list
of features that are considered desirable.)
-- bb

---------- Original message ----------
Date: Wed, 09 Nov 2005 13:02:34 +0000
From: Novak Elliott <N.S.J.Elliott at warwick.ac.uk>
To: texhax at tug.org
Subject: Re: [texhax] 3x3 array of alighned equations

Hi everyone,

>>> Robin Fairbairns <Robin.Fairbairns at cl.cam.ac.uk> 11/03/05 04:48pm >>>
>> The alignat environment works a treat except now I'd like to get the subequation numbering
>> working.
>> Something I've tried:
>>
>> \begin{alignat}
>> \renewcommand{\theequation}{\arabic{equation}a,b,c}
>> a&=b & &=c & &=d\\
>> a&=bbbb & &=c & &=d\\
>> a&=bb & &=c & &=d
>> \end{alignat}
>>
>> but this gets ignored and produces the standard (1), (2), (3) on consecutive lines.
>> What actually I want is (1a,b,c), (1d,e,f), (1g,h,i) on consecutive lines.
>> The above trick does work in the equation environment but perhaps the the command
>> "theequation"
>> isn't used in alignat?
>
> amsmath does its labelling in its own enigmatic way.
>
> try
>
> \begin{alignat}
> a&=b & &=c & &=d \tag{\theequation a,b,c}\\
> a&=bbbb & &=c & &=d \tag{\theequation d,e,f}\\
> a&=bb & &=c & &=d \tag{\theequation h,h,i}
> \end{alignat}

this gets me most of the way there.  I found I needed to insert a \stepcounter{equation} before the \begin{alignat} line.  So what I end up with is asthetically what I set out to achieve.  However, it would be 'nice' to be able to reference each of the equations individually.  If I add a couple of labels:

\stepcounter{equation}
\begin{alignat}
a&=b & &=c & &=d \tag{\theequation a,b,c}\label{one}\\
a&=bbbb & &=c & &=d \tag{\theequation d,e,f}\label{two}\\
a&=bb & &=c & &=d \tag{\theequation h,h,i}\label{three}
\end{alignat}

Then the command \ref{one} produces "1a,b,c", \ref{two} produces "1d,e,f" etc.
I'd like to be able to reference, for example, equation 1e, or equation 1h, rather than all three equations on the same line.  ie, the \tag's are correct but I want the labels to be different than the tags.  Is it possible to set a label to be equal to the \theequation variable at the start of a set of equations?  That way I could reference each individual equation as \ref{myequations}a, \ref{myequations}f, etc.

cheers,
Novak.

p.s. Using the subequations environment doesn't work, it simply sets the tags to be (1a), (1b) and (1c) for the first, second and third lines, respectively.

_______________________________________________
TeX FAQ: http://www.tex.ac.uk/faq