I would like to right a column vector in plain TeX without using the \matrix
command (it seems too wide otherwise). How can I do it?
2 Answers
I'm assuming that by wide you mean the spacing between the delimiters and inner content.
\matrix
is defined with a \thinmuskip
(that is, by default, 3 mu
) around it with the macro \,
.
Here's its definition in full:
\def\matrix#1{\null\,\vcenter{\normalbaselines\m@th
\ialign{\hfil$##$\hfil&&\quad\hfil$##$\hfil\crcr
\mathstrut\crcr\noalign{\kern-\baselineskip}
#1\crcr\mathstrut\crcr\noalign{\kern-\baselineskip}}}\,}
So you could make your own \tightmatrix
by just copying the above without the \,
's, for example:
\def\tightmatrix#1{\null\vcenter{\normalbaselines\mathsurround=0pt
\ialign{\hfil$##$\hfil&&\quad\hfil$##$\hfil\crcr
\mathstrut\crcr\noalign{\kern-\baselineskip}
#1\crcr\mathstrut\crcr\noalign{\kern-\baselineskip}}}}
\def\bmatrix#1{\left[\tightmatrix{#1}\right]}
$$ A \left[ \matrix{a_1\cr a_2} \right] B $$
$$ A \bmatrix{a_1\cr a_2} B $$ % can have more than two rows
$$ A {a_1\atopwithdelims[] a_2} B $$ % aka \brack only two rows
\bye
One could perhaps consider wrapping the \vcenter
inside a \mathinner
.
Here's a comparison:
I like the overall spacing of the last one best, but for more than two rows, you need to start adding style changes and grouping, and it gets really messy really fast.
Here is my corrected answer with a LaTeX MWE:
\documentclass{article}
\usepackage{plain}
\begin{document}
\begin{plain}
$$\left[\vcenter{\hbox{$\mathstrut a_1$}\hbox{$\mathstrut a_2$}}\right]$$
\end{plain}
\end{document}
$${a_1\brack a_2}$$
?$$\left[\matrix{a\cr b\cr c\cr d}\right]$$\bye
Can you add some more information?