TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I got this code:

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 

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.

share|improve this question

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

enter image description here

Here is some text.
    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}).

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).

share|improve this answer
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 \begin{equation} and \end{equation} 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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.