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.

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?

share|improve this question
add comment

2 Answers

up vote 8 down vote accepted

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

share|improve this answer
add comment

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

share|improve this answer
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 Feb 12 at 9:54
add comment

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.