Non left-aligned equations

My equation is not left-aligned; see the attached image. I'd like it to be left-aligned.

P(w_{i} | h) = \left\{ \begin{aligned} \frac{n(h, w_{i})}{n(h)} Si n(h, w_{i}) > k\\ d_{r} \frac{n(h, w_{i})}{n(h)}\\ \alpha(h) P(w_{i} | h^{-1}\\ \end{aligned} \right.


• The first column in an alignment is right aligned. You might want to have a look at the cases env, faster to use as the { is build in Oct 21 '15 at 19:38

While you can use an aligned environment, your use is better-suited for the cases environment:

\documentclass{article}

\usepackage{amsmath}
\DeclareMathOperator{\Sin}{Sin}

\begin{document}

$$P(w_i \mid h) = \begin{cases} \dfrac{n(h, w_i)}{n(h)} \Sin(h, w_i) > k \\ d_r \dfrac{n(h, w_{i})}{n(h)} \\ \alpha(h) P(w_i \mid h^{-1}) \end{cases}$$

\end{document}


If you want to use aligned, you have to add an ampersand &:

P(w_{i} | h) = \left{ \begin{aligned} & \frac{n(h, w_{i})}{n(h)} Si n(h, w_{i}) > k\\ & d_{r} \frac{n(h, w_{i})}{n(h)}\\ & \alpha(h) P(w_{i} | h^{-1}\\ \end{aligned} \right.


The formula in each row of the aligned environment can be structured by putting & at the right places. The idea is that corresponding &s of different rows will be aligned on top of each other. In order to align arbitrary formulas at specific points, the parts before the first & is right aligned, the part after the second & is left aligned, and then it alternates.