8

I have the following alignat segment:

\begin{alignat*}{3}
  \text{max}_{\underline{\lambda}} \text{min}_{\underline{x}} \quad & \underline{c}^T \underline{x} + \underline{\lambda}^T(\underline{d} - D\underline{x}) \\
  \text{s.t.} \quad & A \underline{x} & \leq \underline{b} \\
                    & \underline{x}   & \geq \underline{0}
\end{alignat*}

which gives

LaTeX Result

however, the result I'm aiming for is more like

Desired Result

Note that:

  • the 'max/min' is right-aligned with the 's.t.', the left-most character in the list of 's.t.' terms (the A) is aligned with the left-most term in the objective function (the c).

  • the rest of the LHS in the 's.t.' section is right-aligned, and the inequalities are aligned.

I'm not sure if I'm being too fussy here, but anything is better than what I already have.

  • Why use \text{max} instead of \max and \min? – Aditya Jul 29 '13 at 1:25
  • Because I didn't know about \max and \min :) But now that I know about them, I will start using them! – Ozzah Jul 29 '13 at 1:42
  • 1
    Here are four other ideas: How to edit the linear programming in LaTeX? And here are five others: Multicol layout for systems of (linear) equations. – Qrrbrbirlbel Jul 29 '13 at 1:46
  • @Ozzah Then you should probably also learn about \log, \exp, \sin, \cos, etc. Also, if you want to define a new math operator, simply use \DeclareMathOperator. – Pål GD Jul 29 '13 at 8:51
  • Other log-like symbols (pdf) are \arccos, \arcsin, \arctan, \arg, \cos, \cosh, \cot, \coth, \csc, \deg, \det, \dim, \exp, \gcd, \hom, \inf, \ker, \lg, \lim, \liminf, \limsup, \ln, \log, \max, \min, \Pr, \sec, \sin, \sinh, \sup, \tan, \tanh. – Pål GD Jul 29 '13 at 8:55
9

One option is to use aligned environment from amsmath package:

\documentclass{article}
\usepackage{amsmath}

\begin{document}

\begin{alignat*}{2}
  \max_{\underline{\lambda}} \min_{\underline{x}} \quad & \underline{c}^T \underline{x} + \underline{\lambda}^T(\underline{d} - D\underline{x}) \\
  \text{s.t.} \quad &  \begin{aligned}[t]
     A \underline{x} & \leq \underline{b} \\
     \underline{x}   & \geq \underline{0}
  \end{aligned}
\end{alignat*}

\end{document}

which gives

enter image description here

  • 2
    (The amsmath package which is loaded by mathtools provides aligned.) – Qrrbrbirlbel Jul 29 '13 at 1:48
  • @Qrrbrbirlbel thanks for that. I was having trouble compiling when I added that package, and couldn't see it in my MiKTeX package repository. – Ozzah Jul 29 '13 at 3:19
  • @Qrrbrbirlbel: Thanks. For some reason I believed that aligned was part of mathtools. I have corrected the statement in the answer. – Aditya Jul 29 '13 at 6:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.