[Tex/LaTex] Write elements above and right outside the matrix
bordermatrixmatrices
I found writing matrix's code is a boring work. There is one, you can see in pic below.
Can anybody help?
Best Answer
This is definitely possible when using the blkarray package. Here's a mock-up with some index styling (in \scriptsize):
\documentclass{article}
\usepackage{blkarray}% http://ctan.org/pkg/blkarray
\newcommand{\matindex}[1]{\mbox{\scriptsize#1}}% Matrix index
\begin{document}
\[
A=\begin{blockarray}{ccc}
\matindex{1} & \matindex{2} & \\
\begin{block}{(cc)c}
a & b & \matindex{3} \\
c & d & \matindex{4} \\
e & f & \\
\end{block}
\end{blockarray}
\]
\end{document}
This would also be doable using a plain array, but would require additional vertical alignment/compensation, perhaps removing some of the code readability that exists via blkarray.
To improve the spacing between the matrix and the surrounding braces, insert an extra column on either side. Additionally, specify the exact column gap using the @{...} specifier. In the above example, two "dummy" centered columns were added with an \hspace{5pt} gap.
Best Answer
This is definitely possible when using the
blkarray
package. Here's a mock-up with some index styling (in\scriptsize
):This would also be doable using a plain
array
, but would require additional vertical alignment/compensation, perhaps removing some of the code readability that exists viablkarray
.