Results 1 to 5 of 5

Math Help - How to align equations?

  1. #1
    Senior Member
    Joined
    Dec 2008
    Posts
    319

    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

    <br />
\begin{eqnarray*}<br />
6 &=& 1 + 2 + 3 \\<br />
&=& 1 \cdot 2 \cdot 3 \\<br />
\end{eqnarray*}<br />
.

    What's going on here?

    I see how active the calculus forum is and I would love to be able to use this feature.
    Follow Math Help Forum on Facebook and Google+

  2. #2
    Member
    Joined
    May 2006
    Posts
    244
    Quote Originally Posted by Scott H View Post
    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

    <br />
\begin{eqnarray*}<br />
6 &=& 1 + 2 + 3 \\<br />
&=& 1 \cdot 2 \cdot 3 \\<br />
\end{eqnarray*}<br />
.

    What's going on here?

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

    is generated by:

    [tex]
    \begin{array}{rcl}
    6 &=& 1 + 2 + 3 \\
    &=& 1 \cdot 2 \cdot 3 \\
    \end{array}
    [/tex]

    .
    Last edited by Constatine11; February 2nd 2009 at 02:22 AM. Reason: improve the allignment
    Follow Math Help Forum on Facebook and Google+

  3. #3
    MHF Contributor
    Opalg's Avatar
    Joined
    Aug 2007
    From
    Leeds, UK
    Posts
    4,041
    Thanks
    7
    Quote Originally Posted by Scott H View Post
    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

    <br />
\begin{eqnarray*}<br />
6 &=& 1 + 2 + 3 \\<br />
&=& 1 \cdot 2 \cdot 3 \\<br />
\end{eqnarray*}<br />
.

    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.

    [tex]
    \begin{aligned}
    6 &= 1 + 2 + 3 \\
    &= 1 \cdot 2 \cdot 3 \\
    \end{aligned}
    [/tex]

    will give

    <br />
 \begin{aligned}<br />
 6 &= 1 + 2 + 3 \\<br />
 &= 1 \cdot 2 \cdot 3 \\<br />
 \end{aligned}<br />

    Notice that you only need one & in each line, &= rather than &=&.
    Last edited by Opalg; February 2nd 2009 at 08:24 AM. Reason: tidying up operation
    Follow Math Help Forum on Facebook and Google+

  4. #4
    Senior Member
    Joined
    Dec 2008
    Posts
    319
    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?
    Last edited by Scott H; February 4th 2009 at 12:12 PM.
    Follow Math Help Forum on Facebook and Google+

  5. #5
    MHF Contributor
    Opalg's Avatar
    Joined
    Aug 2007
    From
    Leeds, UK
    Posts
    4,041
    Thanks
    7
    Quote Originally Posted by Scott H View Post
    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:

    \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}

    \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}[/tex]

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

    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.
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. Calculate Torus dimentions to align to a square grid.
    Posted in the Advanced Applied Math Forum
    Replies: 3
    Last Post: September 3rd 2010, 06:00 AM
  2. MathType help: how to align equations separately?
    Posted in the Math Software Forum
    Replies: 3
    Last Post: June 2nd 2010, 11:36 AM
  3. right-align equation numbers?
    Posted in the LaTeX Help Forum
    Replies: 2
    Last Post: April 18th 2010, 03:14 PM
  4. Replies: 3
    Last Post: February 27th 2009, 08:05 PM
  5. Replies: 1
    Last Post: July 29th 2007, 03:37 PM

Search Tags


/mathhelpforum @mathhelpforum