# How to get a single big right brace?

I am trying to make the right brace cover the whole matrix like the \overbrace'. Is there a way to do this?

\documentclass[reqno,12pt]{amsart}
\usepackage{amsmath,mathtools,amssymb}
\usepackage[top=2cm,left=2cm,right=2cm]{geometry}
\author{something}
\title{something}

\begin{document}
\maketitle
\section{something}
$$\mathbf{G}=\overbrace{\begin{bmatrix} 0&0&0&0&0\\ 0&0&0&0&0\\ 0.271&0&0&0&0\\ 0.498&0.271&0&0&0\\ 0.687&0.498&0.271&0&0\\ 0.845&0.687&0.498&0.271&0\\ 0.977&0.845&0.687&0.498&0.271\\ 1.087&0.977&0.845&0.687&0.498\\ 1.179&1.087&0.977&0.845&0.687\\ 1.256&1.179&1.087&0.977&0.845 \end{bmatrix}}^{\text{something 1}} \Biggr\rbrace \text{something 2}$$
\end{document}


Something that works like \right\rbrace. Unfortunately you can't use \right alone. There is a workaround here tex.stackexchange.com/q/130798/156344. I would appreciate it if someone could tell me how to translate the TeX to LateX used there.

• \left. \right\}? – user156344 Apr 22 at 15:30
• I just need the right brace. Not the left one – Al_Fh Apr 22 at 15:33
• Yes. \left. doesn't produce anything. However, honestly this way is very bad. Consider something like tex.stackexchange.com/q/130798/156344 – user156344 Apr 22 at 15:34
• It is not so ugly if you use \left \right a bit more carefully. The problem is the horizontal brace. – user156344 Apr 22 at 15:38
• The TeX commands are very different. Actually TeX is far harder. Those command are just advanced LaTeX commands – user156344 Apr 23 at 4:04

Writing in your style:

\documentclass[reqno,12pt]{amsart}
\usepackage{amsmath,mathtools,amssymb}
\usepackage[top=2cm,left=2cm,right=2cm]{geometry}
\author{something}
\title{something}
\begin{document}
\maketitle
\section{something}
$$\newcommand\yourmatrix{\begin{bmatrix} 0&0&0&0&0\\ 0&0&0&0&0\\ 0.271&0&0&0&0\\ 0.498&0.271&0&0&0\\ 0.687&0.498&0.271&0&0\\ 0.845&0.687&0.498&0.271&0\\ 0.977&0.845&0.687&0.498&0.271\\ 1.087&0.977&0.845&0.687&0.498\\ 1.179&1.087&0.977&0.845&0.687\\ 1.256&1.179&1.087&0.977&0.845 \end{bmatrix}} \mathbf{G}=\overbrace{\yourmatrix}^{\text{something 1}}\left.\vphantom{\yourmatrix}\right\}{\scriptstyle\text{something 2}}$$
\end{document}


In this way, the vertical brace is good, but it is a little painful to have it. The horizontal brace is not good because it groups the whole matrix (with brackets). Consider some methods used in braces over matrix and similar questions.

This is a good modification of it, but this is a bit overkill. Literally you can't avoid defining a macro if you follow this way.

\documentclass[varwidth]{standalone}
\usepackage{amsmath,mathtools,amssymb}
\begin{document}
$$\newcommand\yourmatrix{\begin{matrix} 0&0&0&0&0\\ 0&0&0&0&0\\ 0.271&0&0&0&0\\ 0.498&0.271&0&0&0\\ 0.687&0.498&0.271&0&0\\ 0.845&0.687&0.498&0.271&0\\ 0.977&0.845&0.687&0.498&0.271\\ 1.087&0.977&0.845&0.687&0.498\\ 1.179&1.087&0.977&0.845&0.687\\ 1.256&1.179&1.087&0.977&0.845 \end{matrix}} \mathbf{G}=\left[\vphantom{\yourmatrix}\right.\overbrace{\yourmatrix}^{\text{something 1}}\left.\vphantom{\yourmatrix}\right]\left.\vphantom{\yourmatrix}\right\}{\scriptstyle\text{something 2}}$$
\end{document}


Using savebox (hope I get it right – please correct me if not)

\documentclass[varwidth]{standalone}
\usepackage{amsmath,mathtools,amssymb}
\newsavebox{\yourmatrix}
\begin{document}
$$\sbox{\yourmatrix}{\begin{matrix} 0&0&0&0&0\\ 0&0&0&0&0\\ 0.271&0&0&0&0\\ 0.498&0.271&0&0&0\\ 0.687&0.498&0.271&0&0\\ 0.845&0.687&0.498&0.271&0\\ 0.977&0.845&0.687&0.498&0.271\\ 1.087&0.977&0.845&0.687&0.498\\ 1.179&1.087&0.977&0.845&0.687\\ 1.256&1.179&1.087&0.977&0.845 \end{matrix}} \mathbf{G}=\left[\vphantom{\usebox{\yourmatrix}}\right.\overbrace{\usebox{\yourmatrix}}^{\text{something 1}}\left.\vphantom{\usebox{\yourmatrix}}\right]\left.\vphantom{\usebox{\yourmatrix}}\right\}{\scriptstyle\text{something 2}}$$
\end{document}


(same output as above)

• You could make \yourmatrix a savebox instead of a macro. – John Kormylo Apr 22 at 15:46
• @JohnKormylo Actually I read the linked question even before my attempts to answer this one. Both answers there use macros, so I am inspired :)) – user156344 Apr 22 at 15:48
• I'd set the definition of \yourmatrix insde the equation environment itself, so it's local to the environment and not far from its usage. Having it in the preamble makes changes more awkward. This is even more necessary if you use the \sbox strategy, because math fonts might get chosen at begin document. – egreg Apr 22 at 15:54
• @egreg Yes, you are right. Localization is needed in this case, or we will need to define a hundred of different \yourmatrixs - maybe running out of name. – user156344 Apr 22 at 15:57

Saveboxes are basically pre-formatted text, and are therefore faster than expanding a macro. More to the point, one can extract the width, height and depth directly.

\documentclass[varwidth]{standalone}
\usepackage{amsmath,mathtools,amssymb}
\newsavebox{\yourmatrix}
\savebox{\yourmatrix}{$\begin{matrix} 0&0&0&0&0\\ 0&0&0&0&0\\ 0.271&0&0&0&0\\ 0.498&0.271&0&0&0\\ 0.687&0.498&0.271&0&0\\ 0.845&0.687&0.498&0.271&0\\ 0.977&0.845&0.687&0.498&0.271\\ 1.087&0.977&0.845&0.687&0.498\\ 1.179&1.087&0.977&0.845&0.687\\ 1.256&1.179&1.087&0.977&0.845 \end{matrix}$}
\newcommand{\vphantombox}[1]{\vrule width0pt height\ht#1 depth\dp#1}
\begin{document}
$$\mathbf{G}=\left[\vphantombox\yourmatrix\right.\overbrace{\usebox\yourmatrix}^{\text{something 1}}\left.\vphantombox\yourmatrix\right]\left.\vphantombox\yourmatrix\right\}{\scriptstyle\text{something 2}}$$
\end{document}

• Is it necessary to declare the \newsavebox in the preamble? – Al_Fh Apr 22 at 16:14
• \newsavebox should be in the preamble, but \savebox` usually isn't. – John Kormylo Apr 22 at 16:19