# Alignment and spacing with flalign

I have a nice equation that is correctly aligned, but the spacing is still incorrect. The equation is

\documentclass{article}
\usepackage{mathtools}

\begin{document}

\begin{flalign}
P(1) \quad \text{ minimize: } &&   \sum\limits_{s \in \rho} x_s &&&&& \\
\text{subject to: }&&   \sum\limits_{s \in \rho} a_{ts}x_s &\geq b_t, &&\text{for } t \in T, && (\lambda) \nonumber \\
&& \sum\limits_{s \in \overline{\rho}} y_{s} &\leq \overline{\eta}. &&&& (\pi) \nonumber
\end{flalign}

\end{document}


I like the results but why is there a space of two \quad's between minimize text and subject to rows. I would like to keep the symbols lambda and pi flushed to right (like it is), but move the equation body closer to minimize and subject to text or vice versa. It it even possible?

• Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. Nov 24 '16 at 19:05

Not sure quite what alignment you want but perhaps simpler markup such as:

\documentclass{article}
\usepackage{mathtools}

\begin{document}

\noindent X\dotfill text\dotfill X
\begin{align*}
P(1) \quad &&\text{ minimize: }&  \sum\limits_{s \in \rho} x_s \\
&&\text{subject to: }&  \sum\limits_{s \in \rho} a_{ts}x_s \geq b_t, \text{for } t \in T, \tag{$\lambda$}\\
&&& \sum\limits_{s \in \overline{\rho}} y_{s} \leq \overline{\eta}. \tag{$\pi$}
\end{align*}

\end{document}