Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question
    
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
    
@Qrrbrbirlbel Thanks for the suggestions! –  Ozzah Jul 29 '13 at 3:20
    
@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

1 Answer 1

up vote 9 down vote accepted

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

share|improve this answer
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

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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