# Labelling three-column array

I got this code:

$$\begin{array}{lcr} a_{11}\cdot x_1+a_{12}\cdot x_2 &+ … + &a_{1n}\cdot x_n=\alpha_1 \\ a_{21}\cdot x_1+a_{22}\cdot x_2 &+…+&a_{2n}\cdot x_n=\alpha_2 \\ &\vdots & \\ a_{m1}\cdot x_1+a_{m2}\cdot x_2 &+…+&a_{mn}\cdot\ x_n=\alpha_m \end{array}$$


And I want to put a label outside to the right, giving the following PDF output:

Eq    =    my number
Eq2   =        umber  (2.2)
Eq3   =      two xer


How can I achieve this? It is important that the first column is left-aligned, the middle-column is centered, and the third-column is right-aligned.

-

The following is an ordinary equation, which allows for the labelling:

\documentclass{article}
\begin{document}
Here is some text.
$$\begin{array}{l@{}c@{}r} a_{11}\cdot x_1+a_{12}\cdot x_2 + \cdots + a_{1n}\cdot x_n & {}={} & \alpha_1 \\ a_{21}\cdot x_1+a_{22}\cdot x_2 + \cdots + a_{2n}\cdot x_n & {}={} & \alpha_2 \\ & \vdots & \\ a_{m1}\cdot x_1+a_{m2}\cdot x_2 + \cdots + a_{mn}\cdot x_n & {}={} & \alpha_m \end{array} \label{myeqns}$$
Here is some more text. See~(\ref{myeqns}).
\end{document}


The column specification l@{}c@{}r ensures a left, centre, right alignment but also removes any inter-column space around the c-column. However, using {}={} corrects for the spacing around the =.

See Why is $…$ preferable to $$? and Are $$ and $$ preferable to ? for more information on the use of LaTeX-style math delimiters (avoiding $$), unless you're using plain TeX (which would make this answer useless).

-
Wouldn't aligned be easier? –  egreg Dec 16 '12 at 17:10
@egreg: But the alignment (rcl) would not be the way the OP requested (lcr). –  Werner Dec 16 '12 at 17:57
Oops! Didn't see that. Then either array or alignedat. –  egreg Dec 16 '12 at 19:03

Use and rather than plain TeX style $$. For equations that are not to be numbered you can use $ and $, or, if the amsmath package is loaded, \begin{equation*} and \end{equation*} You might find the answers to Why is [ … ] preferable to$$? useful.

-