如何对矩阵进行侧支撑和过度支撑?

如何对矩阵进行侧支撑和过度支撑?

我正在尝试制作一个带有侧括号和上括号的矩阵,如下所示:

在此处输入图片描述

有什么想法吗?谢谢 :)

答案1

我在我的代码中使用了这个包kbordermatrix.....我认为[1.5em](两行之间的距离)是足够的......但您可以选择更改它、增加它或减少它。

\documentclass[a4paper,12pt]{article}
\usepackage{mathtools,amssymb}
\usepackage{kbordermatrix}

\renewcommand{\kbldelim}{(}
\renewcommand{\kbrdelim}{)}

\begin{document}
\[
\kbordermatrix{ & \overbrace{}^{p} & \overbrace{}^{q} \cr
      r\begin{cases} & \\
      \end{cases} \mkern-35mu & \mathrm{even} & \mathrm{odd}  \\[1.5em]
      s\begin{cases} & \\
      \end{cases} \mkern-35mu & \mathrm{odd} & \mathrm{even}  }
\]
\end{document}

在此处输入图片描述

答案2

使用\matrix\phantom

$$
  \def\p{\vphantom{\Bigm\{}\rm}
  \def\q{\overbrace{\hphantom{\rm even}}}
  \matrix{r \Bigl\{\cr\cr s \Bigl\{} 
  \mathop{\pmatrix{\p even & \p odd \cr\cr \p odd & \p even}}^
  {\matrix{\q^p & \q^q}}
$$

答案3

以下回声wipet 的方法s使用每个列\vphantom从左到右构建显示(第一个 = &括号,第二个 = 左分隔符,第三个 = &加 - 过度括号,第四个 = &加 - 过度括号,第五个 = 右分隔符)。arrayrsevenoddpoddevenq

在此处输入图片描述

\documentclass{article}

\usepackage{amsmath,lipsum}

\begin{document}

\lipsum*[1]
\[
  \newcommand{\vphB}{\vphantom{\Big\{}}
  \newcommand{\addlinegap}[1][\jot]{\\\\[\dimexpr-\normalbaselineskip+#1]}
  \begin{array}{ r @{}}
    r \Bigl\{ \addlinegap s \Bigl\{
  \end{array}
  \left( \begin{array}{@{}c@{}}
    \vphB \addlinegap \vphB
  \end{array} \right.\kern-\nulldelimiterspace
  \overbrace{\begin{array}{@{}c@{}}
    \vphB \text{even} \addlinegap \vphB \text{odd}
  \end{array}}^p
  \hspace{\arraycolsep}
  \overbrace{\begin{array}{@{}c@{}}
    \vphB \text{odd} \addlinegap \vphB \text{even}
  \end{array}}^q
  \kern-\nulldelimiterspace\left.\begin{array}{@{}c@{}}
    \vphB \addlinegap \vphB
  \end{array} \right)
\]
\lipsum*[2]
\end{document}

答案4

还有一个解决方案nicematrix:-)

\documentclass{article}
\usepackage{nicematrix}
\usepackage{tikz}   % needed after version 5.0
\usetikzlibrary{decorations.pathreplacing,
                calligraphy,
                fit}
\tikzset{
B/.style = {decorate,
            decoration={calligraphic brace, amplitude=2pt,
            pre =moveto, pre  length=1pt,
            post=moveto, post length=1pt,
            raise=#1},
            thick,
            pen colour=black},
B/.default=4pt,
arr/.style = {draw=blue}
        }

\begin{document}
    \[
\begin{pNiceArray}{*{2}{>{\rule[-1ex]{0pt}{3ex}}c} }
\mathrm{even}   &   \mathrm{odd}    \\[1ex]
\mathrm{odd}    &   \mathrm{even}   \\
\CodeAfter  \begin{tikzpicture}
\draw[B] (1-1.west |- 1-2.north) -- node[above=5pt] {$p$} (1-1.east |- 1-2.north);
\draw[B] (2-2.west |- 1-2.north) -- node[above=5pt] {$q$} (2-2.east |- 1-2.north);

\draw[B=7pt] (1-1.west |- 1-1.south) -- node[left =8pt] {$r$} (1-1.west |- 1-2.north);
\draw[B=7pt] (1-1.west |- 2-1.south) -- node[left =8pt] {$s$} (1-1.west |- 2-1.north);
            \end{tikzpicture}
\end{pNiceArray}
    \]
\end{document}

在此处输入图片描述

相关内容