我该如何正确对齐这个长的多行方程?

我该如何正确对齐这个长的多行方程?

我希望格式化以下等式:

在此处输入图片描述

\documentclass{article}

\usepackage{amsmath}

\begin{document}
    \centering
        \begin{align*}
            \det\left(\mathbf{A}_{\mp}\right)
            &=
            \det
            \begin{pmatrix}
                a_{2,1} \mp a_{1,1}\\
                a_{2,2} \mp a_{1,2}\\
                a_{2,3} \mp a_{1,3}\\
            \end{pmatrix}
            =
            \det
            \begin{pmatrix}
                a_{2,1}\\
                a_{2,2} \mp a_{1,2}\\
                a_{2,3} \mp a_{1,3}\\
            \end{pmatrix} 
            \mp
            \det
            \begin{pmatrix}
                a_{1,1}\\
                a_{2,2} \mp a_{1,2}\\
                a_{2,3} \mp a_{1,3}\\
            \end{pmatrix}\\
            &=
            \det
            \begin{pmatrix}
                a_{2,1}\\
                a_{2,2}\\
                a_{2,3} \mp a_{1,3}\\
            \end{pmatrix}
            \mp
            \det
            \begin{pmatrix}
                a_{2,1}\\
                a_{1,2}\\
                a_{2,3} \mp a_{1,3}\\
            \end{pmatrix}
            \mp\left\{
            \det
            \begin{pmatrix}
                a_{1,1}\\
                a_{2,2}\\
                a_{2,3} \mp a_{1,3}\\
            \end{pmatrix}
            \mp
            \det
            \begin{pmatrix}
                a_{1,1}\\
                a_{1,2}\\
                a_{2,3} \mp a_{1,3}\\
            \end{pmatrix}
            \right\}\\
            &=
            \det
            \begin{pmatrix}
                a_{2,1}\\
                a_{2,2}\\
                a_{2,3}\\
            \end{pmatrix} 
            \mp 
            \det\begin{pmatrix}
                a_{2,1}\\
                a_{2,2}\\
                a_{1,3}\\
            \end{pmatrix}
            \mp\left[
            \det
            \begin{pmatrix}
                a_{2,1}\\
                a_{1,2}\\
                a_{2,3}\\
            \end{pmatrix} 
            \mp
            \det
            \begin{pmatrix}
                a_{2,1}\\
                a_{1,2}\\
                a_{1,3}\\
            \end{pmatrix} \right]\\
            &\mp 
            \left\{
            \det
            \begin{pmatrix}
                a_{1,1}\\
                a_{2,2}\\
                a_{2,3}\\
            \end{pmatrix}
            \mp
            \det\begin{pmatrix}
                a_{1,1}\\
                a_{2,2}\\
                a_{1,3}\\
            \end{pmatrix}
            \mp\left[
            \det
            \begin{pmatrix}
                a_{1,1}\\
                a_{1,2}\\
                a_{2,3}\\
            \end{pmatrix} 
            \mp
            \det\begin{pmatrix}
                a_{1,1}\\
                a_{1,2}\\
                a_{1,3}\\
            \end{pmatrix}
            \right] 
            \right\}\\
            &=
            \det
            \begin{pmatrix}
                a_{2,1}\\
                a_{2,2}\\
                a_{2,3}\\
            \end{pmatrix} 
            \mp
            \det\begin{pmatrix}
                a_{2,1}\\
                a_{2,2}\\
                a_{1,3}\\
            \end{pmatrix}
            \mp
            \det
            \begin{pmatrix}
                a_{2,1}\\
                a_{1,2}\\
                a_{2,3}\\
            \end{pmatrix}
            +
            \det
            \begin{pmatrix}
                a_{2,1}\\
                a_{1,2}\\
                a_{1,3}\\
            \end{pmatrix}\\
            &\mp
            \det
            \begin{pmatrix}
                a_{1,1}\\
                a_{2,2}\\
                a_{2,3}\\
            \end{pmatrix}
            +
            \det
            \begin{pmatrix}
                a_{1,1}\\
                a_{2,2}\\
                a_{1,3}\\
            \end{pmatrix}
            +
            \det
            \begin{pmatrix}
                a_{1,1}\\
                a_{1,2}\\
                a_{2,3}\\
            \end{pmatrix}
            \mp
            \det
            \begin{pmatrix}
                a_{1,1}\\
                a_{1,2}\\
                a_{1,3}\\
            \end{pmatrix}
        \end{align*}
