# Thread: How to align equations?

1. ## How to align equations?

Aligning the equals sign '=' with several equations doesn't seem to work with \begin{eqnarray*} and \end{eqnarray*}.

When I use this code:

\begin{eqnarray*}
6 &=& 1 + 2 + 3 \\
&=& 1 \cdot 2 \cdot 3 \\
\end{eqnarray*}

I get

$\displaystyle \begin{eqnarray*} 6 &=& 1 + 2 + 3 \\ &=& 1 \cdot 2 \cdot 3 \\ \end{eqnarray*}$.

What's going on here?

I see how active the calculus forum is and I would love to be able to use this feature.

2. Originally Posted by Scott H
Aligning the equals sign '=' with several equations doesn't seem to work with \begin{eqnarray*} and \end{eqnarray*}.

When I use this code:

\begin{eqnarray*}
6 &=& 1 + 2 + 3 \\
&=& 1 \cdot 2 \cdot 3 \\
\end{eqnarray*}

I get

$\displaystyle \begin{eqnarray*} 6 &=& 1 + 2 + 3 \\ &=& 1 \cdot 2 \cdot 3 \\ \end{eqnarray*}$.

What's going on here?

I see how active the calculus forum is and I would love to be able to use this feature.
$\displaystyle \begin{array}{rcl} 6 &=& 1 + 2 + 3 \\ &=& 1 \cdot 2 \cdot 3 \\ \end{array}$

is generated by:

$$\begin{array}{rcl} 6 &=& 1 + 2 + 3 \\ &=& 1 \cdot 2 \cdot 3 \\ \end{array}$$

.

3. Originally Posted by Scott H
Aligning the equals sign '=' with several equations doesn't seem to work with \begin{eqnarray*} and \end{eqnarray*}.

When I use this code:

\begin{eqnarray*}
6 &=& 1 + 2 + 3 \\
&=& 1 \cdot 2 \cdot 3 \\
\end{eqnarray*}

I get

$\displaystyle \begin{eqnarray*} 6 &=& 1 + 2 + 3 \\ &=& 1 \cdot 2 \cdot 3 \\ \end{eqnarray*}$.

What's going on here?

I see how active the calculus forum is and I would love to be able to use this feature.
For some reason, eqnarray doesn't work in this forum. But you can use the aligned environment instead.

\begin{aligned} 6 &= 1 + 2 + 3 \\ &= 1 \cdot 2 \cdot 3 \\ \end{aligned}

will give

\displaystyle \begin{aligned} 6 &= 1 + 2 + 3 \\ &= 1 \cdot 2 \cdot 3 \\ \end{aligned}

Notice that you only need one & in each line, &= rather than &=&.

4. I see. Thank you very much!

However, there seem to be some limitations on string length on this forum as opposed to some other forums I've seen. Is there a way to align equations with more than one tag? 5. Originally Posted by Scott H I see. Thank you very much! However, there seem to be some limitations on string length on this forum as opposed to some other forums I've seen. Is there a way to align equations with more than one [tex] tag? There are limits on the size of a displayed formula and on the number of characters allowed in a formula (presumably to discourage hackers and nuisance posts). As you say, the only way to post a long string of calculations is to break it up among different [tex] tags. Another problem is that the compiler strips out all leading and trailing spaces in formulas. I don't know the reason for this, but it makes it hard to align formulas. If you want to align equations between different [tex] tags then you have to resort to trickery, like this: \displaystyle \begin{aligned}f(x_1,x_2,\ldots,x_n) &= \ldots\text{ (start of a long sequence of equations)}\\ &= \ldots \\ &= \ldots \\ &= \ldots\text{ (no more lines allowed after this one)}\end{aligned} \displaystyle \begin{aligned}{\color{white}f(x_1,x_2,\ldots,x_n) } &= \ldots\text{ (but look! we can still continue)}\\ &= \ldots\text{ (aligned with what came before)}\\ &= \ldots\text{ (going on for as long as we want)}\end{aligned} That comes from this code: [tex]\begin{aligned}f(x_1,x_2,\ldots,x_n) &= ... \\ &= ... \\ &= ... \\ &= ... \end{aligned}

\begin{aligned}{\color{white}f(x_1,x_2,\ldots,x_n) } &= ... \\ &= ... \\ &= ... \end{aligned}

Repeating the left-hand side of the chain of equations in (approximately) the background colour gets the horizontal spacing exactly right. But there may be a slight difference in the vertical spacing between lines, because the only spacing available there is the paragraph break.