6

I tried to add some text beside a matrix to illustrate it, then I found a solution using package blkarray. Following is the code, and it succeeds to add some text right to the matrix.

\[\begin{blockarray}{ccc}
\begin{block}{(cc)r}
A & B & \text{text one}\\
C & D & \text{text two}\\
\end{block}
\end{blockarray}\]

\[M=\begin{blockarray}{ccc}
\begin{block}{(cc)r}
A & B & \text{text one}\\ 
C & D & \text{text two}\\
\end{block}
\end{blockarray}\]

Then the result after typeset:enter image description here

Pls see the second guy, why the Matrix move "upwards" a little bit? The equal sign doesn't show up in the middle of the matrix and it looks weird. So my question:

1). Is there any way to adjust the code and make the matrix be symmetry about the equal sign?

2). Do you know any other package/better way to add text beside a matrix?

Thanks!

5

No need for blkarray for such a simple case, an easier option is to concatenate two arrays side-by-side. The left array can be a pmatrix to automatically get the round parens.

\documentclass[12pt]{article}
\usepackage{amsmath}
\begin{document}

\[
\begin{pmatrix}
A & B \\ 
C & D  
\end{pmatrix}
%
\begin{array}{c}
\text{text one}\\ 
\text{text two}
\end{array}
\]

\[
M=\begin{pmatrix}
A & B \\ 
C & D  
\end{pmatrix}
%
\begin{array}{c}
\text{text one}\\ 
\text{text two}
\end{array}
\]

\end{document}

enter image description here

| improve this answer | |
3

Here I use a not-often-used feature of the tabstackengine package that allows the mode of stacks to be different than that of TABstacks. So I make the defaults stacks in "text" mode and TABstacks in "math" mode. Then I can avoid the need to apply \text{} to the text.

\documentclass[12pt]{article}
\usepackage{amsmath,tabstackengine}
\setstacktabbedgap{1.5ex}
\setstackgap{L}{1.2\baselineskip}
\stackText
\TABstackMath
\begin{document}
\[
\parenMatrixstack{
A & B \\ 
C & D  
}
\Centerstack{
text one\\
text two
}
\]
\[
M=
\parenMatrixstack{
A & B \\ 
C & D  
}
\Centerstack{
text one\\
text two
}
\]
\end{document}

enter image description here

| improve this answer | |
3

You can use the Left{text}{delimiter} feature of blkarray, if there's nothing else on the line. Or you can use a plain pmatrix followed by a tabular. Note both solutions are centred differently:

\documentclass{article}

\usepackage{amsmath}
\usepackage{blkarray}

\begin{document}

\[\begin{blockarray}{\Left{$ M ={} $}{(}cc)l}
A & B & \text{text one}\\
C & D & \text{text two}
\end{blockarray}\]

\[M=\begin{pmatrix}
A & B \\
C & D
\end{pmatrix}
\begin{tabular}{@{\,}l}
text one\\
text two
 \end{tabular}
\]

\end{document} 

enter image description here

| improve this answer | |
2

I would stick with the array environment, possibly enirched by multirow and bigdelim. It's a bit of a pain to mess around with spaces, but I posted an example to prove how to do it.

The details are in multirow documentation

\documentclass{article}
\usepackage{amsmath,mathtools,multirow,bigdelim}

\begin{document}
\[
\begin{array}{ccc@{\,}lc}
\ldelim( {2}{0pt}&
A&B&\rdelim){2}{0.5em}&\text{text one}\\
&C&D& &\text{text two}\\
\end{array}
\]
\[
M=\begin{array}{@{}ccc@{\,}lc}
\ldelim( {2}{0pt}&
A&B&\rdelim){2}{0.5em}&\text{text one}\\
&C&D& &\text{text two}\\
\end{array}
\]
\end{document}

enter image description here

| improve this answer | |

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.