I'm writing an optimization MILP model and I would like that for each constraint, the constraint itself be centered while the domain of the constraint e. g.\forall i \in I be aligned to the right side of the text in a different line. I've read a lot but I haven't obtained the results that I want. The most aproximated answer that I had was usingmultline environment. But as you'd probably know the first part of the equation is aligned to the left, not in the center as I want. Additionally I'd like the number of the equation in the middle of the two lines. The desired results would be something like this: Desired result 2

What I'm getting right know is:What I'm getting right now 2wich is the result of this code:

Z_{jjtmo}\geq Y_{jtm(o-1)}+Y_{jtmo}\\
\quad+\sum_{i',i''=1}^{N_{I}}\sum_{(m',o')\not=(m,o)}\gamma_{i',i''tlm'o'mo}+\sum_{i=1}^{N_{I}}\alpha_{itlmo}-2\\  \quad\forall t,l,(m,o)\in\Lambda(l,0,0),j\in\theta_{m}

Thank you very much for your colaboration and God bless you!


Twos ways: either you consider the main expression is on the first line, and the equation number will be on the first line, usin the flalign environment. You can have several equations with alignment.

Or you want the equation number to be between the first and second line. You can achieve this with the gather/gathered environments, but all equations (except the domains) will be centred. Here are examples of both solutions:

\usepackage[showframe]{geometry} %
\newcommand\domain[1]{\ensuremath{\makebox[0.9 \displaywidth][r]{\displaystyle$#1$}}}


  & & & \sum_{l,m,o} x_{itlmo} - I_{i(t-1)} + H_i <80000 \\[-1ex]
  & & & & & \mathllap{\forall t \in T, I \in I}\notag

    \sum_{l,m,o} x_{itlmo} - I_{i(t-1)} + H_i <80000 \\[-1ex]
    \makebox[0.9\displaywidth][r]{$ \forall t \in T, I \in I $}
  \begin{gathered}a + b + c = u + v + w\\
    \makebox[0.9 \displaywidth][r]{$ \forall a, b, c \in \mathbf R, u, v, w \in \mathbf C$}


enter image description here

  • The equation number isn't in the midle of the expression and when the constraint occupies more than one line, It will look not pretty good. Do you know how to improve the result? Thanks... – Víctor Mario Noble Ramos Oct 26 '16 at 23:36
  • Please take a look at my updated answer. That said, I personally find nicer the number on the first line, as it is, so to say, tha main part of the equation. – Bernard Oct 27 '16 at 0:22

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.