我在对齐 split 命令中的两个方程块时遇到了问题。我希望以下代码中的“subject to”对齐到左侧(miinimize 函数开始的位置),但我还需要两个约束方程彼此对齐。这是我目前拥有的代码:
\documentclass[review]{elsarticle}
\usepackage{siunitx} % Formats the units and values
\usepackage[fleqn]{amsmath}
\usepackage{xfrac}
\allowdisplaybreaks
\begin{document}
\begin{align}
\begin{split}
\min_{u,v}\sum_{m=1}^{M} \bigg[ p_m \cdot \sum_{k=-N+1}^{0} \Big(
&w_x \left\| \hat{x}^k-x^{k,m}(u) \right\| + \Big. \bigg. \\
& \bigg. \Big. w_y\lVert \hat{y}^k-y^{k,m}(u,v) \rVert +
w_u\lVert u^k \rVert + w_v\lVert v^k \rVert \Big) \bigg]
\end{split} \\
\text{subject to:}\quad &u_L\leq u^k \leq u_U \\
&u_L\leq u^k \leq u_U
\end{align}
\end{document}
有什么建议吗?
答案1
以下是解决方案的两种变体。我稍微改进了您的代码,使用来自的命令定义了一个\norm
带有可调整分隔符的命令。\DeclarePairedDelimiter
mathtools
\documentclass{article}
\usepackage{mathtools}
\DeclarePairedDelimiter{\norm}\lVert\rVert
\begin{document}
\begin{align}
& \min_{u,v}\sum_{m=1}^{M} \biggl[ p_m \cdot\smashoperator{\sum_{k=-N+1}^{0}}\:%
\begin{aligned}[t]\Bigl(& w_x \norm[\big]{\hat{x}^k-x^{k,m}(u)} + w_y\norm[\big]{\hat{y}^k-y^{k,m}(u,v)} \\ %
\mathllap{{} +{}} &w_u \norm[\big]{u^k} + w_v \norm[\big]{v^k}\Bigr) \biggr]
\end{aligned}
\\
& \text{subject to:}\quad u_L\leq u^k \leq u_U \\
&\phantom{\text{subject to:}}\quad u_L\leq u^k \leq u_U
\end{align}
\begin{align}
& \min_{u,v}\sum_{m=1}^{M} \biggl[ p_m \cdot\smashoperator{\sum_{k=-N+1}^{0}}\:%
\begin{aligned}[t]\Bigl( w_x \norm[\big]{\hat{x}^k-x^{k,m}(u)} &+ w_y\norm[\big]{\hat{y}^k-y^{k,m}(u,v)} \\ %
&+w_u \norm[\big]{u^k}+ w_v \norm[\big]{v^k}\Bigr) \biggr]
\end{aligned}
\\
& \text{subject to:}\quad u_L\leq u^k \leq u_U \\
&\phantom{\text{subject to:}}\quad u_L\leq u^k \leq u_U
\end{align}
\end{document}
答案2
这是一个使用单一align
环境的解决方案。正如@Bernard的回答中所说,我加载了mathtools
包(包的超集)来使用指令amsmath
设置一个名为的宏。对齐点是第 1 行中的求和符号以及第 3 行和第 4 行中不等式的开头。\norm
\DeclarePairedDelimiter
\documentclass[review]{elsarticle}
\usepackage{siunitx} % Formats the units and values
\usepackage[fleqn]{mathtools} % automatically loads 'amsmath' too
\DeclarePairedDelimiter{\norm}{\lVert}{\rVert}
\begin{document}
\begin{align}
\min_{u,v}&\sum_{m=1}^{M}
\biggl[ p_m \cdot \smashoperator[l]{\sum_{k=-N+1}^{0}}
\!\Bigl(w_x \norm[\big]{ \hat{x}^k-x^{k,m}(u) } \notag \\
&\qquad\qquad+ w_y\norm[\big]{\hat{y}^k-y^{k,m}(u,v)} +
w_u\norm[\big]{ u^k} + w_v\norm[\big]{v^k} \Bigr) \biggr]\\
\text{subject to:}\quad &u_L\leq u^k \leq u_U \\
&u_L\leq u^k \leq u_U
\end{align}
\end{document}