\end{document}

我的方法是对齐前两行和后四行的所有“det”项。我已经尝试使用嵌套alignedat环境和vphantom/来实现这一点hphantom。然而,仍然存在很多错位:

在此处输入图片描述

\documentclass{article}

\usepackage{amsmath}

\newcommand{\hspaceone}{\hphantom{\left\{\vphantom{\det
                        \begin{pmatrix}
                            a_{1,1}\\
                            a_{1,2}\\
                            a_{1,3}\\
                        \end{pmatrix}}\right.}}

\newcommand{\hspacetwo}{\hphantom{\left\{\vphantom{\det
                        \begin{pmatrix}
                            a_{1,1}\\
                            a_{1,2}\\
                            a_{1,3}\\
                        \end{pmatrix}}\right.}}

\newcommand{\vspaceone}{\vphantom{\det
                        \begin{pmatrix}
                            a_{1,1}\\
                            a_{2,2}\\
                            a_{2,3} \mp a_{1,3}\\
                        \end{pmatrix}}}

\newcommand{\vspacetwo}{\vphantom{\det
                        \begin{pmatrix}
                            a_{1,1}\\
                            a_{2,2} \\
                            a_{2,3} \mp a_{1,3}\\
                        \end{pmatrix}}}

\newcommand{\vspacethree}{\vphantom{\det
                          \begin{pmatrix}
                              a_{2,1}\\
                              a_{1,2}\\
                              a_{2,3}\\
                          \end{pmatrix}}}

\newcommand{\vspacefour}{\vphantom{\det
                         \begin{pmatrix}
                             a_{2,1}\\
                             a_{1,2}\\
                             a_{1,3}\\
                         \end{pmatrix}}}

\newcommand{\vspacefive}{\vphantom{\det
                         \begin{pmatrix}
                             a_{1,1}\\
                             a_{1,2}\\
                             a_{1,3}\\
                         \end{pmatrix}}}

\newcommand{\vspacesix}{\vphantom{\det
                        \begin{pmatrix}
                            a_{1,1}\\
                            a_{1,2}\\
                            a_{2,3}\\
                        \end{pmatrix}}}

\newcommand{\vspaceseven}{\vphantom{\det
                          \begin{pmatrix}
                              a_{1,1}\\
                              a_{1,2}\\
                              a_{1,3}\\
                          \end{pmatrix}}}

\newcommand{\vspaceeight}{\vphantom{\det
                          \begin{pmatrix}
                              a_{1,1}\\
                              a_{1,2}\\
                              a_{1,3}\\
                          \end{pmatrix}}}


\begin{document}
    \thispagestyle{empty}

    \begin{align*}
        \det\left(\mathbf{A}_{\mp}\right) 
        &
        \begin{alignedat}[t]{6}
            &=\hspaceone&&
            \det
            \begin{pmatrix}
                a_{2,1} \mp a_{1,1}\\
                a_{2,2} \mp a_{1,2}\\
                a_{2,3} \mp a_{1,3}\\
            \end{pmatrix}
            &&=&&
            \det
            \begin{pmatrix}
                a_{2,1}\\
                a_{2,2} \mp a_{1,2}\\
                a_{2,3} \mp a_{1,3}\\
            \end{pmatrix} 
            &&\mp&&
            \det
            \begin{pmatrix}
                a_{1,1}\\
                a_{2,2} \mp a_{1,2}\\
                a_{2,3} \mp a_{1,3}\\
            \end{pmatrix}\\
            &=\hspacetwo&&
            \det
            \begin{pmatrix}
                a_{2,1}\\
                a_{2,2}\\
                a_{2,3} \mp a_{1,3}\\
            \end{pmatrix}
            &&\mp&&
            \det
            \begin{pmatrix}
                a_{2,1}\\
                a_{1,2}\\
                a_{2,3} \mp a_{1,3}\\
            \end{pmatrix}
            &&\mp\left\{\vspaceone\right.&&
            \det
            \begin{pmatrix}
                a_{1,1}\\
                a_{2,2}\\
                a_{2,3} \mp a_{1,3}\\
            \end{pmatrix}\mp
            \det
            \begin{pmatrix}
                a_{1,1}\\
                a_{1,2}\\
                a_{2,3} \mp a_{1,3}\\
            \end{pmatrix}
            \left.\vspacetwo\right\}
        \end{alignedat}\\[0.1cm]
        &
        \begin{alignedat}[b]{8}
            &=&&
            \det
            \begin{pmatrix}
                a_{2,1}\\
                a_{2,2}\\
                a_{2,3}\\
            \end{pmatrix} 
            &&\mp&&     
            \det\begin{pmatrix}
                a_{2,1}\\
                a_{2,2}\\
                a_{1,3}\\
            \end{pmatrix}
            &&\mp\left[\vspacethree\right.&&
            \det
            \begin{pmatrix}
                a_{2,1}\\
                a_{1,2}\\
                a_{2,3}\\
            \end{pmatrix} 
            &&\mp&&
            \det
            \begin{pmatrix}
                a_{2,1}\\
                a_{1,2}\\
                a_{1,3}\\
            \end{pmatrix} \left.\vspacefour\right]\\
            &\mp \left\{\vspacefive\right.&&
            \det
            \begin{pmatrix}
                a_{1,1}\\
                a_{2,2}\\
                a_{2,3}\\
            \end{pmatrix}
            &&\mp&&
            \det\begin{pmatrix}
                a_{1,1}\\
                a_{2,2}\\
                a_{1,3}\\
            \end{pmatrix}
            &&\mp\left[\vspacesix\right.&&
            \det
            \begin{pmatrix}
                a_{1,1}\\
                a_{1,2}\\
                a_{2,3}\\
            \end{pmatrix} 
            &&\mp&&
            \det\begin{pmatrix}
                a_{1,1}\\
                a_{1,2}\\
                a_{1,3}\\
            \end{pmatrix}
            \left.\vspaceseven\right] 
            \left.\vspaceeight\right\}\\
            &=&&
            \det
            \begin{pmatrix}
                a_{2,1}\\
                a_{2,2}\\
                a_{2,3}\\
            \end{pmatrix} 
            &&\mp&& 
            \det\begin{pmatrix}
                a_{2,1}\\
                a_{2,2}\\
                a_{1,3}\\
            \end{pmatrix}
            &&\mp&&
            \det
            \begin{pmatrix}
                a_{2,1}\\
                a_{1,2}\\
                a_{2,3}\\
            \end{pmatrix}
            &&+&&
            \det
            \begin{pmatrix}
                a_{2,1}\\
                a_{1,2}\\
                a_{1,3}\\
            \end{pmatrix}\\
            &\mp&&
            \det
            \begin{pmatrix}
                a_{1,1}\\
                a_{2,2}\\
                a_{2,3}\\
            \end{pmatrix}
            &&+&&
            \det
            \begin{pmatrix}
                a_{1,1}\\
                a_{2,2}\\
                a_{1,3}\\
            \end{pmatrix}
            &&+&&
            \det
            \begin{pmatrix}
                a_{1,1}\\
                a_{1,2}\\
                a_{2,3}\\
            \end{pmatrix}
            &&\mp&&
            \det
            \begin{pmatrix}
                a_{1,1}\\
                a_{1,2}\\
                a_{1,3}\\
            \end{pmatrix}
        \end{alignedat}
    \end{align*}
\end{document}

我怎样才能正确地对齐这些det术语?

答案1

我会使用单一align*环境。然后,只有在正确输入数学部分后,我才会插入一些精心选择的\mskip指令来微调水平对齐。话虽如此,我认为没有必要进行微调。

在此处输入图片描述

\documentclass{article}
\usepackage{amsmath,mleftright}
\mleftright

\begin{document}
\begin{align*}
\det(\mathbf{A}_{\mp}) 
&= \mskip32mu
   \det \begin{pmatrix}
        a_{2,1} \mp a_{1,1}\\ a_{2,2} \mp a_{1,2}\\ a_{2,3} \mp a_{1,3}
        \end{pmatrix} \\[1.5ex]
&= \mskip32mu
   \det \begin{pmatrix}
        a_{2,1}\\ a_{2,2} \mp a_{1,2}\\ a_{2,3} \mp a_{1,3}
        \end{pmatrix} 
   \mp
   \det \begin{pmatrix}
        a_{1,1}\\ a_{2,2} \mp a_{1,2}\\ a_{2,3} \mp a_{1,3}
        \end{pmatrix} \\[1.5ex]
&= \mskip32mu
   \det \begin{pmatrix}
        a_{2,1}\\ a_{2,2}\\ a_{2,3} \mp a_{1,3}
        \end{pmatrix}
   \mp
   \det \begin{pmatrix}
        a_{2,1}\\ a_{1,2}\\ a_{2,3} \mp a_{1,3}
        \end{pmatrix} \\
&\quad
   \mp
   \left\{
   \det \begin{pmatrix}
        a_{1,1}\\ a_{2,2}\\ a_{2,3} \mp a_{1,3}
        \end{pmatrix}
   \mp
   \det \begin{pmatrix}
        a_{1,1}\\ a_{1,2}\\ a_{2,3} \mp a_{1,3}
        \end{pmatrix} 
   \right\} \\[1.5ex]
&= \mskip32mu
   \det \begin{pmatrix}
        a_{2,1}\\ a_{2,2}\\ a_{2,3}
        \end{pmatrix} 
   \mp    
   \det \begin{pmatrix}
        a_{2,1}\\ a_{2,2}\\ a_{1,3}
        \end{pmatrix}
   \mp
   \left[
   \det \begin{pmatrix}
        a_{2,1}\\ a_{1,2}\\ a_{2,3}
        \end{pmatrix} 
   \mp
   \det \begin{pmatrix}
        a_{2,1}\\ a_{1,2}\\ a_{1,3}
        \end{pmatrix} 
   \right] \\
&\quad \mp 
   \left\{
   \det \begin{pmatrix}
        a_{1,1}\\ a_{2,2}\\ a_{2,3}
        \end{pmatrix}
   \mp
   \det \begin{pmatrix}
        a_{1,1}\\ a_{2,2}\\ a_{1,3}
        \end{pmatrix}
   \mp
   \left[
   \det \begin{pmatrix}
        a_{1,1}\\ a_{1,2}\\ a_{2,3}
        \end{pmatrix} 
   \mp
   \det \begin{pmatrix}
        a_{1,1}\\ a_{1,2}\\ a_{1,3}
        \end{pmatrix}
   \right] 
   \right\} \\[1.5ex]
&= \mskip16mu
   \det \begin{pmatrix}
        a_{2,1}\\ a_{2,2}\\ a_{2,3}
        \end{pmatrix} 
   \mp
   \det \begin{pmatrix}
        a_{2,1}\\ a_{2,2}\\ a_{1,3}
        \end{pmatrix}
   \mp
   \det \begin{pmatrix}
        a_{2,1}\\ a_{1,2}\\ a_{2,3}
        \end{pmatrix}
   +
   \det \begin{pmatrix}
        a_{2,1}\\ a_{1,2}\\ a_{1,3}
        \end{pmatrix} \\
&\quad \mp
   \det \begin{pmatrix}
        a_{1,1}\\ a_{2,2}\\ a_{2,3}
        \end{pmatrix}
   +
   \det \begin{pmatrix}
        a_{1,1}\\ a_{2,2}\\ a_{1,3}
        \end{pmatrix}
   +
   \det \begin{pmatrix}
        a_{1,1}\\ a_{1,2}\\ a_{2,3}
        \end{pmatrix}
   \mp
   \det \begin{pmatrix}
        a_{1,1}\\ a_{1,2}\\ a_{1,3}
        \end{pmatrix}
\end{align*}
\end{document}

相关内容