Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question

2 Answers 2

up vote 2 down vote accepted

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.

share|improve this answer
    
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.

share|improve this answer
    
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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.