8

I am using a matrix in Plain TeX, and the spacing between columns is too large. Since I'm also changing the paper size, the matrix runs off the side of the page. A minimal example is

\input eplain

$$
  A =
    \left\{
      \matrix{
        (1&1&(1&0&0)^6&||&1&1&1&1&1&1&1&1&1&1&1&1&1&1&1^{30})\cr
        (1&1&(1&0&0)^6&||&1&1&1&1&1&1&1&1&1&1&1&1&1&1&1^{30})\cr
        (1&1&(1&0&0)^6&||&1&1&1&1&1&1&1&1&1&1&1&1&1&1&1^{30})\cr
        (1&1&(1&0&0)^6&||&1&1&1&1&1&1&1&1&1&1&1&1&1&1&1^{30})\cr
      }
    \right\}
$$

\bye

I can shrink the columns by inserting an \hskip before each &, but that makes the source difficult to read. Is there a nicer way to control this spacing?

2 Answers 2

8

This is Plain, not eplain. The definition of \matrix uses \quad between columns. You can define a new macro that takes another argument for the spacing:

\input eplain
\catcode`@=11
\def\xmatrix#1#2{\null\,\vcenter{\normalbaselines\m@th
    \ialign{\hfil$##$\hfil&&\hskip#1\hfil$##$\hfil\crcr
      \mathstrut\crcr\noalign{\kern-\baselineskip}
      #2\crcr\mathstrut\crcr\noalign{\kern-\baselineskip}}}\,}
\catcode`@=12

$$
  A =
    \left\{
      \xmatrix{3pt}{
        (1&1&(1&0&0)^6&||&1&1&1&1&1&1&1&1&1&1&1&1&1&1&1^{30})\cr
        (1&1&(1&0&0)^6&||&1&1&1&1&1&1&1&1&1&1&1&1&1&1&1^{30})\cr
        (1&1&(1&0&0)^6&||&1&1&1&1&1&1&1&1&1&1&1&1&1&1&1^{30})\cr
        (1&1&(1&0&0)^6&||&1&1&1&1&1&1&1&1&1&1&1&1&1&1&1^{30})\cr
      }
    \right\}
$$

\bye

enter image description here

7

You can redefine \quad inside the group; this way, it is restored when the group is complete (originally, I had it redefined before the group and reset it manually after the group; thanks to morbusg for the reminder, saving me two lines of code).

\input eplain
$$
 \def\quad{\hskip1ex\relax}
  A =
    \left\{
      \matrix{
        (1&1&(1&0&0)^6&||&1&1&1&1&1&1&1&1&1&1&1&1&1&1&1^{30})\cr
        (1&1&(1&0&0)^6&||&1&1&1&1&1&1&1&1&1&1&1&1&1&1&1^{30})\cr
        (1&1&(1&0&0)^6&||&1&1&1&1&1&1&1&1&1&1&1&1&1&1&1^{30})\cr
        (1&1&(1&0&0)^6&||&1&1&1&1&1&1&1&1&1&1&1&1&1&1&1^{30})\cr
      }
    \right\}
$$
\bye

enter image description here

1
  • 1
    You could redefine the \quad inside the display, because it forms a group, the redefinition goes away automatically after the group (ie. $$\let\quad\enspace ...$$)
    – morbusg
    Commented Feb 12, 2014 at 9:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .