6

I am trying to move the overbraces on $E_1$ and $E_2$ to the left a little bit. Can you help me out? enter image description here

\documentclass{amsart}
\usepackage{mathtools}
\usepackage{multirow}
\usepackage{amsthm}
\newcommand\coolover[2]{\mathrlap{\smash{\overbrace{\phantom{%
                    \begin{matrix} #2 \end{matrix}}}^{\mbox{$#1$}}}}#2}

\newcommand\coolunder[2]{\mathrlap{\smash{\underbrace{\phantom{%
                    \begin{matrix} #2 \end{matrix}}}_{\mbox{$#1$}}}}#2}

\newcommand\coolleftbrace[2]{%
    #1\left\{\vphantom{\begin{matrix} #2 \end{matrix}}\right.}

\newcommand\coolrightbrace[2]{%
    \left.\vphantom{\begin{matrix} #1 \end{matrix}}\right\}#2}


\begin{document}
\[ 
E=
\begin{matrix}
\coolleftbrace{R_1}{\multirow{2}{*}{$E_1$}}\\
\coolleftbrace{r}{}\\
\coolleftbrace{R_2}{0}
\end{matrix}%
\left[\begin{array}{c|c}
\coolover{C_1}{\multirow{2}{*}{$E_1$}}   &  \coolover{C_2}{0}  \\ \cline{2-2}
&  \multirow{2}{*}{$E_2$}  \\ \cline{1-1} 
0  &        \\
\end{array}\right]
\]
\end{document}
  • 1
    Welcome to TeX.SE. Your sample code doesn't compile, as it doesn't load the multirow and mathtools packages. – Mico Jan 21 at 20:41
  • Thank you! I just have edited! – kswim Jan 21 at 20:46
10

With nicematrix (needed two compilations):

enter image description here

\documentclass{amsart}
\usepackage{nicematrix}
\usetikzlibrary{decorations.pathreplacing,
                calligraphy,
                quotes}
\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=7pt
        }

\begin{document}
    \[  
\begin{bNiceArray}{>{\strut}C|C}%
[create-extra-nodes, margin, extra-margin=1pt ,
code-after = {\begin{tikzpicture}[name suffix = -large]
        \draw[B={3pt}] (1-1.north west) -- node[above=5pt] {$C_1$} (1-1.north east);
        \draw[B={3pt}] (1-2.north west) -- node[above=5pt] {$C_2$} (1-2.north east);
        \draw[B] (1-1.south west) -- node[left=8pt] {$R_1$} (1-1.north west);
        \draw[B] (2-1.south west) -- node[left=8pt] {$E=\quad r$} (2-1.north west);
        \draw[B] (3-1.south west) -- node[left=8pt] {$R_3$} (3-1.north west);
              \end{tikzpicture}
              }
]  
\Block{2-1}{E_1}    & 0                 \\  
    \cline {2-2}
                    & \Block{2-1}{E_2}  \\
   \cline {1-1}
0                   &                   \\
\end{bNiceArray}
    \]
\end{document}    

Addendum: You may more liked, that descriptions of the rows would be on the right side:

enter image description here

\documentclass{amsart}
\usepackage{nicematrix}
\usetikzlibrary{decorations.pathreplacing,
                calligraphy,
                quotes}
\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=7pt
        }

\begin{document}
    \[  E = 
\begin{bNiceArray}{>{\strut}C|C}%
[create-extra-nodes, margin, extra-margin=1pt ,
code-after = {\begin{tikzpicture}[name suffix = -large]
        \draw[B={3pt}] (1-1.north west) -- node[above=5pt] {$C_1$} (1-1.north east);
        \draw[B={3pt}] (1-2.north west) -- node[above=5pt] {$C_2$} (1-2.north east);
        \draw[B] (1-2.north east) -- node[right=8pt] {$R_1$} (1-2.south east);
        \draw[B] (2-2.north east) -- node[right=8pt] {$r$}   (2-2.south east);
        \draw[B] (3-2.north east) -- node[right=8pt] {$R_3$} (3-2.south east);
              \end{tikzpicture}
              }
]
\Block{2-1}{E_1}    & 0                 \\
    \cline {2-2}
                    & \Block{2-1}{E_2}  \\
   \cline {1-1}
0                   &                   \\
\end{bNiceArray}
    \]
\end{document}
|improve this answer|||||
  • Much appreciated! – kswim Jan 22 at 18:47
  • I am trying use the package 'nicematrix' , but it doesn't work since I have to manually install 'nicematrix.sty', apparently. I have got the package from the website, and try to install it on my mac by googling how to manually install it. But, I am being stuck for a long time. Can you help me out if you have any idea what to do? I tried with the 'tex live utility' – kswim Jan 22 at 20:40
  • @kswim, I haven't mac and so I haven't any experiences with its LaTeX. I'm very sorry, but in this I can't help you. I use MikTeX on Windows machine. I has utility "console" by which you can simple install (with its package manager) missed packages. – Zarko Jan 22 at 21:19
  • Thank you for reply though! – kswim Jan 22 at 22:27
5

You can make the construction using 4 columns:

  1. Left row indices (R1, r and R2) and left brace [;
  2. First column in matrix and centre divider;
  3. Second column in matrix and centre divider (overlapping that of first column); and
  4. Right brace ].

enter image description here

\documentclass{article}

\usepackage{array}

\begin{document}

\[
  E = \left.\begin{array}{@{} r<{\bigl\{} @{}}
    R_1  \\ r \\ R_2
  \end{array}\right[
  \overbrace{
    \begin{array}{c |}
      \strut \\ \strut\raisebox{.5\normalbaselineskip}[0pt][0pt]{$E_1$} \\
      \hline
      \strut 0
    \end{array}
  }^{C_1}
  \!% Join two math elements
  \hspace{-.4pt}% Overlap left column rule with previous column's right column rule
  \overbrace{
    \begin{array}{| c}
      \strut 0 \\
      \hline
      \strut \\ \strut\raisebox{.5\normalbaselineskip}[0pt][0pt]{$E_2$}
    \end{array}
  }^{C_2}
  \!
  \left.\kern-\nulldelimiterspace\begin{array}{ @{}c@{} }
    \strut \\ \strut \\ \strut
  \end{array}\right]
\]

\end{document}
|improve this answer|||||
  • I appreciated that! – kswim Jan 22 at 18:47
  • Do I have to load something more? It is not working.. – kswim Jan 22 at 20:40
  • \nulldelimeterspace -> \nulldelimiterspace. Sorry, changed that. – Werner Jan 22 at 23:44
  • It works. Thanks a lot! – kswim Jan 23 at 2:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for?Browse other questions tagged or ask your own question.