I have the following code in an attempt to align things in latex using amsmath package:
\begin{alignat}{3}
\text{max} && c^Tx &=\\
\text{s.t.} && Ax &\leq b \\
&& x &\geq 0
\end{alignat}
Basically, i would like for max and s.t. to be in one column, c^Tx, Ax, x to be in second column, and lastly b and 0 to be in the last column. I’m not sure why it doesn’t work (it clumps max and c^Tx together for some reason.
if anyone can help me out with this it would be much appreciated!
With math-mode
\text{}you should put in some explicit whitespace such as\quad. Butmaxsmells like a log-like symbol so you should be using pre-defined\maxor self-defined\operatorname{max}instead of\text{max}.Additionally, the parameter for the
alignatenvironment should be2in this case. The param is the number of alignment structures and can be calculated by solvingnfroma=2n-1whereais the number of ampersands on a row. However, it doesn’t seem to have a difference in this case.