1

I have the following code,

\begin{mini*}
{}{\sum_{i}\sum_{j} c_{ij}x_{ij}}{}{} 
\addConstraint{\sum_{j \in \mathcal{P}} s_{xj}} {=1 \quad}{}{\quad \alpha}
\addConstraint{\sum_{p \in \mathcal{P}^{k}}y_{p}^{k}}{= 1\quad}{}{ \quad \beta}
\addConstraint{\sum_{p \in \mathcal{P}^{k}}y_{p}^{k}}{= 1\quad}{\forall i = s,t}{ \quad \gamma}
\end{mini*}

The above code is supposed to output an optimization problem and the \alpha, \beta and \gamma are the dual variables. I want them aligned to the right and maybe even in a different color as shown in the below code.

enter image description here

Could someone let me know if I can do this in optidef or should I use a basic align environment.

2

I can't see a good reason for not using an align environment, along with \tag instructions.

enter image description here

\documentclass{article}
\usepackage{mathtools} % for "\mathclap" macro
\begin{document}
\begin{align*}
\text{minimize} \quad 
   &\sum_{i}\sum_{j} c_{ij}x_{ij} \\
\text{subject to} \quad
   &\sum_{\mathclap{j\in\mathcal{P}}} s_{xj}=1,         \tag{$\alpha$}\\
   &\sum_{\mathclap{p\in\mathcal{P}^{k}}} y_{p}^{k}= 1, \tag{$\beta$} \\
   &\sum_{\mathclap{p\in\mathcal{P}^{k}}} y_{p}^{k}= 1\quad\forall i=s,t \tag{$\gamma$}
\end{align*}
\end{document}
|improve this answer|||||

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.