10

I want to make an overbrace and a side brace on my matrix in order to indicate its size. How can I achieve that.

  \begin{pmatrix}
  1 & 1 & 0 & .& . & . & 0 & 1  \\
  0 & 0 & 1 & .& . & . & 1 & 0 \\
 .\\
 .\\
 .\\
  0 & 1 & 1 & . & . & . & 1 & 1
 \end{pmatrix}
1

4 Answers 4

14

Here's one way... [EDITED, added \mkern to address barbara's concern; REEDITED to make use of \overbrace superscript]

\documentclass{article}
\usepackage{amsmath}
\usepackage{stackengine}
\begin{document}
\def\tmp{%
  \begin{pmatrix}
  1 & 1 & 0 & .& . & . & 0 & 1  \\
  0 & 0 & 1 & .& . & . & 1 & 0 \\
 .\\
 .\\
 .\\
  0 & 1 & 1 & . & . & . & 1 & 1
 \end{pmatrix}
}%
\[
\stackMath\def\stackalignment{r}%
  \stackon%
    {\mathrm{10~rows}\left\{\tmp\right.}%
    {\overbrace{\phantom{\smash{\tmp\mkern -36mu}}}^{\mathrm{\textstyle 12~columns}}\mkern 20mu}%
\]
\end{document}

enter image description here

0
5

The following requires some \nulldelimiterspace corrections, but only uses amsmath:

enter image description here

\documentclass{article}

\usepackage{amsmath}

\begin{document}

\def\matriximg{%
  \begin{matrix}
    1 & 1 & 0 & \cdot & \cdot & \cdot & 0 & 1 \\
    0 & 0 & 1 & \cdot & \cdot & \cdot & 1 & 0 \\
    \cdot                                     \\
    \cdot                                     \\
    \cdot                                     \\
    0 & 1 & 1 & \cdot & \cdot & \cdot & 1 & 1
   \end{matrix}
}%
\[
  \text{\scriptsize 10~rows}\left\{\left(\vphantom{\matriximg}\right.\right.\kern-2\nulldelimiterspace
  \overbrace{\matriximg}^{\text{12 columns}}\kern-\nulldelimiterspace\left.\vphantom{\matriximg}\right)
\]

\end{document}

For raising the \overbrace slightly, you could use

\vphantom{\raisebox{.25\baselineskip}{$\matriximg$}}\matriximg
2
  • I need only the overbrace and not the side brace. kindly explain which is the one for overbrace and which one is for side brace.
    – user27665
    Apr 22, 2020 at 11:38
  • @user27665: Use this code.
    – Werner
    Apr 22, 2020 at 16:05
1

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

\documentclass{article}
\usepackage{nicematrix}

\begin{document}

$10$ rows $\left\{
\begin{pNiceMatrix}
   1 & 1 & 0 & \cdot & \cdot & \cdot & 0 & 1 \\
   0 & 0 & 1 & \cdot & \cdot & \cdot & 1 & 0 \\
   \cdot                                     \\
   \cdot                                     \\
   \cdot                                     \\
   0 & 1 & 1 & \cdot & \cdot & \cdot & 1 & 1
\CodeAfter
   \OverBrace[yshift=1.5mm,shorten]{1-1}{1-last}{12 \text{ columns}}
\end{pNiceMatrix}
\right.$

\end{document}

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

Output of the above code

0

I would use a finer and cleaner option by employing the known \overbrace which allows you to achieve your results very easily.

Here is a small example

$$
\overbrace{\begin{bmatrix}
    \epsilon[1]\\
    \epsilon[2]\\
    \vdots \\
    \epsilon[M]
    \end{bmatrix}}^{a}
$$

1
  • 2
    Note the question asks for a "side brace" as well. Can you update your answer to address this as well?
    – Werner
    Mar 16 at 19:47

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.