4

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}

2 Answers 2

3

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}
3

Something like this?

enter image description here

\documentclass{article}
\usepackage{geometry}  % set page parameters suitably
\usepackage{mathtools} % for \smashoperator macro

\begin{document}
\begin{flalign}
  & o_{cs} \leq mO 
  & \forall c \in \mathcal{C}; s \in \mathcal{S} \tag{18}\\
  & a_{jcs} - a_{jbs} \geq \Bigl(\, 
     \smashoperator[r]{\sum_{i \in \mathcal{T} \cup \alpha}} x_{ijcs} + 
     \smashoperator{   \sum_{i \in \mathcal{T} \cup \alpha}} x_{ijbs} 
      - 2\Bigr)\Omega 
  & \forall j \in \mathcal{T}; b, c \in \mathcal{C}; s \in \mathcal{S}; NC_{js} > 1 \tag{19}\\
  & \smashoperator[l]{\sum_{i \in \mathcal{T} \cup \alpha}} \,
    \smashoperator{\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} \tag{19a}
\end{flalign}
\end{document}
2
  • It is strange :-( but seem that the first \Bigl(\, it is a bit more great of the \Bigr) before the -2. Maybe it's just an impression. I would put a \setcounter from 17 and a subequation instead of the tags.
    – Sebastiano
    Aug 16, 2021 at 22:40
  • 1
    @Sebastiano - Thanks. Indeed, the proximity of "large" and "small" stuff near the \Big parentheses seems to influence the visual perception of the height of the parentheses.
    – Mico
    Aug 16, 2021 at 22:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .