I would like to create a transition probability matrix, like the
ones found in a textbook I'm using, An Introduction to Stochastic Modeling
by Mark A. Pinsky and Samuel Karlin.
The double bars are closer together than just using ||
. Also, the spacing between the index column and the bars, and the spacing between the bars and the matrix entries are narrow. At the very least, I would like to achieve these two results.
In addition, I would like to be able to create a matrix exactly like in Ex1:
- The top indices are right-aligned with the matrix entries.
- The double vertical bars are slightly thicker than the regular bar (although that might just be the font).
- The double vertical bars are just long enough to reach the top entries and the bottom entries and are not longer.
If I can achieve these results too, that would be greatly appreciated!
Here is what I have so far. I used the blkarray
package.
There is too much spacing (black) and the bars are too far apart (red).
Thanks for the help!
\mathbf{P} =
\begin{blockarray}{cccc}
& 0 & 1 & 2 \\
\begin{block}{r||rrr||}
0 & 0.7 & 0.2 & 0.1 \\
1 & 0.3 & 0.5 & 0.2 \\
2 & 0 & 0 & 0 \\
\end{block}
\end{blockarray}
Best Answer
You can use
@{}
specifications. Or see alternate approach that limits vertical line size.ALTERNATE APPROACH:
This uses my
tabstackengine
andscalerel
packages to achieve the OP's goal of limiting the vertical line height. I had to patch\Centerstack
to omit the automatic\strut
insertion.