帮助调整环境和分割

帮助调整环境和分割

我想要一些关于如何使我的方程式像这样对齐的指导: 在此处输入图片描述

这是我的代码:

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{align}
{\mathbf{u}} & = H^{-1}({\mathbf{P}}_{T}-B) \\
& = {}\begin{split}\begin{bmatrix}
\sin\theta_{1} & \cos\theta_{1} \\
\cos\theta_{1} & \sin\theta_{1}
\end{bmatrix}^{-1}{}
&\left(
\begin{bmatrix}
(L_{1} + \delta r_{3v} + r_{3v})\cos\theta_{1} + r_{2}\sin\theta_{1} \\
(L_{1} + \delta r_{3v} + r_{3v})\sin\theta_{1} - r_{2}\cos\theta_{1}
\end{bmatrix}\right.\\
& \left. - \begin{bmatrix}
         (L_{1} + r_{3})\cos\theta_{1} + r_{2}\sin\theta_{1} \\
         (L_{1} + r_{3})\sin\theta_{1} - r_{2}\cos\theta_{1}
        \end{bmatrix} \vphantom{(L_{1} + \delta r_{3v} + r_{3v})\cos\theta_{1}}\right)
\end{split}
\end{align}
\end{document}

我查看了其他帖子,也尝试使用\vphantom{},但无法获得正确的输出。你能帮助我获得正确的输出吗?谢谢。

答案1

最好注意,你可以使用 usealigned而不是 `split 来获得。它的缺点是方程编号的位置。它与对齐环境中的第一行对齐:

在此处输入图片描述

我在下面的代码中移除了所有不必要的东西。为了调整括号,我(通过试验)将\;其放在第一行前面。

\documentclass{article}
\usepackage{amsmath}

\begin{document}
\begin{align}
\mathbf{u} & = H^{-1}(\mathbf{P}_{T}-B) &\\
           & = \begin{aligned}[t]\begin{bmatrix}
\sin\theta_{1} & \cos\theta_{1} \\
\cos\theta_{1} & \sin\theta_{1}
                            \end{bmatrix}^{-1}
               &\left(\;\begin{bmatrix}
(L_{1} + \delta r_{3v} + r_{3v})\cos\theta_{1} + r_{2}\sin\theta_{1} \\
(L_{1} + \delta r_{3v} + r_{3v})\sin\theta_{1} - r_{2}\cos\theta_{1}
                \end{bmatrix}\right.\\
               &\left. - \begin{bmatrix}
         (L_{1} + r_{3})\cos\theta_{1} + r_{2}\sin\theta_{1} \\
         (L_{1} + r_{3})\sin\theta_{1} - r_{2}\cos\theta_{1}
                            \end{bmatrix} 
         \right)
                \end{aligned}
\end{align}
\end{document}

编辑:也许将第二行移到左边比将第一行移到右边会更好(消除括号和方括号之间的距离):

               &\left(\begin{bmatrix}
(L_{1} + \delta r_{3v} + r_{3v})\cos\theta_{1} + r_{2}\sin\theta_{1} \\
(L_{1} + \delta r_{3v} + r_{3v})\sin\theta_{1} - r_{2}\cos\theta_{1}
                \end{bmatrix}\right.\\
               &\kern-0.8ex\left. - \begin{bmatrix}% <-- here is adjusted position of bracket
         (L_{1} + r_{3})\cos\theta_{1} + r_{2}\sin\theta_{1} \\
         (L_{1} + r_{3})\sin\theta_{1} - r_{2}\cos\theta_{1}
                            \end{bmatrix} 
                \right)

编辑(2):根据 Guho 的评论,还有另一种选择:

\begin{align}
\mathbf{u} & = H^{-1}(\mathbf{P}_{T}-B) &\\
           & = \begin{aligned}[t]\begin{bmatrix}
\sin\theta_{1} & \cos\theta_{1} \\
\cos\theta_{1} & \sin\theta_{1}
                            \end{bmatrix}^{-1}
               \bigg(&\begin{bmatrix}
(L_{1} + \delta r_{3v} + r_{3v})\cos\theta_{1} + r_{2}\sin\theta_{1} \\
(L_{1} + \delta r_{3v} + r_{3v})\sin\theta_{1} - r_{2}\cos\theta_{1}
                \end{bmatrix}\\
                   - &\begin{bmatrix}
         (L_{1} + r_{3})\cos\theta_{1} + r_{2}\sin\theta_{1} \\
         (L_{1} + r_{3})\sin\theta_{1} - r_{2}\cos\theta_{1}
                            \end{bmatrix} 
                \bigg)
                \end{aligned}
\end{align}

通过手动设置括号大小(\big、\bigg、\Big .... 等),ypo 可以在括号和其余方程式之间放置“与”符号。这样,您就不必像以前一样手动移动行,但是,您需要选择括号的大小。

相关内容