
\def\boxmatrix#1{\setbox0=
 \vbox{\kern3pt\hbox{\kern3pt$\displaystyle
   \matrix{#1}$\kern3pt}\kern3pt}
 \dimen0=\wd0
 \divide \dimen0 by 4
 \lower\dimen0\vbox{\hrule\hbox to \wd0{\vrule\hss
      \vbox{\copy0}\hss\vrule}\hrule}}

\def\boxit#1{\setbox0=
 \vbox{\kern3pt\hbox{\kern3pt
 #1\kern3pt}\kern3pt}
  \dimen0=\ht0
 \divide \dimen0 by 2
 \hbox{\lower\dimen0\vbox{\hrule\hbox to \wd0{\vrule\hss
      \vbox{\copy0}\hss\vrule}\hrule}}}

% Example:
% $$\pmatrix{
%  \boxmatrix{0&1\cr -1&0 \cr} & 0 \cr
%   & \boxmatrix{
%  \cos \theta & \sin \theta \cr
%  -\sin \theta & \cos \theta \cr
%  -\sin \theta & \cos \theta \cr} \cr
%  }$$
