8

I would like to put an underbrace below the matrix like this:

$$\left(\underbrace{
\left[\begin{array}{ccc}
    a&b&c\\
    d&e&f\\
    g&h&i
\end{array}\right]}_{A}
\left[\begin{array}{c}
    x_1\\
    x_2\\
    x_3
\end{array}\right]\right)$$

enter image description here

But I don't want the outer brackets \left( and \right) to stretch vertically. I want them to remain as if there was no underbrace. How to achieve that behaviour?

2
  • It is always recommended to avoid the $$...$$ syntax: please, have a look to Why is [ … ] preferable to $$ … $$? for reference. Commented Jun 2, 2014 at 13:34
  • I almost always use the equation environment anyway, I just put $$...$$ for this example. However I didn't know that, thanks!
    – Rob
    Commented Jun 2, 2014 at 13:39

5 Answers 5

15

You could \smash the underbrace. Of course, you may have to add some \vspace after the equation to compensate for the underbrace that is perceived to be of zero height.

Note that, with this usage, the whole matrix is actually smashed. But because there follows a vector of identical height, the outer parens are properly sized.

\documentclass{article}
\begin{document}
$$\left(\smash{\underbrace{
\left[\begin{array}{ccc}
    a&b&c\\
    d&e&f\\
    g&h&i
\end{array}\right]}_{A}}
\left[\begin{array}{c}
    x_1\\
    x_2\\
    x_3
\end{array}\right]\right)$$
\end{document}

enter image description here

4
  • 2
    It's a long time ago since I accepted this answer, but anyway... I defined this new command \newcommand{\smashedunderbrace}[2]{\smash{\underbrace{#1}_{#2}}\vphantom{#1}} in order to size the outer brackets correctly, even if the vector has a smaller size or is not there at all. Works well! Usage: \smashedunderbrace{what should be underbraced}{underbrace text}
    – Rob
    Commented Mar 30, 2015 at 14:00
  • @Rob That's the hang of it! Thanks for the update. Commented Mar 30, 2015 at 14:09
  • @MaK You are welcome. Note you will need to add some subsequent \vspace, since the underbrace was \smashed. Commented Jun 21, 2016 at 11:11
  • That is a very clever solution! Commented Aug 26, 2021 at 3:03
3

Most of the time \left and \right make delimiters that are too large for my tastes so I almost always use the amsmath versions of \big, \Big, \bigg and \Bigg.

In your example

$$\Bigg(\underbrace{
\left[\begin{array}{ccc}
    a&b&c\\
    d&e&f\\
    g&h&i
\end{array}\right]}_{A}
\left[\begin{array}{c}
    x_1\\
    x_2\\
    x_3
\end{array}\right]\Bigg)$$

looks OK. You'll need \usepackage{amsmath} to get the best effects. See About big parenthesis larger than Bigg if you want to make your own custom sizes. For example, I sometimes use:

\newcommand\Bigger[2][7]{\left#2\rule{0mm}{#1truemm}\right.}

By default this creates a 7mm high delimiter but \Bigger[10]( makes a 10mm bracket etc.

1
  • Thanks! Well you replace the outer left and right bracket with fixed sized ones. Actually I would prefer another solution which keeps variable brackets.
    – Rob
    Commented Jun 2, 2014 at 12:53
1

Take the \left( inside the underbrace. Then you need \right. and \left. to close and open the brace.

Code:

$$\underbrace{\left(
\left[\begin{array}{ccc}
    a&b&c\\
    d&e&f\\
    g&h&i
\end{array}\right]\right.}_{A}
\left.\left[\begin{array}{c}
    x_1\\
    x_2\\
    x_3
\end{array}\right]\right)$$
1
  • 1
    Thanks, but that looks ugly. I don't want the underbrace to include the outer left bracket.
    – Rob
    Commented Jun 2, 2014 at 12:46
1

Sometimes it's simpler just to create a local definition.

Code

\documentclass{article}

\begin{document}

Let
\[
A = \left[\begin{array}{ccc}
    a&b&c\\
    d&e&f\\
    g&h&i
\end{array}\right]
\]
in
\[
A\left[\begin{array}{c}
    x_1\\
    x_2\\
    x_3
\end{array}\right]
\]

\end{document}

Output

enter image description here

1
  • I want the reader to notice A in my equation which is much longer than my example. A has already been defined previously.
    – Rob
    Commented Jun 2, 2014 at 13:29
0

With {NiceArray} of nicematrix.

\documentclass{article}
\usepackage{nicematrix}

\begin{document}

$\begin{NiceArray}{([ccc][c])}
  a & b & c & x_1 \\
  d & e & f & x_2 \\
  g & h & i & x_3 
\CodeAfter
  \UnderBrace[yshift=1mm]{3-1}{3-3}{A}
\end{NiceArray}$

\vspace{1cm}
$\begin{NiceArray}{([ccc][c])}
  a & b & c & x_1 \\
  d & e & f & x_2 \\
  g & h & i & x_3 
\CodeAfter
  \UnderBrace[shorten,yshift=1mm]{3-1}{3-3}{A}
\end{NiceArray}$

\end{document}

Output of the above code

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .