6

How to extend the braces

Any hint would be appreciated.

enter image description here

\documentclass{article}
\usepackage{amsmath}% http://ctan.org/pkg/amsmath

\newcommand\undermat[2]{% http://tex.stackexchange.com/a/102468/5764
  \makebox[0pt][l]{$\smash{\underbrace{\phantom{%
    \begin{matrix}#2\end{matrix}}}_{\text{$#1$}}}$}#2}

\begin{document}

\[      
  \left(
\begin{array}{rrr|rrr}
1& 0  & 0& -11& 6& -4\\ 
0&1  &0 & 6& -3& 2\\
\undermat{I}{0 &  0 & 1} &  \undermat{A^{-1}}{-4 & 2 &-1 }\\
\end{array}
\right )
\]

\end{document}
felipeuni
  • 293
  • 1
    Could you be a bit more specific? You mention brackets and braces, and they are different things. – Werner Jun 14 '17 at 19:21
  • You have braces to the left and below, do you want to extend one of those? Or the brackets around the matrix? – Huang_d Jun 14 '17 at 19:22

3 Answers3

4

You can artificially make the last row as wide as needed, by adding a phantom digit in columns one and two.

I'd also reduce the space between the fences and the entries and add a phantom to I in order to vertically align the subscripts.

\documentclass{article}
\usepackage{amsmath}% http://ctan.org/pkg/amsmath

\newcommand\undermat[2]{% http://tex.stackexchange.com/a/102468/5764
  \makebox[0pt][l]{$\smash{\underbrace{\phantom{%
    \begin{matrix}#2\end{matrix}}}_{\text{$#1$}}}$}#2}

\begin{document}

\[
  \left(
\begin{array}{@{\,}rrr|rrr@{\,}}
1& 0  & 0& -11& 6& -4\\
0&1  &0 & 6& -3& 2\\
\undermat{I\vphantom{A^{-1}}}{0 & 0 & 1} &  \undermat{A^{-1}}{\hphantom{0}{-4} & {\hphantom{-}}{2} & -1 }\\
\end{array}
\right )
\]

\end{document}

enter image description here

egreg
  • 1,121,712
3

Added two \phantoms to the final \undermat, to make that row the same width as the prior rows of the matrix. Also, I had to group {-4}, so that the minus was not made binary by the \phantom.

\documentclass{article}
\usepackage{amsmath}% http://ctan.org/pkg/amsmath

\newcommand\undermat[2]{% http://tex.stackexchange.com/a/102468/5764
  \makebox[0pt][l]{$\smash{\underbrace{\phantom{%
    \begin{matrix}#2\end{matrix}}}_{\text{$#1$}}}$}#2}

\begin{document}

\[
  \begin{array}{r@{}}
    \text{Nodes}~\left\{\begin{array}{@{}c@{}}\null\\\null\\\null\end{array}\right.
  \end{array}
  \left(
\begin{array}{rrr|rrr}
1& 0  & 0& -11& 6& -4\\ 
0&1  &0 & 6& -3& 2\\
\undermat{I}{0 &  0 & 1} &  \undermat{A^{-1}}{\phantom{1}{-4} & \phantom{-}2 &-1 }\\
\end{array}
\right )
\]

\end{document}

enter image description here

2

Here is what you can do with {NiceArray} of nicematrix (≥ 6.4 of 2021-11-23).

\documentclass{article}
\usepackage{nicematrix}

\begin{document}

$\begin{pNiceArray}{ccc|ccc} 1 & 0 & 0 & -11 & 6 & -4 \ 0 & 1 & 0 & 6 & -3 & 2 \ 0 & 0 & 1 & -4 & 2 & -1 \ \CodeAfter \UnderBrace{1-1}{3-3}{I}[shorten,yshift=1mm] \UnderBrace{1-4}{3-6}{A^{-1}}[shorten,yshift=1mm] \end{pNiceArray}$

\end{document}

You need several compilations (because nicematrix uses PGF/Tikz nodes under the hood).

Output of the above code

F. Pantigny
  • 40,250