I am using a modified version of \bordermatrix
as defined here:
\bordermatrix with brackets [ ] instead of parentheses ( )
My matrices have fractional elements and I would like to add additional space between rows so the fractions don't touch. With usual matrices this can be done by putting [0.3em]
at the end of each line, but that doesn't work with bordermatrix since it uses \cr
instead of \\
for line breaks, and \cr
seems not to take arguments.
\usepackage{etoolbox}
\let\bbordermatrix\bordermatrix
\patchcmd{\bbordermatrix}{8.75}{4.75}{}{}
\patchcmd{\bbordermatrix}{\left(}{\left[}{}{}
\patchcmd{\bbordermatrix}{\right)}{\right]}{}{}
\[\mathbf{P}=\bbordermatrix{& 0 & 1 & 2\cr
0 & 0 & \frac{1}{2} & \frac{1}{2}\cr
1 & \frac{1}{2} & 0 & \frac{1}{2}\cr
2 & \frac{1}{2} & \frac{1}{2} & 0}
\]
Best Answer
You can add a couple of patches: