2

I want to write the equal sign below each other. My code is

\begin{equation*}
\overline{x}=\frac{1}{n}\sum_{i=1}^{n}x_{i}
=\frac{1}{3}(1 + 2 + 3)
=2
\end{equation*}

Now i' get

enter image description here

but it should look like this:

enter image description here

2 Answers2

7

Load the package amsmath and use the {align} environment:

\begin{align*}
\overline{x}&=\frac{1}{n}\sum_{i=1}^{n}x_{i} \\
&=\frac{1}{3}(1 + 2 + 3) \\
&=2
\end{align*}

End all lines except the last one with \\ and insert & before the symbol you want the columns to be aligned at.

Tobi
  • 56,353
  • 1
    Have you ever heard of split? – egreg Aug 31 '17 at 08:43
  • Nope, but i found this thread: https://tex.stackexchange.com/questions/239252/what-is-the-difference-between-split-multline-align-breqn-for-breakin I will read about this topic. But for now, amsmath and align is working perfectly. – idontknowwhoiamgodhelpme Aug 31 '17 at 09:02
1
\begin{eqnarray*}
\overline{x} &=& \frac{1}{n}\sum_{i=1}^{n}x_{i}\\
&=& \frac{1}{3}(1 + 2 + 3)\\
&=& 2
\end{eqnarray*}
Au101
  • 10,278
Botin
  • 11
  • 2
    Welcome to the site! Thanks very much for your first contribution! =) However, you should know that eqnarray is severely deprecated and out of date; you should definitely consider following the accepted answer and switch to align – Au101 Mar 13 '18 at 21:24