Alignment of equations in latex

I have the following code in an attempt to align things in latex using the amsmath package:

\begin{alignat}{3}
\text{max}  && c^Tx &=\\
\text{s.t.} && Ax &\leq  b \\
        && x    &\geq  0
\end{alignat}

Basically, I would like max and st to be in the same column, c ^ Tx, Ax, x in the second column, and finally b and 0 should be in the last column. I'm not sure why this is not working (for some reason, it compresses max and c ^ Tx.

If anyone can help me with this, it will be very appreciated!

+3
source share
2 answers

In math-mode, \text{}you must specify some explicit spaces, such as \quad. But it maxsmells like a log-like character, so you should use predefined \maxor self -defined \operatorname{max}instead \text{max}.

, alignat 2 . - n a=2n-1, a - . .

+2

, , max s.t. , c^Tx Ax. max s.t., .

( , laalto , \operatorname{max}, max - - . , , , .)

0
source

Source: https://habr.com/ru/post/1714916/


All Articles