Align forall to the right hand side

alignequations

I have a few equations, and I would like to align the forall statements of these equations to the right-hand side as below:
enter image description here

However, when I add a new equation (eq19), I have no idea why I cannot get a result as above. Would you please help me to resolve this problem using a similar notation as above (since I do not want to change all equations in my main file)?

\documentclass{article}

\usepackage{amsmath}

\begin{document}

\begin{flalign}
  & o_{cs} \leq mO 
  & \forall c \in \mathcal{C}; s \in \mathcal{S} \label{eq18}\\
%   & a_{jcs} - a_{jbs} \geq 
%     (\sum_{i \in \mathcal{T} \cup \alpha} 
%      x_{ijcs} + 
%      \sum_{i \in \mathcal{T} \cup \alpha} 
%      x_{ijbs} - 2)\Omega \nonumber \\
%   & 
%   & \forall j \in \mathcal{T}; b, c \in \mathcal{C}; s \in \mathcal{S}; NC_{js} > 1 \label{eq19}\\
  & \sum_{i \in \mathcal{T} \cup \alpha}
    \sum_{j \in \mathcal{T}}
    x_{ijcs} \: T_{js} \leq (ES_s-BS_s) \: {fR_c} 
  & \forall c \in \mathcal{C}; s \in \mathcal{S} \label{eq19a}
\end{flalign}
\end{document}

Best Answer

The problem is that your longest left aligned equation + longest right aligned equation + number will be wider than your total available width.

Here, the equations will fit:

enter image description here

But as soon as you add the \in or more to the right hand equation, the total width will be overfull and the flalign environment won't be able to section it up into two good boxes and thereby can't have the equations and numbering on the same line:

enter image description here

Thereby you either have to use another environment than flalign or widen the text width using the geometry package.

\usepackage{geometry}

Which will adjust the widths for your case to work, but the widths of the page can still be set manually with the geometry package.

\documentclass{article}
\usepackage{geometry}
\usepackage{amsmath}

\begin{document}

\begin{flalign}
  % Line 1
  & o_{cs} \leq mO 
  & \forall c \in \mathcal{C}; s \in \mathcal{S} \label{eq18}\\
  % Line 2
  & a_{jcs} - a_{jbs} \geq 
    (\sum_{i \in \mathcal{T} \cup \alpha} 
     x_{ijcs} + 
     \sum_{i \in \mathcal{T} \cup \alpha} 
     x_{ijbs} - 2)\Omega
  & \forall j \in \mathcal{T}; b, c \in \mathcal{C}; s \in \mathcal{S}; NC_{js} > 1 \label{eq19}\\
  % Line 3
  & \sum_{i \in \mathcal{T} \cup \alpha}
    \sum_{j \in \mathcal{T}}
    x_{ijcs} \: T_{js} \leq (ES_s-BS_s) \: {fR_c} 
  & \forall c \in \mathcal{C}; s \in \mathcal{S} \label{eq19a}
\end{flalign}
\end{document}