I am trying to create a linear program

Similar to:

enter image description here

However the code just wouldn't align f(x) with the constraints enter image description here

Can anyone help?




\declaretheorem[name=Theorem, numberwithin=section]{thm}
\declaretheorem[name=Lemma, numberwithin=section]{lem}
\declaretheorem[name=Proposition, numberwithin=section]{prop}
\declaretheorem[name=Corollary, numberwithin=section]{cor}
\declaretheorem[name=Conjecture, numberwithin=section]{conj}
\declaretheorem[name=Claim, numberwithin=section]{claim}



        & \text{maximize}
        & f(x) \\
        & \text{subject to}
        &  x_1+x_2 = 8\\
        & & x_3 + x_4 = 2


You can use alignat to define a number of Right-Left alignments:

enter image description here





  & \text{maximize}   & \quad & f(x)          \nonumber \\
  & \text{subject to} &       & x_1 + x_2 = 8 \\
  &                   &       & x_3 + x_4 = 2 \nonumber

  • My triple PhD degree will never finish without you – Fraïssé Jan 24 '17 at 21:19

Each line of your aligned environment starts with &. Delete it and replace the remaining & on each line by &~.

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.