enter image description here

Is it possible to align the for statements here, without dropping the equation numbers? \hfill and && mess up the placement of the equation numbers for me.


Picture of what I get after I tried what was posted as answer

enter image description here

  • 2
    Providing a minimal working example (MWE) that demonstrates the issue, starting with \documentclass, helps those trying to help you. – Steven B. Segletes Apr 28 '14 at 13:47

Here is a possible solution (if I understand your request correct):




  \sum_{\mathclap{p \,=\, 1}}^{i}  s_{tp} - \sum_{\mathclap{p \,=\, 2}}^{i+5}                                       m_{tp} &\leq 0 \qquad
  &&\text{for } i = 1, \dots, 39,\\
  \sum_{\mathclap{p \,=\, i}}^{48} f_{tp} - \sum_{\mathclap{\substack{p \,=\, i-5\\ \hphantom{p \,=\,} -2+1}}}^{46} m_{tp} &\geq 0
  &&\text{for } i = 8, \dots, 48,



  • It's somehow not working for me: I tried this (just a simple version of your answer): `& \sum_{p=i}^{48} f_{tp} - \sum_{\mathclap{p=i-1-2+1}}^{46} m_{tp} \geq 0 \qquad &&\text{ for } i=9,\dots, 48,\\ & \sum_{p=i}^{48} f_{tp} - \sum_{\mathclap{p=i-5-2+1}}^{46} m_{tp} \leq 0 &&\text{ for } i=9,\dots, 48,\`, but the page numbers then moved to a next line. Do you know what could cause that? – texfan Apr 28 '14 at 16:33
  • I've added a picture of what I get now in the OP. – texfan Apr 28 '14 at 16:35
  • @rbm: Do you have the fleqn option somewhere in your document? – Werner Apr 28 '14 at 16:49
  • @Werner Yes I do, I have it with the mathstools package (so \usepackage[fleqn]{mathtools}). Could that cause the problem? – texfan Apr 28 '14 at 16:50
  • @Werner I got rid of the fleqn now, but then I get a rather similar, still incorrect output with the number on the next line. – texfan Apr 28 '14 at 16:54

Although a minimal working example (MWE) would really be helpful here, like Steven B. already stated, I think I got you.

Try to use mathtools instead of amsmath. It uses amsmath and extends it more, so you can use the \mathclap command. The lower sum limits of the second summation is causing the gap you dislike:


  \sum_{p=1}^{i}s_{tp} - \sum_{p=2}^{i+5}m_{tp} \leq 0 for i = 1,\cdots,39,\\
  \sum_{p=1}^{48}f_{tp} - \sum_{\mathclap{p=i-5-2+1}}^{46}m_{tp} \geq 0 for i = 8,\cdots,48,
  • ...where is the alignment around the for as requested? It seems like your post was also cut short. – Werner Apr 28 '14 at 16:22
  • Thanks, but you did not exactly understand what I meant. My mistake, I should have been more specific in the OP. What I want is the part from for to be aligned somewhat more to the right, all at the same level (like in Sven's answer, but that doesn't work for me yet). – texfan Apr 28 '14 at 16:38
  • @Werner: I misunderstood his questions, I thought about a different alignment. My mistake, sorry. – Cheesey Apr 28 '14 at 16:46
  • @Cheesey No problem, I should have been more specific. Do you have an idea what I could change to get it to work (I commented on Sven's solution)? – texfan Apr 28 '14 at 16:48
  • I have read it. Can you please post the full minimal working example - like Sven and I did - so we can see what usepackages, documentclass, options (like fleqn) etc. you are using? Because I just tested your code in the comments and the numbering works fine for me. – Cheesey Apr 28 '14 at 16:57

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.