I have to label row and column index around matrix. I know blkarray
would help, so I write like this:
\documentclass[a4paper,12pt]{article}
\usepackage{amsmath}
\usepackage{blkarray}% http://ctan.org/pkg/blkarray
\newcommand{\matindex}[1]{\mbox{#1}}% Matrix index
\begin{document}
pmatrix way:
\[
J(i,j,\theta)=\begin{pmatrix}
1 & \cdots & 0 & \cdots & 0 & \cdots & 0 \\
\vdots & \ddots & \vdots & & \vdots & & \vdots \\
0 & \cdots & c & \cdots & -s & \cdots & 0 \\
\vdots & & \vdots & \ddots & \vdots & & \vdots \\
0 & \cdots & s & \cdots & c & \cdots & 0 \\
\vdots & & \vdots & & \vdots & \ddots & \vdots \\
0 & \cdots & 0 & \cdots & 0 & \cdots & 1
\end{pmatrix}
\]
blkarray way:
\[
J(i,j,\theta)=\begin{blockarray}{cccccccc}
\begin{block}{(ccccccc)c}
1 & \cdots & 0 & \cdots & 0 & \cdots & 0 \\
\vdots & \ddots & \vdots & & \vdots & & \vdots \\
0 & \cdots & c & \cdots & -s & \cdots & 0 & \matindex{$i$} \\
\vdots & & \vdots & \ddots & \vdots & & \vdots \\
0 & \cdots & s & \cdots & c & \cdots & 0 & \matindex{$j$} \\
\vdots & & \vdots & & \vdots & \ddots & \vdots \\
0 & \cdots & 0 & \cdots & 0 & \cdots & 1 \\
\end{block}
& & \matindex{$i$} & & \matindex{$j$} & \\
\end{blockarray}
\]
Why $J(i,j,\theta)$ isn't vertical aligned int blkarray way?
\end{document}
Here is the result:
I want to know why isn't vertical aligned in blkarray way.
And how to vertical aligned it like pmatrix way.
Thanks.
Best Answer
The problem is that the block array is vertically centered with respect to its entire size, including the indices below.
The easiest way, in this case, is to put the whole thing in the
blkarray
.