5

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?

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

2 Answers 2

4

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

\documentclass{article}
\usepackage[short]{optidef}

\begin{document}

    \begin{mini!}
        {(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}}
   \end{mini!}

 \end{document} 

enter image description here

2

You could try with this not elegant suggestion:

\documentclass{article}

\usepackage{amsmath}

\begin{document}

\begin{align}
    \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}
    \end{align}

\end{document}

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.