%\filename{matrixhacks.tex}
%\edited{last by stolfi on Wed Sep  2 04:47:00 1987}

% Additional matrix hacks

\catcode`@=11\endlinechar=-1

% Say \topbordermatrix{del #1}{halign stuff #2}{halign stuff #3}{del #4}
%   to get a parenthesized matrix containing the given stuff,
%   but with parenthesis #1 and #4 surrounding only the stuff #3 and
%   centered on the axis of stuff #3.

  \def\topbordermatrix#1#2#3#4{
    \setbox0\vbox{\matrixalign{#3}}
    \dimen4=1\ht0
    \setbox0\vbox{
      \matrixalign{
        #2\crcr\noalign{\hrule height0pt\kern0.1\baselinesep}
        \mathstrut\crcr\noalign{\kern-\baselinesep}
        #3
      }
    }
    \setbox0=\hbox{\box0}
    \dimen6=1\ht0
    \advance\dimen6 by \dp0
    \ht0=\dimen4
    \setbox0\hbox{$#1\vcenter{\box0}#4$}
    \advance\dimen6 by -\dp0
    \ht0=\dimen6 
    \box0
  }

% Big zeros for matrices (diagonal, triagular, etc.)

  \def\llzero{
    { 
      \setbox0\hbox{0}
      \vbox to\ht0{
        \hrule height0pt\vss
        \hbox to \wd0{\kern3pt\raise5pt\hbox{\bigsize 0}\hss}
      }
    }
  }

  \def\urzero{
    { 
      \setbox0\hbox{0}
      \vtop to\ht0{
       \hbox to \wd0{\hss\lower8pt\hbox{\bigsize 0}\kern3pt}
       \vss\hrule height0pt
      }
    }
  }
           
\catcode`@=12\endlinechar=`\^^M

% END

