5

Might be a dumb question, but I am firing it:

enter image description here

How can I align a text, A, in this case, right under a bmatrix/pmatrix?

I currently have this code:

        \begin{equation*}
        \begin{pmatrix}
            3 & -1 & 1 \\
            3 & 3  & 7 \\
            3 & 6  & 2
        \end{pmatrix}\begin{pmatrix}
            x_1 \\
            x_2 \\
            x_3
        \end{pmatrix} = \begin{pmatrix}
            1 \\
            4 \\
            0
        \end{pmatrix}
    \end{equation*}

and this equation:

enter image description here

Where matrixes make equation of Ax = b. I want to write corresponding variable, like x, b, A right under the matrixes.

help?

3 Answers3

4

Using \underbrace seems the best approach, but the spacing would be awful. Not to mention the input syntax.

\documentclass{article}
\usepackage{amsmath}

\NewDocumentEnvironment{ubpmatrix}{m+b} {% some space to compensate \mspace{9mu}% % a group to avoid \underbrace being a mathop {\underbrace{% \mspace{-9mu}% \begin{pmatrix}#2\end{pmatrix}% \mspace{-9mu}% }_{\mathstrut#1}} \mspace{9mu}% }{}

\begin{document}

[ \begin{ubpmatrix}{A} 3 & -1 & 1 \ 3 & 3 & 7 \ 3 & 6 & 2 \end{ubpmatrix} \begin{ubpmatrix}{x} x_1 \ x_2 \ x_3 \end{ubpmatrix} = \begin{ubpmatrix}{b} 1 \ 4 \ 0 \end{ubpmatrix} ]

\end{document}

enter image description here

The underbrace is below a shrinked object, the same space is added around the construction to cover our tracks.

egreg
  • 1,121,712
4

Here is what you can do with {pNiceMatrix} of nicematrix and its built-in command \SubMatrix.

\documentclass{article}
\usepackage{nicematrix}
\usepackage{lipsum} % for dummy text

\begin{document}

\lipsum[1] [ A = \begin{pNiceMatrix}[last-row=4] 4 & -1 & 1 \ 4 & -8 & 1 \ -2 & 1 & 5 \ \ \CodeAfter \UnderBrace[yshift=1mm]{3-1}{3-3}{A} \end{pNiceMatrix} \hspace{2cm} B = \begin{pNiceMatrix}[last-row=4] 4 & -1 & 1 \ 4 & -8 & 1 \ -2 & 1 & 5 \ \ \CodeAfter \UnderBrace[yshift=1mm,shorten]{3-1}{3-3}{B} \end{pNiceMatrix} ] \lipsum[2]

\end{document}

The second matrix uses the key shorten of SubMatrix.

Output of the above code

F. Pantigny
  • 40,250
3

The \underbrace macro may be your friend.

enter image description here

\documentclass{article}
\usepackage{amsmath} % for '\underbrace' macro and 'pmatrix' environment
\begin{document}

[ {\underbrace{\begin{pmatrix} 3 & -1 & 1 \ 3 & 3 & 7 \ 3 & 6 & 2 \end{pmatrix}}{A}} , {\underbrace{\begin{pmatrix} x_1 \ x_2 \ x_3 \end{pmatrix}}{x\vphantom{A}}} = {\underbrace{\begin{pmatrix} 1 \ 4 \ 0 \end{pmatrix}}_{b}} ]

\end{document}

Mico
  • 506,678