用矩阵和注释排版方程式

用矩阵和注释排版方程式

我想要排版如图所示的等式。 在此处输入图片描述

我知道如何排版方程式

\begin{gather}
 \begin{bmatrix} \Phi_{11} & \Phi_{12} \\ \Phi_{21} & \Phi_{22} \end{bmatrix}
 \begin{bmatrix} \Phi_{11} & \Phi_{12} \\ \Phi_{21} & \Phi_{22} \end{bmatrix}
 =
  \begin{bmatrix}
   X_{22} Y_{11} - X_{12} Y_{21} &
   X_{22} Y_{12} - X_{12} Y_{22} \\
   X_{11} Y_{21} - X_{21} Y_{11} &
   X_{11} Y_{22} - X_{21} Y_{12} 
   \end{bmatrix}
\end{gather}

但不知道如何添加注释,使方程式看起来与图中所示完全一样。有什么想法吗?

答案1

有了nicematrix它,获得这样的输出就非常容易。

\documentclass{article}
\usepackage{amsmath}
\usepackage{nicematrix}
\newcommand{\Vdashes}{\begin{tikzpicture}[baseline={(0,0)}]
\draw[densely dashed] (0,-1.5) -- (0,1);
\end{tikzpicture}}
\begin{document}
\[
 \Vdashes\begin{bNiceArray}{CCC}[first-col,code-for-first-col =\scriptstyle,
 name=M,
 code-after = {\begin{tikzpicture}
 \path (2-1.south) -- (2-2.south) node[midway,below=1em]{$\mathsf{M}$};
    \end{tikzpicture}}] 
 \mathsf{a}:&\Phi_{11} & \Phi_{12} \\ 
 \mathsf{b}:&\Phi_{21} & \Phi_{22} 
 \end{bNiceArray}\Vdashes
 \begin{bNiceArray}{CC}[name=W,
 code-after = {\begin{tikzpicture}
 \path (2-1.south) -- (2-2.south) node[midway,below=1em]{$\mathsf{W}$};
    \end{tikzpicture}}] 
  \Phi_{11} & \Phi_{12} \\ 
  \Phi_{21} & \Phi_{22} 
 \end{bNiceArray}
 =\Vdashes
 \begin{bNiceArray}{CCC}[first-col,code-for-first-col =\scriptstyle,
  name=T,
 code-after = {\begin{tikzpicture}
 \path (2-1.south) -- (2-2.south) node[midway,below=1em]{$\mathsf{T}$};
    \end{tikzpicture}}] 
  \mathsf{a}:& X_{22} Y_{11} - X_{12} Y_{21} &
   X_{22} Y_{12} - X_{12} Y_{22} \\
  \mathsf{b}:& X_{11} Y_{21} - X_{21} Y_{11} &
   X_{11} Y_{22} - X_{21} Y_{12} 
 \end{bNiceArray}
 \Vdashes
\]
\end{document}

在此处输入图片描述

根据要求。不确定我个人是否喜欢这些下支架,但添加它们很容易。(至少标志=处于正确的垂直位置。)

\documentclass{article}
\usepackage{mathtools}
\usepackage{nicematrix}
\begin{document}
\[
 \underbrace{\begin{bNiceArray}{CCC}[first-col,
 code-for-first-col =\scriptstyle] 
 \mathsf{a}\mathrlap{:}&\Phi_{11} & \Phi_{12} \\ 
 \mathsf{b}\mathrlap{:}&\Phi_{21} & \Phi_{22} 
 \end{bNiceArray}}_{\textstyle =M}
 \underbrace{\begin{bNiceArray}{CC} 
  \Phi_{11} & \Phi_{12} \\ 
  \Phi_{21} & \Phi_{22} 
 \end{bNiceArray}}_{\textstyle =W}
 =
 \underbrace{\begin{bNiceArray}{CCC}[first-col,code-for-first-col =\scriptstyle] 
  \mathsf{a}\mathrlap{:}& X_{22} Y_{11} - X_{12} Y_{21} &
   X_{22} Y_{12} - X_{12} Y_{22} \\
  \mathsf{b}\mathrlap{:}& X_{11} Y_{21} - X_{21} Y_{11} &
   X_{11} Y_{22} - X_{21} Y_{12} 
 \end{bNiceArray}}_{\textstyle =T}
\]
\end{document}

在此处输入图片描述

如果需要,您可以进一步缩小ab列。

\documentclass{article}
\usepackage{mathtools}
\usepackage{nicematrix}
\begin{document}
\[
 \underbrace{\begin{bNiceArray}{CCC}[first-col,
 code-for-first-col =\!\!] 
 \mathsf{a}\mathrlap{:}&\Phi_{11} & \Phi_{12} \\ 
 \mathsf{b}\mathrlap{:}&\Phi_{21} & \Phi_{22} 
 \end{bNiceArray}}_{\textstyle =M}
 \underbrace{\begin{bNiceArray}{CC} 
  \Phi_{11} & \Phi_{12} \\ 
  \Phi_{21} & \Phi_{22} 
 \end{bNiceArray}}_{\textstyle =W}
 =
 \underbrace{\begin{bNiceArray}{CCC}[first-col,code-for-first-col =\!\!] 
  \mathsf{a}\mathrlap{:}& X_{22} Y_{11} - X_{12} Y_{21} &
   X_{22} Y_{12} - X_{12} Y_{22} \\
  \mathsf{b}\mathrlap{:}& X_{11} Y_{21} - X_{21} Y_{11} &
   X_{11} Y_{22} - X_{21} Y_{12} 
 \end{bNiceArray}}_{\textstyle =T}
\]
\end{document}

