I want to write my linear program so that it looks like in this picture:
meaning I want to have the following:
- text aligned to the left
- all the
x_{j}
variables to be one another - the
i=
andj=
statement to be again to be one under the other
This is what I have so far:
\begin{equation}
\begin{split}
\text{minimize} \displaystyle\sum\limits_{j=1}^{m} w_{j}*&x_{j} \\
\text{subject to} \displaystyle\sum\limits_{j:e_{i} \in S_{j}} &x_{j} \geq 1, i=1 ,..., n\\
&x_{j} \in \{0,1\}, j=1 ,..., m
\end{split}
\end{equation}
I tried using multiple &
s, but either I use them and nothing changes, or I get the following error: Extra alingment tab has been changed to \cr \end{split}
. I have searched this error and I know that it appeares if I forget to write a &
or I have an extra one, but this is not my case. This is the code:
\begin{equation}
\begin{split}
&\text{minimize} \displaystyle\sum\limits_{j=1}^{m} w_{j}*&x_{j} & \\
&\text{subject to} \displaystyle\sum\limits_{j:e_{i} \in S_{j}} &x_{j} \geq 1, &i=1 ,..., n\\
& &x_{j} \in \{0,1\}, &j=1 ,..., m
\end{split}
\end{equation}
How can I align them in the way that I want?
And also is it possible to do it without align
? Because this program is at the end of my page and if I use align
it gets placed on the next page and I don't want that.
x_{j}
aligned horizontally.\sum a_jx_j
? Would you align thex_j
?x_j
should be next to the sum? And only thex_j
in the 2nd and 3rd line should be one under the other, right? If yes, that's how they are aligned in the second answer.