I'm trying to align a linear program with a very long restriction. I've tried using split but couldn't make it work. This is what i have

&\quad & 7 x_1 + 8x_2 + 9x_3+6x_4 +8x_5+7x_6+6x_7+4x_8+5x_9\\
& \text{subject to } &  &92 x_1 + 45x_2 + 60x_3 +35x_4+50x_5+647x_6+42x_7+72x_8+15x_9 \leq 362.8\\ 
& & & \sum_{i=1}^{9}x_i\geq 6\\
& & & x_4+x_7=1\\
& & & (1-x_9)\geq x_8.  \end{alignat*}

The problem is the first restriction, I dont like it being so long so I wanted to cut it in x_7, and with that line down, I wanted the following restrictions to have the \leq, \geq and = signs aligned.

1 Answer 1


As far as i understand you're looking for a two column layout. With the left column reserved for annotations and the right column reserved for equations.

To get the correct vertical alignment of the annotations i put them in a split environment just like the first two expressions in the right column you originally wanted to split.

In the latter column i took the beginning of x_5 as the point where other expressions in the column could be aligned to.

For the last three lines i put all expressions left and right of the equal sign into a command i've derived from eqparbox. Thus all expressions to the left are typeset in boxes of equal width just as the expressions to the right. With this trick it is possible to center all expressions along the same point. This i think results in a more harmonic impression of each formula and the last three lines of the block as a whole.

enter image description here






        \text{Maximize}\quad  & \\ &
    \end{split} & 
        7 x_1 + 8x_2 + 9x_3+6x_4 +8      & x_5+7x_6+6x_7  \\
                                         & \quad\qquad+4x_8+5x_9  
        \text{subject to}\quad & \\ &
    \end{split} & 
        92 x_1 + 45x_2 + 60x_3 +35x_4+50 & x_5+647x_6+42x_7 \\
                                         & +72x_8+15x_9 \leq 362.8
    && \EqMathb{\sum_{i=1}^{9}x_i} \geq \EqMathb[right]{6}    & \\
    && \EqMathb{x_4+x_7}           =    \EqMathb[right]{1}    & \\
    && \EqMathb{(1-x_9)}           \geq \EqMathb[right]{x_8.} &

  • Thank you so much!
    – Emilia
    Commented Apr 11, 2020 at 4:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .