3

There is a system of equation.
How to align it on the left? (second line should be started right under the first line)
http://i.stack.imgur.com/fyg9r.png

My code of this:

$\begin{equation}
\left\{\begin{aligned}
\hat a \sum x^2_i + \hat b \sum x_i = \sum x_i \cdot y_i,\\
\hat a \sum x_i + n \cdot \hat b =\sum y_i.\\
\end{aligned}
\right.\end{equation}$
  • 4
    Put the & character before the first \hat at each line and remove the $ symbols. – wipet Dec 13 '14 at 21:49
8

Just use the cases environment:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{mathtools} 

\begin{document}

\begin{equation}
\begin{dcases}
  \hat a \sum x^2_i + \hat b \sum x_i = \sum x_i \cdot y_i,\\
  \hat a \sum x_i + n \cdot \hat b =\sum y_i.\\
\end{dcases}
\end{equation}


\end{document} 

enter image description here

  • It work properly, but now it system looks smaller than another text. Look at the screenshot s27.postimg.org/rboabhkyb/…. (equation number 5 uses cases). How fix it? – 0x1337 Dec 13 '14 at 22:06
  • 1
    @0x1337 Load mathtools instead of amsmath and use dcases. – Manuel Dec 13 '14 at 22:18
  • @Manuel: forgot that size inside cases is like inside array. Corrected. – Bernard Dec 13 '14 at 22:39
  • @Ox1337: Manuel gave the fix. See my updated answer. Don't load amsmath in that case, since mathtools does it for you (as a rule of thumb, one should load mathtools rather than amsmath). – Bernard Dec 13 '14 at 22:41
3

Use the & symbol before each expression. For example to align:

\begin {aligned}
\sum^{n}_{i=1} K=0\\
a^2+b+c=0\longrightarrow\Psi 
\end{aligned}

Which is:

unaligned

Use & at the beginning to align them left:

\begin {aligned}
&\sum^{n}_{i=1} K=0\\
&a^2+b+c=0\longrightarrow\Psi 
\end{aligned}

And obtain:

left aligned

Or use it before whathever you want, for example before the = to align them:

\begin {aligned}
\sum^{n}_{i=1} K&=0\\
a^2+b+c&=0\longrightarrow\Psi 
\end{aligned}

Giving:

= aligned

  • 3
    The term "before each expression" is not unambiguous since you haven't made clear what you mean by expression. Using an expression [!] such as "at the start of both rows" would be clearer. Better yet, just post a code example that incorporates your suggestion, and all guesswork is eliminated. – Mico Dec 13 '14 at 23:54
  • You're right, I'll edit. – Renijk Dec 14 '14 at 12:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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