I am trying to write a set of equations similar to some found in a book I am reading. Below is how the book has formatted the equations:
and here is what I have so far:
How can I align my equations so that "maximize" and "subject to" are aligned, while also aligning the sums? I do not want to display "(KP)" or any equation numbers on the side.
Here is the code I wrote:
\begin{equation*}
\begin{aligned}
\text{maximize} \sum_{j=1}^{n}p_j x_j \\
\text{subject to} \sum_{j=1}^{n}w_j x_j \leq c, \\
x_j \in \{0,1\}, j = 1, \ldots, n.
\end{aligned}
\end{equation*}
Best Answer
Use the
align
environments fromamsmath
: