# Changing column separation in smallmatrix environment

How can I change the width of the space between columns in a smallmatrix environment? I can't find any decent documentation on smallmatrix anywhere.

The array environment has the setcolsep{..} command, but I can't find anything analogous for smallmatrix.

-

The intercolumn space is \thickspace; you can do a trick

\newenvironment{xsmallmatrix}[1]
{\renewcommand\thickspace{\kern#1}\smallmatrix}
{\endsmallmatrix}


Now you can decide for yourself what the separation is (default .2777em):

\begin{xsmallmatrix}{.5em}
a & b\\
c & d
\end{smallmatrix}


If you want a fixed different space, say .5em, define

\newenvironment{xsmallmatrix}
{\renewcommand\thickspace{\kern.5em}\smallmatrix}
{\endsmallmatrix}


Beware that \thickspace is used in other places and it might happen in one of the small matrix entries (not very probable, though). A more robust patch might be

\usepackage{etoolbox}
\patchcmd{\smallmatrix}{\thickspace}{\kern.5em}{}{}


and from now on all smallmatrix environments will use .5em as intercolumn space.

-
Excellent, thanks Greg. –  Jamie Vicary Jun 28 '11 at 17:18

Here's a small document, which shows a redefinition of smallmatrix fur supporting an optional argument for the separation. The definition is taken from amsmath.sty, it's just extended by using this argument instead of \thickspace.

\documentclass{article}
\usepackage{amsmath}
\makeatletter
\renewenvironment{smallmatrix}[1][.2777em]{\null\,\vcenter\bgroup
\Let@\restore@math@cr\default@tag
\baselineskip6\ex@ \lineskip1.5\ex@ \lineskiplimit\lineskip
\ialign\bgroup\hfil$\m@th\scriptstyle##$\hfil&&\kern#1\hfil
$\m@th\scriptstyle##$\hfil\crcr
}{%
\crcr\egroup\egroup\,%
}
\makeatother
\begin{document}
$\begin{smallmatrix} a & b\\ c & d \end{smallmatrix} \quad \begin{smallmatrix}[8pt] a & b\\ c & d \end{smallmatrix}$
\end{document}


It's using internal macros as the original definition does, which might be changed. While egreg shows a workaround and a patch, this should show a straighforward redefinition starting from the original source code.

-
However it's not so easy for somebody not expert in \halign and plain TeX syntax to spot the right place to act on. –  egreg Jun 28 '11 at 17:42
It's not better, just showing another way for quick fixing: locating the original macro, redefining, spotting the place (yes, hard here), changing. Perhaps motivation to read the source, showing that also enormous complicated code can be re-used easily. –  Stefan Kottwitz Jun 28 '11 at 19:02