在数组矩阵的上方/下方和左侧/右侧添加括号

在数组矩阵的上方/下方和左侧/右侧添加括号

我正在尝试在矩阵的各个部分添加括号,如下所示:

在此处输入图片描述

其中箭头条被替换为括号,红色条将移至底部。如果有帮助,以下是我现在的部分:

\left[
    \begin{array}{c c c c|c c c}
    1 & 0 & \cdots & 0 & 0 & \cdots & 0\\
    0 & 1 & \ddots & \vdots & \vdots & \ddots & \vdots \\
    \vdots & \ddots & \ddots & \vdots & \vdots & \ddots & \vdots\\
    0 & \cdots & 0 & 1 & 0 & \cdots & 0\\
    \hline 
    0 & \cdots & \cdots & 0 & 0 & \cdots & 0\\
    \vdots & \ddots & \ddots & \vdots & \vdots & \ddots & \vdots  \\
    0 & \cdots & \cdots & 0 & 0 &\cdots & 0
    \end{array}
\right]
\begin{matrix*}[l]
\left. \vphantom{\begin{pmatrix}
    0 \\
    \vdots \\
    \vdots\\
    0\\
    0\\
    \vdots\\
    0
    \end{pmatrix} } \right\} \text{Rank } C_{p-1} = s_{p-1}\\
\end{matrix*}

我已经使右侧括号正常工作,但我不确定如何使其他括号就位...我尝试在矩阵之前添加它:

\begin{matrix*}[r]
b_{p-1} = \text{Rank } B_{p-1}\left\{\vphantom{\begin{pmatrix}{c}
    1\\
    0\\
    \vdots\\
    0\\
    \hline
    \end{pmatrix}}\right.
    \left.
    \vphantom{\begin{pmatrix}{c}
        0\\
        \vdots\\
        0
        \end{pmatrix}}\right.
\end{matrix*}

但这会将括号放在矩阵的中间,而不是对角线 1 的部分。谢谢!

答案1

这是一个可能的TikZ解决方案

\documentclass[tikz,border=2mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{matrix}
\usepackage{mathtools}
\DeclareMathOperator{\rk}{rank}

\begin{document}

\begin{tikzpicture}
    \matrix (A) [
    matrix of math nodes]{
      1 & 0 & \dots & 0 & 0 & \dots & 0\\
      0 & 1 & \ddots & \vdots & \vdots & \ddots & \vdots \\
      \vdots & \ddots &\ddots & \vdots & \vdots & \ddots & \vdots \\
      0 & \dots & 0 & 1 & 0 & \dots & 0\\
      0 & \dots & \dots & 0 & 0 & \dots & 0\\
       \vdots & \ddots & \ddots & \vdots & \vdots & \ddots & \vdots \\
      0 & \dots & \dots & 0& 0 & \dots & 0\\
    };

    \draw[gray] (A-1-1.north west) rectangle (A-4-4.south east);
    \draw[gray] (A-4-4.south east) rectangle (A-7-7.south east);
    \draw[shorten >=2pt, shorten <=2pt] (A-1-1.north west) --++(180:3mm)|-(A-4-1.south west) node[pos=.25, rotate=90, above]{$b_{p-1}=\rk B_{p-1}$};
    \draw[shorten >=2pt, shorten <=2pt] (A-1-1.north west) --++(90:3mm)-|(A-1-7.north east) node[pos=.25, above]{$s_p=\rk C_p$};
    \draw[shorten >=2pt, shorten <=2pt] (A-7-4.south west) --++(270:3mm)-|(A-7-7.south east) node[pos=.25, below]{$\rk Z_p=z_p$};
    \draw[shorten >=2pt, shorten <=2pt] (A-1-7.north east) --++(0:3mm)|-(A-7-7.south east) node[pos=.25, rotate=270, above]{$\rk C_{p-1}=s_{p-1}$};
\end{tikzpicture}
\end{document} 

在此处输入图片描述

答案2

这是一个解决方案pstricks:它包括在矩阵中的相关位置添加节点,并通过节点连接将它们连接起来:

\documentclass[x11names, svgnames]{article}
\usepackage{mathtools}
\usepackage{pst-node}
\usepackage{auto-pst-pdf}
\DeclareMathOperator{\rk}{rank}
\pagestyle{empty}

\begin{document}

\begin{equation*}
  \begin{postscript}\everypsbox{\footnotesize}
    \begin{bmatrix*}%{c c c c|c c c}
      \pnode[-0.3ex, 2.4ex]{r1}\Rnode{R1}{1}\rule{0pt}{3ex} & 0 & \cdots & \Rnode{S1}{0} & 0 & \cdots & \Rnode{T1}{0}\\
      0 & 1 & \ddots & \vdots & \vdots & \ddots & \vdots \\
        \vdots & \ddots & \ddots & \vdots & \vdots & \ddots & \vdots \\
      \Rnode{R2}{0} & \cdots & 0 & \Rnode{S2}{1}\pnode[1.25ex, -0.8ex]{s2} & 0 & \cdots & 0\\
      0 & \cdots & \cdots & 0 & 0 & \cdots & 0\\
        \vdots & \ddots & \ddots & \vdots & \vdots & \ddots & \vdots \\
      0 & \cdots & \cdots &0 & \Rnode{R3}{0} & \cdots & \Rnode{S3}{0}\pnode[0.2ex, -0.3ex]{s3}
    \end{bmatrix*}
    \psset{ linejoin=1, linearc=0.08, arm=1ex, nodesep=1.5ex}
    \ncbar[angle=90]{R1}{T1}\naput{$ s_p = \rk C_p $}
    \ncbar{T1}{S3}\naput[nrot=:U]{$ \rk C_{p-1} = s_{p-1} $}
    \ncbar[angle=180]{R2}{R1}\naput[nrot=:U]{$ b_{p-1} =\rk B_{p-1} $}
    \ncbar[angle=-90]{R3}{S3}\nbput{$ \rk Z_p = z_p$}
    \psset{linecolor=LightSteelBlue3!50}
    \psframe(r1)(s2)
    \psframe[dimen=inner](s2)(s3)
  \end{postscript}%
\end{equation*}

\end{document} 

在此处输入图片描述

相关内容