16

I want to display the structure of a matrix as shown in the image below:

enter image description here

Can this be done using pmatrix and \underbrace?

My attempt at combining pmatrix and \underbrace results in a compile error.

\documentclass{standalone}

\usepackage{amsmath}

\begin{document}
$
\begin{pmatrix}
%1 & \underbrace{1 & \cdots & 1}_{k} \\ % compile error!
1 & 1 & \cdots & 1 \\
1 & 1 & 1 & 1
\end{pmatrix}
$
\end{document}
17

A combination of \smash[b] should work:

\documentclass{standalone}
\usepackage{amsmath}

\newcommand{\block}[1]{
  \underbrace{\begin{matrix}1 & \cdots & 1\end{matrix}}_{#1}
}

\begin{document}
$
\underbrace{
  \begin{pmatrix}
  1 & \smash[b]{\block{k}} \\
  && 1 & \smash[b]{\block{k}} \\
  &&&& \ddots \\
  &&&&& 1 & \block{k}
  \end{pmatrix}
}_{T}
$
\end{document}

enter image description here

If you don't want to space the dots in the underbraced blocks, then change the definition:

\documentclass{standalone}
\usepackage{amsmath}

\newcommand{\block}[1]{
  \underbrace{1 \cdots 1}_{#1}
}

\begin{document}
$
\underbrace{
  \begin{pmatrix}
  1 & \smash[b]{\block{k}} \\
  && 1 & \smash[b]{\block{k}} \\
  &&&& \ddots \\
  &&&&& 1 & \block{k}
  \end{pmatrix}
}_{T}
$
\end{document}

enter image description here

For getting the underbrace only inside the delimiters, it's more complicated, because we don't want that the underbrace is considered when sizing the delimiters, yet we want to consider the vertical space taken by it.

\documentclass{standalone}
\usepackage{amsmath}

\newcommand{\block}[1]{
  \underbrace{1 \cdots 1}_{#1}
}

\newcommand{\underbracedmatrix}[2]{%
  \left(\;
  \smash[b]{\underbrace{
    \begin{matrix}#1\end{matrix}
  }_{#2}}
  \;\right)
  \vphantom{\underbrace{\begin{matrix}#1\end{matrix}}_{#2}}
}

\begin{document}
$
\underbracedmatrix{
  1 & \smash[b]{\block{k}} \\
  && 1 & \smash[b]{\block{k}} \\
  &&&& \ddots \\
  &&&&& 1 & \block{k}
}{T}
$
\end{document}

enter image description here

  • 1
    If I interprete the OP correct, the brace should not include the surrounding Parentheses. – Svend Tveskæg Nov 19 '13 at 20:26
  • @SvendTveskæg I added the version you asked for. – egreg Nov 19 '13 at 22:16
  • Nice. I think the OP---not me---asked for it. :) – Svend Tveskæg Nov 20 '13 at 4:41
  • @egreg You've put a lot in to this answer. Nice work. – physicsmichael Jan 16 '14 at 19:03
3

Yet another attempt:

\documentclass{article}

\begin{document}

\def\onegroup{1\hskip\arraycolsep\underbrace{1 \hskip\arraycolsep\dots \hskip\arraycolsep 1}_{k}}

\[
\underbrace{
\left(
\begin{array}{cccc}
\onegroup&&&\\
&\onegroup&&\\
&&\ddots&\\
&&&\onegroup
\end{array}
\right)
}_{T}
\]

\end{document} 

enter image description here

  • The output of the code does not match the image which you have pasted, in particular it is missing the large underbrace with the T at the bottom. – I Like to Code Nov 19 '13 at 15:01
  • @ILiketoCode Oh! It was an earlier version of code. Corrected. – Przemysław Scherwentke Nov 19 '13 at 20:17
2

Just another flavor even though @egreg solutions seems to be robust enough:

\documentclass{standalone}

\usepackage{amsmath,mathtools}
\newcommand{\sunderb}[2]{
  \mathclap{\underbrace{\makebox[#1]{$\cdots$}}_{#2}}
}
\begin{document}
$
\begin{pmatrix}
1 & 1 & 1 & 1\\
1 & 1 & \sunderb{3.5em}{k} & 1 \\ 
1 & 1 & 1 & 1
\end{pmatrix}
$
\end{document}

enter image description here

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.