I'm using kbordermatrix to put some indices on my matrices. An example would be the following:
See the end of the post for the code behind this example.
The problem is that the spacing between the [ bracket of the kbordermatrix and the first "proper" columns seems much too large in comparison with the other matrices, and likewise for the right ].
One way I thought of to fix this is to redefine the left and right delimiters that kbordermatrix uses. It seems to work well; when using
\renewcommand{\kbldelim}{[\hspace{-1ex}}
we get the following result:
That looks much better! However, now we try to do the same thing for the right bracket:
\renewcommand{\kbrdelim}{\hspace{-1ex}]}
But this gives an error:
ERROR: Missing delimiter (. inserted).
--- TeX said ---
<to be read again>
\let
l.14 }
--- HELP ---
From the .log file...
I was expecting to see something like `(' or `\{' or
`\}' here. If you typed, e.g., `{' instead of `\{', you
should probably delete the `{' by typing `1' now, so that
braces don't get unbalanced. Otherwise just proceed.
Acceptable delimiters are characters whose \delcode is
nonnegative, or you can use `\delimiter <delimiter code>'.
The obvious
\renewcommand{\kbrdelim}{\delimiter \hspace{-1ex}]}
also doesn't work.
Any ideas how to solve this?
A minimal working example:
\documentclass{article}
\usepackage{amsmath}
\usepackage{kbordermatrix}
\begin{document}
\begin{equation*}
\kbordermatrix{
& 1 & 2 \\
1 & 0 & 1 \\
2 & 1 & 0
}
\times
\begin{bmatrix}
a & b \\
c & d
\end{bmatrix}
=
\begin{bmatrix}
c & d \\
a & d
\end{bmatrix}
\end{equation*}
\end{document}
To compile it, you do have to use the kbordermatrix.sty file: CTAN.


kbordermatrixis not available on Overleaf. – psyguy Sep 08 '22 at 11:23