[Tex/LaTex] underbrace matrix inside brackets

arraysbracesbracketsequations

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?

Best Answer

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