I'm trying to write this in latex:
Using the "align" enviroment I'm able to achieve to write this code:
\begin{align}
&\sum_k y_{ik}= \left\{ \begin{array}{l}
1, \\
m,
\end{array} \right. & \begin{array}{l}
i=2,...,n,\\
i=1,
\end{array}\\
&\sum_i q_i y_{ij} \le Q_k, &k=1,...,m, \\
\sum_j x_{ijk}= &\sum_j x_{ijk}= y_{ik}, &i=1,...,n, &&k=1,...,m,\\
&\sum_{i,j \in S} x_{ijk} \le |S| -1, &\text{para todo } S \subseteq \{2,...,n\},&& k=1,...,m,
\end{align}
It's almost perfect, but the equals of the second column are not perfectly aligned, and I don't understand exactly how the enviroment works: why I had to writte two "&&" in some case and just one in other cases? Why the "para todo" (for all in spanish) is not aligned with the column and starts more in the left? It looks as I wanted, but I don't understand why. If somebody can show me how to write it or refer me to some tutorial of the enviroment, I would be really gratefull. Thank you.
align
environment, the first&
is arl
align pair. That is the text to the left of&
isr
ight aligned and the text following a&
isl
eft aligned. The next&
is an equation separator and the next&
is again arl
align pair. I would suggest you use thealignat
environment instead where each&
is arl
align pair. Thus,abc & def
will make theabc
r
ight aligned and thedef
will bel
eft aligned, whereasabc && def
will make theabc
r
ight aligned and thedef
to also ber
ight aligned (since there is no empty text in between the&&
).