0

I am trying to make a matrix with side braces and over braces like this:

enter image description here

Any ideas? Thanks :)

4 Answers 4

4

I use into my code the package kbordermatrix .....I think that [1.5em] (the distance between two rows) is abundant...but you can choose to changed it, increase it or decrease it.

\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}

enter image description here

4

Use \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}}
$$
4

The following echo's wipet's approach of \vphantoms to construct the display from left-to-right using an array for each of the columns (first = r & s braces, second = left delimiter, third = even & odd plus p-overbrace, fourth = odd & even plus q-overbrace, fifth = right delimiter).

enter image description here

\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}
3

And one solution with 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}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .