I was trying to create tags for both the optimization problem and individual constraints within it. Below is an example. Is this possible in LaTex?

    \max_{x,y} & f(x,y) \\
    s.t.  & x+y \leq 5 \tag{constraint1} \\
    & x+2y \geq 10 \tag{constraint2}

2 Answers 2


Another solution, with the mini! environment from the optidef package, which is dedicated to the formatting of optimisation problems:



        {(x, y)}{f(x, y) \tag{P1}\label{P1}}
        \addConstraint{x + y}{\leq 6\tag{constraint 1}}
        \addConstraint{x + 2y}{\geq 10\tag{constraint 2}}


enter image description here


You could try with this not elegant suggestion:




    \max_{x,y} & \quad f(x,y) \tag{P1}\\
    s.t.  & \quad x+y \leq 5  \tag{constraint 1}\\
          & \quad x+2y \geq 10 \tag{constraint 2}


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.