我有一个长表达式(最大化问题),我使用将其强制移到下一行//
。
我还有两个函数(“subject to”)想放在下面。我用它们来&
让表达式垂直放置。
问题:
- 我必须强制降低的第三个积分表达式看起来很奇怪,并且与上面的两个积分表达式不一致。我不知道如何修复它。
- 对齐不正确。Fx“此处还有另一个方程式”应与对齐
Max(n_G, 0) \leq n_{min} \leq Min(n_B,1)
。使用&
显然无法解决问题。 - 额外:我使用它的原因
\def\mclimits_#1{\limits_{\mathclap{#1}}}
是为了让长表达式n_{min}
适合积分的限制。
代码:
\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}
电流输出:
答案1
您的 MWE 有错误:您\[ ... \]
在方程式中嵌套了方程式()...我试图找出您的问题所在。清理您的代码后,我得到以下结果:
这是你要找的吗?在你的代码中,我还split
为第一个长方程添加了一个环境:
\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}
感谢@egreg 在评论中提出的改进建议。
答案2
我不确定我理解得对不对。像这样吗?
% arara: pdflatex
\documentclass{article}
\usepackage{blindtext}
\usepackage{mathtools}
\DeclareMathOperator{\argmax}{argmax}
\def\mclimits_#1{\limits_{\mathclap{#1}}}
\begin{document}
\blindtext
\begin{align}
\begin{split}
\underset{n_{\min}}{\argmax}(\Pi) &= \frac{1}{M}\int\mclimits_{n_{\min}}^M n_c P_c\, \mathrm{d}n_c \\
&\quad+ \frac{p}{M}\int\mclimits_{n_B}^M \delta\Bigl(z\beta P_r\bigl(h(1-n_B)+(1-h)x_B\bigr)-D\Bigr)\, \mathrm{d}n_c \\
&\quad+ \frac{1-p}{M}
\int\mclimits_{n_{\min}}^M \delta\Bigl(z\beta P_r\bigl(h(1-n_B)+(1-h)x_G\bigr)-D\Bigr)\, \mathrm{d}n_c
\end{split}
\shortintertext{subject to}
&\max(n_G, 0) \leq n_{\min} \leq \min(n_B,1)\\
&\text{Another equation here}
\end{align}
\blindtext
\end{document}
答案3
使用 ConTeXT MKIV
\setupmathlabeltext[argmax=argmax]
\definemathcommand[argmax][limop]{\mfunctionlabeltext{argmax}}
\starttext
\placeformula
\startformula
\startmathalignment
\NC \argmax_{n_{\min}}\Pi
\NC = \frac{1}{M}\int\limits_{n_{\min}}^M\! n_cP_c\, \diff n_c \NR
\NC\NC\quad + \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)\, \diff n_c \NR
\NC\NC\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)\, \diff n_c \NR[+]
\startintertext
subject to
\stopintertext
\NC \max(n_G, 0) \NC \leq n_{\min} \leq \min(n_B,1) \NR
\NC \NC \text{Another equation here} \NR[+]
\stopmathalignment
\stopformula
\stoptext
答案4
使用该geometry
包,您可以获得更合理的边距,并且看起来更美观alignat
:
\documentclass{article}
\usepackage[showframe]{geometry}
\usepackage{mathtools}
\DeclareMathOperator{\argmax}{argmax}
\def\mclimits_#1{\limits_{\mathclap{#1}}}
\begin{document}
\begin{alignat}{2}
& \argmax_t{n_{\min}}(\Pi) &&=\!\begin{aligned}[t]\frac{1}{M}\int\mclimits_{n_{\min}}^M n_c P_c\, \mathrm{d}n_c + \frac{p}{M}\int\mclimits_{n_B}^M \delta\Bigl(z\beta P_r\bigl(h(1-n_B)+(1-h)x_B\bigr)-D\Bigr)\, \mathrm{d}n_c & \\
+ \frac{1-p}{M} \int\mclimits_{n_{\min}}^M \delta\Bigl(z\beta P_r\bigl(h(1-n_B)+(1-h)x_G\bigr)-D\Bigr)\, \mathrm{d}n_c &
\end{aligned}\\
& \text{subject to} \quad\mathrlap{\max(n_G, 0) \leq n_{\min} \leq \min(n_B,1)} \notag\\[1.5ex]
& \rlap{Another equation here}
\end{alignat}
\end{document}