7

I am trying to align the following equations around the equal sign. What can I do? Thanks! I am using the AMSMath package

    $$m\ddot{x}_{1}-K(x_{2}+x_{12})+C(\dot{x}_{12}+\dot{x}_{2})+2C\dot{x}_{1} = fx_{1}$$
$$m\ddot{x}_{2}-K(x_{3}+x_{1})+C(\dot{x}_{1}+\dot{x}_{3})+2C\dot{x}_{2} = fx_{2}$$ 
$$m\ddot{x}_{3}-K(x_{4}+x_{2})+C(\dot{x}_{2}+\dot{x}_{4})+2C\dot{x}_{3} = fx_{3}$$ 
1
  • 1
    Please read this before voting to migrate this to tex.stackexchange.com.
    – joran
    Jun 23, 2013 at 2:14

3 Answers 3

21
\begin{align}
    m\ddot{x}_{1}-K(x_{2}+x_{12})+C(\dot{x}_{12}+\dot{x}_{2})+2C\dot{x}_{1} &= fx_{1} \\
    m\ddot{x}_{2}-K(x_{3}+x_{1})+C(\dot{x}_{1}+\dot{x}_{3})+2C\dot{x}_{2} &= fx_{2} \\
    m\ddot{x}_{3}-K(x_{4}+x_{2})+C(\dot{x}_{2}+\dot{x}_{4})+2C\dot{x}_{3} &= fx_{3}
\end{align}

See the user's guide.

0
5

To make a long story short... the following idea of using eqnarray is kind of obvious, but turns out to be a really bad idea. eqnarray brings lots of issues which are solved in amsmath and related packages. Read Lars Madsen: Avoid eqnarray for the details.

\begin{eqnarray*} %% Do avoid eqnarray if possible.
    x_1 & = & 1 \\
    x_2 & = & 2 \\
    x_3 & = & 3
\end{eqnarray*}

(Answer revised with information from Arthur Reutenauer, Thomas and the Madsen paper linked to by Thomas.)

5
  • 1
    Not really smart: eqnarray is really outdated (since 15 years or so). The AMS environment are a much safer choice. Nov 13, 2009 at 21:37
  • 5
    I won't downvote you for this, but know for once and for all that eqnarray is evil: tug.org/pracjourn/2006-4/madsen/madsen.pdf
    – Thomas
    Nov 13, 2009 at 21:45
  • I don't think eqnarray is that bad, but I appreciate the link to the article explaining why people prefer the amsmath alternative. Nov 13, 2009 at 23:47
  • @ndim: Thanks for taking our comments into account! I, too, started with eqnarray ten years ago, and then I read the LaTeX companion... Nov 14, 2009 at 0:49
  • @Arthur: I was not aware that so much had changed since that time in the 1990s when I read my first book on LaTeX, so eqnarray seemed obvious. Apparently though, I am not the only one who is prone to falling into that trap, so I guess it is a good idea to leave this answer here. Thanks for enlightening me.
    – ndim
    Nov 14, 2009 at 1:33
4

There are several packages to do what you want, one of the most widely used is the AMS' align environment from the amsmath package.

Simplified extract from amsldoc.pdf:

\begin{align} 
x&=y \\ 
x’&=y’ \\ 
x+x’&=y+y’ 
\end{align}

The equations are aligned around the symbols that follow & (the equals signs, in this case).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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