在此处输入图片描述

答案2

arydshln和的组合nicematrix,但没有明确的 TiZ。

修复命令中的数字\rule以适合您。可选参数设置基线(即穿过方程式数字底部的线)下的空间量,第二个强制参数指定全部的规则的高度。根据给定的代码,基线以下有 50pt,基线以上有 40pt。

\documentclass{article}
\usepackage{amsmath,array,arydshln,nicematrix}

\begin{document}

\begin{equation}
\newcommand{\matrixname}[2]{% #1 = number of columns to span, #2 = name
  \multicolumn{#1}{C}{\mbox{\Large$#2\smash[b]{\vphantom{\Bigl|}}$}}%
}
\begin{array}[t]{: @{}c@{} : @{}c@{} : @{}c@{} :}
\rule[-50pt]{0pt}{90pt}
\begin{bNiceMatrix}[first-col,last-row]
\mathsf{a:} & \Phi_{11} & \Phi_{12} \\
\mathsf{b:} & \Phi_{21} & \Phi_{22} \\
            & \matrixname{2}{\mathsf{M}}
\end{bNiceMatrix}
&
\begin{bNiceMatrix}[last-row]
\Phi_{11} & \Phi_{12} \\
\Phi_{21} & \Phi_{22} \\
\matrixname{2}{\mathsf{W}}
\end{bNiceMatrix}
={}&
\begin{bNiceMatrix}[first-col,last-row]
\mathsf{a:} & X_{11}Y_{11}-X_{12}Y_{21} & X_{22}Y_{12}-X_{12}Y_{22} \\
\mathsf{b:} & X_{11}Y_{21}-X_{21}Y_{11} & X_{11}Y_{22}-X_{21}Y_{12} \\
            & \matrixname{2}{\mathsf{T}}
\end{bNiceMatrix}
\end{array}
\end{equation}

\end{document}

在此处输入图片描述

答案3

您可能喜欢更标准的注释方式:

在此处输入图片描述

\documentclass{article}
\usepackage{geometry}
\usepackage{amsmath, blkarray}
\usepackage{bm}

\begin{document}
\begin{equation}
 \underbrace{\begin{blockarray}{r[cc]}
a: &    \Phi_{11} & \Phi_{12} \\ 
b: &    \Phi_{21} & \Phi_{22} 
             \end{blockarray}}_{\bf{M}}
 \underbrace{\begin{blockarray}{[cc]}
        \Phi_{11} & \Phi_{12} \\ \Phi_{21} & \Phi_{22}
            \end{blockarray}}_{\bf{W}}
 =
 \underbrace{\begin{blockarray}{r[cc]}
a: &    X_{22} Y_{11} - X_{12} Y_{21} & X_{22} Y_{12} - X_{12} Y_{22} \\
b: &    X_{11} Y_{21} - X_{21} Y_{11} & X_{11} Y_{22} - X_{21} Y_{12} 
    \end{blockarray}}_{\bf{T}}
\end{equation}
\end{document}

答案4

已经给出了很多很好的建议,但考虑这个可能适合你:

\documentclass{book}
\usepackage{mathtools}

\begin{document}

\begin{gather}
\begin{matrix}
 \begin{bmatrix} \Phi_{11} & \Phi_{12} \\ \Phi_{21} & \Phi_{22}
\end{bmatrix}\\[6pt]
M
\end{matrix}
\begin{matrix}
 \begin{bmatrix} \Phi_{11} & \Phi_{12} \\ \Phi_{21} & \Phi_{22}
\end{bmatrix}\\[6pt]
W
\end{matrix}
 =
\begin{matrix}
  \begin{bmatrix}
   X_{22} Y_{11} - X_{12} Y_{21} &
   X_{22} Y_{12} - X_{12} Y_{22} \\
   X_{11} Y_{21} - X_{21} Y_{11} &
   X_{11} Y_{22} - X_{21} Y_{12}   \end{bmatrix}\\[6pt]
 T
\end{matrix}
\end{gather}

\end{document}

编辑

\documentclass{book}
\usepackage{mathtools}
\usepackage{array,arydshln}

\begin{document}

\begin{gather}
\begin{array}{:c:}
 \begin{bmatrix} \Phi_{11} & \Phi_{12} \\ \Phi_{21} & \Phi_{22}
\end{bmatrix}\\[6pt]
M
\end{array}
\begin{array}{c}
 \begin{bmatrix} \Phi_{11} & \Phi_{12} \\ \Phi_{21} & \Phi_{22}
\end{bmatrix}\\[6pt]
W
\end{array}
 =
\begin{array}{:c:}
  \begin{bmatrix}
   X_{22} Y_{11} - X_{12} Y_{21} &
   X_{22} Y_{12} - X_{12} Y_{22} \\
   X_{11} Y_{21} - X_{21} Y_{11} &
   X_{11} Y_{22} - X_{21} Y_{12}   \end{bmatrix}\\[6pt]
 T
\end{array}
\end{gather}

\end{document}

这符合要求吗?

相关内容