[Tex/LaTex] How to align equations with integrals and “subject to” equations

alignequations

I have a long expression (maximization problem) which I force down to the next line using //.

I also have two functions ("subject to") which I want to place underneath. I use & to make the expressions fit vertically.

Problem:

  • The third integral expression which I have to force down looks weird and isn't aligned with the two integral expression above. I don't know how to fix it.
  • The alignment is off. Fx "Another equation here" should be aligned with Max(n_G, 0) \leq n_{min} \leq Min(n_B,1). Using & obviously doesn't solve the problem.
  • Extra: The reason I use \def\mclimits_#1{\limits_{\mathclap{#1}}} is to make the long expression n_{min} fit in the limits of the integral.

Code:

\documentclass{article}
\usepackage[utf8]{inputenc}

\usepackage{mathtools}

\def\mclimits_#1{\limits_{\mathclap{#1}}}

\begin{document}

\begin{equation}
\begin{aligned}
\underset{n_{min}}{\text{argmax}} 
& & \Pi = \frac{1}{M}\[
\int\mclimits_{n_{min}}^M\! n_cP_c\, \mathrm{d}n_c
\] + \frac{p}{M}\[
\int\mclimits_{n_B}^M\! \delta\bigg(z\beta P_r\big(h(1-n_B)+(1-h)x_B\big)-D\bigg)\, \mathrm{d}n_c
\] \\
& & + \frac{1-p}{M}\[
\int\mclimits_{n_{min}}^M\! \delta\bigg(z\beta P_r\big(h(1-n_B)+(1-h)x_G\big)-D\bigg)\, \mathrm{d}n_c
\]  \\
\text{subject to}
& & Max(n_G, 0) \leq n_{min} \leq Min(n_B,1)\\
& &  \text{Another equation here}\\
\end{aligned}
\end{equation}

\end{document}

Current output:

enter image description here

Best Answer

Your MWE has errors: you nested equation (\[ ... \]) in equation ... I try to figured out what is your problem. After cleaning of your code I obtain the following results:

enter image description here

Is this what you looking for? In your code I also added a split environment for the long first equation:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{mathtools}
\DeclareMathOperator*{\argmax}{argmax} 

\begin{document}
\begin{align}
\begin{split}
\argmax_{n_{\min}}\Pi
    & = \frac{1}{M}\int\limits_{n_{\min}}^M\! n_cP_c\, \mathrm{d}n_c \\
    &\qquad   + \frac{p}{M}\int\limits_{n_B}^M\delta\bigg(z\beta P_r\big(h(1-n_B) + 
                (1-h)x_B\big)-D\bigg)\, \mathrm{d}n_c \\
    &\qquad   + \frac{1-p}{M}\int\limits_{n_{\min}}^M 
                \delta\bigg(z\beta P_r\big(h(1-n_B) + (1-h)x_G\big)-D\bigg)\, \mathrm{d}n_c
      \end{split}                                           \\
\text{subject to}
        &\ \max(n_G, 0) \leq n_{min} \leq \min(n_B,1)      \notag  \\
        &  \text{Another equation here}
\end{align}
\end{document}

Thanks to @egreg for the improvements he suggested in his comment.

Related Question