# Left hand alignment in the matrix command and array command

Printable View

• May 3rd 2011, 01:17 PM
topsquark
Left hand alignment in the matrix command and array command
Here is the code I am looking for assistance on.
$\displaystyle \begin{matrix}|\vec{r} - \vec{v}t_r|^2 = r^2 - 2 \vec{r} \cdot \vec{v}t_r + v^2t_r^2 = c^2(t - t_r)^2 \\ . \\ \vec{r} \cdot \vec{v} = \frac{1}{2t_r} ( r^2 + v^2 - c^2(t - t_r)^2 ) \end{matrix}$

What I am trying to do is left-align both statements. I am aware of the "array" command and I might be able to fix this using array, but am confused about the {lcl} ( {ccc} etc.) parts of the statement.

Just to explain why I am doing this with the "matrix" command instead of two separate lines of code is that on PHF we are only allowed to post 5 images, which is currently the only way to write LaTeX commands. So I'm trying to find a way to put more than one statement inside a single image.

-Dan
• May 3rd 2011, 01:19 PM
Ackbeet
If you're using quicklatex, try this sort of thing:

\begin{align*}
&x^2 + y^2 = 1 \\
&y = \sqrt{1 - x^2}
\end{align*}

The ampersands control what gets aligned with what. (Can do it on the equals sign, e.g.).

Result:

http://quicklatex.com/cache3/ql_a4bd...d902348_l3.png
• May 3rd 2011, 01:24 PM
Moo
Hello,

lcl and ccc would help you.
In this case, it would be l (left) for the alignment. lcl would give left center left
Choose the array command

$\displaystyle \begin{array}{l}|\vec{r} - \vec{v}t_r|^2 = r^2 - 2 \vec{r} \cdot \vec{v}t_r + v^2t_r^2 = c^2(t - t_r)^2 \\ \vec{r} \cdot \vec{v} = \frac{1}{2t_r} ( r^2 + v^2 - c^2(t - t_r)^2 ) \end{array}$

or

$\displaystyle \begin{array}{lll} |\vec{r} - \vec{v}t_r|^2 &= r^2 - 2 \vec{r} \cdot \vec{v}t_r + v^2t_r^2 &= c^2(t - t_r)^2 \\ \vec{r} \cdot \vec{v} &= \frac{1}{2t_r} ( r^2 + v^2 - c^2(t - t_r)^2 ) & \end{array}$

Or the align*/aligned solution that Ackbeet proposes is nice too.
• May 3rd 2011, 01:29 PM
topsquark
\displaystyle \begin{align*}& |\vec{r} - \vec{v}t_r|^2 = r^2 - 2 \vec{r} \cdot \vec{v}t_r + v^2t_r^2 = c^2(t - t_r)^2 \\ . \\ & \vec{r} \cdot \vec{v} = \frac{1}{2t_r} ( r^2 + v^2 - c^2(t - t_r)^2 ) \end{align*}

Oh, that's sooooo nice. You'll be richly rewarded for this Ack! bent!

-Dan
• May 3rd 2011, 01:31 PM
topsquark
Quote:

Originally Posted by Moo
Hello,

lcl and ccc would help you.
In this case, it would be l (left) for the alignment. lcl would give left center left
Choose the array command

$\displaystyle \begin{array}{l}|\vec{r} - \vec{v}t_r|^2 = r^2 - 2 \vec{r} \cdot \vec{v}t_r + v^2t_r^2 = c^2(t - t_r)^2 \\ \vec{r} \cdot \vec{v} = \frac{1}{2t_r} ( r^2 + v^2 - c^2(t - t_r)^2 ) \end{array}$

or

$\displaystyle \begin{array}{lll} |\vec{r} - \vec{v}t_r|^2 &= r^2 - 2 \vec{r} \cdot \vec{v}t_r + v^2t_r^2 &= c^2(t - t_r)^2 \\ \vec{r} \cdot \vec{v} &= \frac{1}{2t_r} ( r^2 + v^2 - c^2(t - t_r)^2 ) & \end{array}$

Or the align*/aligned solution that Ackbeet proposes is nice too.

Okay, that's a good solution as well. Now at least I know how that {lcl} thing is supposed to work. Not that I can think of a reason why I would, but is there an "r" for right alignment?

-Dan
• May 3rd 2011, 01:33 PM
Ackbeet
Quote:

Originally Posted by topsquark
\displaystyle \begin{align*}& |\vec{r} - \vec{v}t_r|^2 = r^2 - 2 \vec{r} \cdot \vec{v}t_r + v^2t_r^2 = c^2(t - t_r)^2 \\ . \\ & \vec{r} \cdot \vec{v} = \frac{1}{2t_r} ( r^2 + v^2 - c^2(t - t_r)^2 ) \end{align*}

Oh, that's sooooo nice. You'll be richly rewarded for this Ack! bent!

-Dan

Ha. The laugh from yet another distortion of my username may already have been my reward. But suit yourself.

Incidentally, in a real LaTeX environment, the asterisk in the \begin{align*} suppresses the automatic equation numbering that would normally appear on the right. If you want that numbering to appear because you'll refer to those equations later (although N. David Mermin strongly encourages numbering every single displayed equation in case someone else wants to refer to it), then simply omit the asterisks.
• May 3rd 2011, 01:33 PM
Moo
Quote:

Originally Posted by topsquark
Okay, that's a good solution as well. Now at least I know how that {lcl} thing is supposed to work. Not that I can think of a reason why I would, but is there an "r" for right alignment?

-Dan

Yes !
The aligned is really nice (I use it all the time), but the array is better if you want to do more precise things.
• May 3rd 2011, 01:49 PM
topsquark
Quote:

Originally Posted by Ackbeet
Ha. The laugh from yet another distortion of my username may already have been my reward. But suit yourself.

Incidentally, in a real LaTeX environment, the asterisk in the \begin{align*} suppresses the automatic equation numbering that would normally appear on the right. If you want that numbering to appear because you'll refer to those equations later (although N. David Mermin strongly encourages numbering every single displayed equation in case someone else wants to refer to it), then simply omit the asterisks.

Actually I tried without the asterisk and the numbers didn't seem to line up with the equations, but I didn't play with it.

Your solution works well here, but I've been using "www.codecogs.com" for PHF and they don't appear to have the align* command. Thank you anyway!

(sighs) I guess that means that I'll have to admit that Moo made an acceptable suggestion. It's hard but you gotta do what you gotta do.

-Dan
• May 3rd 2011, 02:31 PM
Ackbeet
quicklatex.com does play well with the align and align* environments. You could use that instead. It's just an image import, so PHF should have no problem with that.