# IEEEeqnarray with multiple alignment points

I've got a long persistent question on how to typeset a particular equation using IEEEeqnarray.

Consider the code

\documentclass{scrartcl}
\usepackage{IEEEtrantools,amsmath}
\begin{document}

\begin{IEEEeqnarray}{rCllr}
\IEEEyesnumber  \IEEEyessubnumber*
\min_{ y_i} &\quad& \sum_{i=1}^M \big(\frac 12 y_i^\top Q_i y_i \,+\, &q_i^\top  y_i + K_i\big) \, & \text{(agent objective)}\\
\text{s.t.} && C_i y_i=c_i& \forall i  &\text{(agent dynamic)}\\
&& {y}_i^{lb} \leq  y_i \leq {y}_i^{ub} & \forall i &\text{(agent bound)}\\
&& D  y  = d  & &\text{(coupling of agents)}.
\end{IEEEeqnarray}
\end{document}


resulting in the output

where I've added vertical red lines to indicate the horizontal alignment. (Please ignore the weird looking 0.xx tags.)

What I want to achieve:

i.e. I want the last right-oriented column to be moved closer to the rest of the equation, in particular I don't want the position of coupling of agents in the last row be determined by K_i) in the first row. Please note that I also want to keep the actual (numbered) tags beside the written-out ones.

Why do I want this:
The equation is used for a two-column paper where horizontal space is scarce.

Own ideas about a possible solution:

• The desired behavior is very similar to using \hfill in a text environment. This however does not work here (placing \hfill into the equation has no effect).
• The key point would be having orientation points (marked by &) in line 2-4 that are independent of line 1. This would also simplify the placement of \forall i and would still allow to have a common flushright orientation. No idea though how to achieve this.
• Another possibility would be placing the written out descriptions into the actual tags, but then I would only have either one of them, while I need both here. Please don't argue that I shouldn't have two types of tags, this is motivated by context not given here.

Thanks for all answers and suggestions!

A couple of \rlap directives will let you achieve your formatting objective. The \rlap directive in the first row serves to snug up the material in the final column, by the width of ${}_i\bigr)$. The second directive, in the final row, is optional and merely serves to align the closing parentheses properly.

\documentclass{scrartcl}
\usepackage{IEEEtrantools,amsmath}
\begin{document}

\begin{IEEEeqnarray}{rCllr}
\IEEEyesnumber  \IEEEyessubnumber*
\min_{y_i} &\quad& \sum_{i=1}^M \bigl(\tfrac{1}{2} y_i^\top Q_i y_i +{}
&q_i^\top  y^{}_i + K\rlap{${}_i\bigr)$}  & \text{(agent objective)}\\
\text{s.t.}
&& C_i y_i=c_i& \forall i  &\text{(agent dynamic)}\\
&& {y}_i^{lb} \leq  y^{}_i \leq {y}_i^{ub} & \forall i &\text{(agent bound)}\\
&& D  y  = d  & &\text{(coupling of agents)}\rlap{.}
\end{IEEEeqnarray}
\end{document}

• @Felix - Glad I was able to help. :-) Incidentally, do note that I also replaced \,+\, & in your code with the somewhat more robust +{}&. – Mico Feb 13 '17 at 10:25