我有一个带有方程式的代码:
\begin{align*}
&min(\norm{[\hat{w}(k)-\hat{y}(k)-&M^P \Delta \hat{u}^P (k)]-M \Delta \hat{u}(k)}_\psi^2 +\norm{\Delta \hat{u}(k)}_\Lambda^2)\\
&\text{\textit{za podmínek}} &-\Delta U_{max} \leq \Delta\hat{u}(k) \leq \Delta U_{max}\\
&&U_{min}\leq U(k-1)+J \Delta \hat{u}(k)\leq U_{max}\\
&&Y_{min} \leq \hat{y}^0 (k)+M\Delta \hat{u}(k) \leq Y_{max}
\end{align*}
输出为
第一条蓝线先对齐,第二条蓝线后对齐。两条都左对齐。我该如何实现?谢谢帮助。
答案1
您可以使用环境来实现这一点alignat*
。以下是两种布局:
\documentclass[a4paper, 11pt]{book}
\usepackage[utf8]{inputenc}
\usepackage{fourier, erewhon}
\usepackage{mathtools}
\DeclarePairedDelimiter\norm\lVert\rVert
\begin{document}
\begin{alignat*}{2}
& \min\bigl(\norm{[\hat{w}(k)-\hat{y}(k)-{} & & M^P Δ\hat{u}^P (k)]-M Δ\hat{u}(k)}_\psi² +\norm{Δ\hat{u}(k)}_\Lambda²\bigr) \\
& \textit{za podmínek} & &\mathllap{-}ΔU_{\max} \leq Δ\hat{u}(k) \leq ΔU_{\max} \\
& & & U_{\min}\leq U(k-1)+J Δ\hat{u}(k)\leq U_{\max} \\
& & & Y_{\min} \leq \hat{y}⁰ (k)+MΔ\hat{u}(k) \leq Y_{\max}
\end{alignat*}
\begin{alignat*}{2}
& \min\bigl(\norm{[\hat{w}(k)-\hat{y}(k)& &-M^P Δ\hat{u}^P (k)]-M Δ\hat{u}(k)}_\psi² +\norm{Δ\hat{u}(k)}_\Lambda²\bigr) \\
& \textit{za podmínek} & & \begin{array}[t]{|@{\quad}l}
\mathllap{-}ΔU_{\max} \leq Δ\hat{u}(k) \leq ΔU_{\max} \\
U_{\min}\leq U(k-1)+J Δ\hat{u}(k)\leq U_{\max} \\
Y_{\min} \leq \hat{y}⁰ (k)+MΔ\hat{u}(k) \leq Y_{\max}
\end{array}
\end{alignat*}
\end{document}
答案2
一个替代array
方案:
\documentclass[tikz,varwidth,border=3mm]{standalone}
\usepackage{mathtools}
\DeclarePairedDelimiter\norm\lVert\rVert
\begin{document}
\[\renewcommand\arraycolsep{1pt}
\begin{array}{lcl}
min(\norm{[\hat{w}(k)-\hat{y}(k)
& - & M^P \Delta \hat{u}^P (k)] - M
\Delta\hat{u}(k)}_\psi^2 +
\norm{\Delta \hat{u}(k)}_\Lambda^2) \\
\text{\textit{za podmínek}}
& - & \Delta U_{max} \leq \Delta\hat{u}(k)\leq \Delta U_{max} \\
& & U_{min}\leq U(k-1)+J \Delta \hat{u}(k)\leq U_{max} \\
& & Y_{min} \leq \hat{y}^0 (k)+M\Delta \hat{u}(k) \leq Y_{max}
\end{array}\]
\end{document}