%%% ====================================================================
%%%  @LaTeX-style-file{
%%%     author          = "Enrico Bertolazzi",
%%%     version         = "0.4",
%%%     date            = "15-SEPT-96",
%%%     filename        = "easybmat.sty",
%%%     address         = "Laboratorio di Matematica Applicata
%%%                        Trento University,
%%%                        Via Mesiano, Trento, Italy",
%%%     FAX             = "+39 (461) 882672",
%%%     email           = "bertolaz@ing.unitn.it (Internet)",
%%%     supported       = "yes. Please send comments via E-mail",
%%%     docstring       = "package for easy typing equations.
%%%
%%% INSTALLATION:
%%%   Put this file where your TeX looks for inputs.
%%%
%%% DOCUMENTATION:
%%%  Compile docbmat.tex.
%%%
%%% COPYING:
%%%   Copying of part or all of this file is allowed under the following
%%%   conditions only:
%%%   (1) You may freely distribute unchanged copies of the file. Please
%%%       include the documentation when you do so.
%%%   (2) You may modify a renamed copy of the file, but only for personal
%%%       use or use within an organization.
%%%   (3) You may copy fragments from the file, for personal use or for
%%%       distribution, as long as credit is given where credit is due.
%%%
%%%   You are NOT ALLOWED to take money for the distribution or use of
%%%   this file or modified versions or fragments thereof, except for
%%%   a nominal charge for copying etc.
%%%
%%%  }
%%% ====================================================================
%%%       ___    ____  ___   _   _      __    __    ____ ______
%%%      /   \  /     /   \  \  /      /  \  /  \  /       /
%%%     /____/ /__   /____/   \/       \    /   / /__     /
%%%    /   \  /     /  \      /         \  /   / /       /
%%%   /____/ /____ /    \    /       \__/  \__/ /       /
%%% ====================================================================
\typeout{Document Style `easybmat'  version 0.4 <15-SEPT-1996>.}
%% BEGIN easybmat.sty
%%
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{easybmat}[1996/09/15 v0.4]

\DeclareOption{thinlines}{%
   \@bmat@srule=.7pt
   \@bmat@sdash=.5pt
}

\DeclareOption{thiklines}{%
   \@bmat@srule=1.5pt
   \@bmat@sdash=1.2pt
}

\newdimen\@bmat@srule\@bmat@srule=1pt
\newdimen\@bmat@sdash\@bmat@sdash=.7pt

\ProcessOptions

\input{easy.sty}
\newdimen\@bmat@spread
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\def\@bmat@parse@col[#1]{%
   \gdef\@easy@list@rules{@.;:|0123456789}%
   \gdef\@easy@list@align{lrc}%
   \@easy@parse(#1)%
   \@easy@xdef(@bmat@align@col\@roman\@easy@level)\@easy@align%
   \@easy@xdef(@bmat@rules@col\@roman\@easy@level)\@easy@rules%
   \@bmat@make@preamble%
}

\def\@bmat@parse@row[#1]{%
   \gdef\@easy@list@rules{@.;:|0123456789}%
   \gdef\@easy@list@align{tbc}%
   \@easy@parse(#1)%
   \@easy@xdef(@bmat@align@row\@roman\@easy@level)\@easy@align%
   \@easy@xdef(@bmat@rules@row\@roman\@easy@level)\@easy@rules%
}

\def\@bmat@addcol{\g@addto@macro\@bmat@preamble{$\displaystyle{##}$&}}
\def\@bmat@make@preamble{%
   \gdef\@bmat@preamble{%
       \vbox\bgroup\lineskip\z@skip%
                   \tabskip\z@skip%
                   \baselineskip\z@skip%
                   \everycr{}\halign\bgroup}%
   \@easy@rotate\@easy@align%
   \loop%
      \@easy@rotate\@easy@align%
      \edef\@tempa{\@easy@firstchar\@easy@align}%
   \expandafter\ifx\@tempa`\relax\else%
      \@bmat@addcol%
   \repeat%
   \g@addto@macro\@bmat@preamble{$\displaystyle{##}$\crcr}
}

\def\BMAT{\@ifnextchar({\@BMAT}{\@BMAT(@)}}
\def\@BMAT(#1){\@ifnextchar[{\@@BMAT(#1)}{\@@BMAT(#1)[2pt]}}
\def\@@BMAT(#1)[#2]#3#4{%
    \advance\@easy@level\@ne%
	\@bmat@parse@col[#3]%
	\@bmat@parse@row[#4]%
    \@easy@xdef(@bmat@spread\@roman\@easy@level){#2}%
    \@easy@xdef(@bmat@balance\@roman\@easy@level){#1}%
    \def\\{\crcr}%
 	\setbox\@nameuse{@easy@box\@roman\@easy@level}\@bmat@preamble%
}
\def\endBMAT{%
	\crcr\egroup\egroup%
    \@easy@glet(@easy@mainbox){@easy@box\@roman\@easy@level}%
    \@easy@glet(@easy@calign){@bmat@align@col\@roman\@easy@level}%
    \@easy@glet(@easy@crule){@bmat@rules@col\@roman\@easy@level}%
    \@easy@glet(@easy@ralign){@bmat@align@row\@roman\@easy@level}%
    \@easy@glet(@easy@rrule){@bmat@rules@row\@roman\@easy@level}%
    \@easy@glet(@bmat@spread){@bmat@spread\@roman\@easy@level}%
    \@easy@glet(@bmat@balance){@bmat@balance\@roman\@easy@level}%
    %
    \@easy@evaldim\@easy@mainbox\@bmat@spread%
    \@easy@balance\@bmat@balance%
    %
    \gdef\@easy@kern##1{\@easy@kernkind[##1,\@bmat@sdash,\@bmat@srule]}
    \gdef\@easy@vruledraw##1{\@easy@vrulekind[##1,\ht\@easy@mainbox,\@bmat@sdash,\@bmat@srule]}
    \gdef\@easy@hruledraw##1{\@easy@hrulekind[##1,\wd\@easy@mainbox,\@bmat@sdash,\@bmat@srule]}
    \global\let\@easy@spread\@bmat@spread%
    \@easy@buildbox%
    \@easy@vlines1%
    \@easy@hlines3%
	\vcenter{\hbox{\rlap{\box1}\rlap{\box3}\box\@easy@mainbox}}%
    \advance\@easy@level\m@ne%
}

\endinput
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
