%%% ====================================================================
%%%  @LaTeX-style-file{
%%%     author          = "Enrico Bertolazzi",
%%%     version         = "1.0",
%%%     date            = "13-JUN-2001",
%%%     filename        = "easytable.sty",
%%%     address         = "Laboratorio di Matematica Applicata
%%%                        e Meccanica Strutturale,
%%%                        Trento University,
%%%                        Via Mesiano, Trento, Italy",
%%%     FAX             = "+39 (461) 882599",
%%%     email           = "enrico.bertolazzi@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 doctable.tex.
%%%
%%%   Copyright  1999 Enrico Bertolazzi
%%%
%%%   This program can be redistributed and/or modified under the terms
%%%   of the LaTeX Project Public License Distributed from CTAN
%%%   archives in directory macros/latex/base/lppl.txt; either
%%%   version 1 of the License, or any later version.
%%%
%%% }
%%% ====================================================================%%%
%%%       ___    ____  ___   _   _         ___    ____  ___   _   _     %%%
%%%      /   \  /     /   \  \  /         /   \  /     /   \  \  /      %%%
%%%     /____/ /__   /____/   \/         /____/ /__   /____/   \/       %%%
%%%    /   \  /     /  \      /         /   \  /     /  \      /        %%%
%%%   /____/ /____ /    \    /         /____/ /____ /    \    /         %%%
%%% ====================================================================%%%
%%% v 1.0 13-JUN-2001 changed \@roman with \romannumeral (thanks to Claudio Beccari) 
\def\filedate{2001/06/13}
\def\fileversion{v1.0}
\typeout{Document Style `easytable' \fileversion\space<\filedate>.}
%%
\NeedsTeXFormat{LaTeX2e}
\RequirePackage{easy}
\ProvidesPackage{easytable}[\filedate \fileversion]

\DeclareOption{thinlines}{%
   \@tab@size@rule=.7pt
   \@tab@size@dash=.5pt
}

\DeclareOption{thicklines}{%
   \@tab@size@rule=1.5pt
   \@tab@size@dash=1.2pt
}

\DeclareOption{thiklines}{%
   \@tab@size@rule=1.5pt
   \@tab@size@dash=1.2pt
}

\newdimen\@tab@size@rule\@tab@size@rule=1pt
\newdimen\@tab@size@dash\@tab@size@dash=.7pt

\ProcessOptions

\@easy@disable@space

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\def\@tab@addcol{\g@addto@macro\@tab@preamble{\@killglue##\@killglue&}}
\def\@tab@make@preamble{%
   \@easy@let(@easy@align){@easy@col@align\romannumeral\@easy@level}%
   \@easy@let(@easy@rules){@easy@col@rules\romannumeral\@easy@level}%
   \gdef\@tab@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%
      \@tab@addcol%
   \repeat%
   \g@addto@macro\@tab@preamble{\@killglue##\@killglue\crcr}
}

\def\TAB{\advance\@easy@level\@ne\@ifnextchar({\@TAB}{\@TAB(@)}}
\def\@TAB(#1){
    \def\@TAB@split##1,##2,##3,##4\end{
       \@easy@xdef(@tab@balance\romannumeral\@easy@level){##1}%
       \global\@nameuse{@easy@minx\romannumeral\@easy@level}=##2
       \global\@nameuse{@easy@miny\romannumeral\@easy@level}=##3
    }
    \expandafter\@TAB@split#1,\z@,\z@, \end
    \@@TAB}
    
\def\@@TAB{\@ifnextchar[{\@@@TAB}{\@@@TAB[2pt]}}

\def\@@@TAB[#1]#2#3{
    \def\@TAB@split##1,##2,##3,##4\end{
       \@easy@xdef(@tab@spread\romannumeral\@easy@level){##1}%
       \global\@nameuse{@easy@maxx\romannumeral\@easy@level}=##2
       \global\@nameuse{@easy@maxy\romannumeral\@easy@level}=##3
    }
    \expandafter\@TAB@split#1,\z@,\z@, \end
	\@easy@parse@cols{#2}
	\@easy@parse@rows{#3}%
	\@tab@make@preamble%
    \global\let\@easy@path\@empty%
    \def\\{\crcr}%
 	\setbox\@nameuse{@easy@box\romannumeral\@easy@level}
    \@tab@preamble
}

\def\endTAB{%
	\crcr\egroup\egroup%
    \@easy@glet(@easy@mainbox)   {@easy@box\romannumeral\@easy@level}%
    \@easy@glet(@easy@col@align) {@easy@col@align\romannumeral\@easy@level}%
    \@easy@glet(@easy@col@rules) {@easy@col@rules\romannumeral\@easy@level}%
    \@easy@glet(@easy@row@align) {@easy@row@align\romannumeral\@easy@level}%
    \@easy@glet(@easy@row@rules) {@easy@row@rules\romannumeral\@easy@level}%
    \@easy@glet(@easy@minx)      {@easy@minx\romannumeral\@easy@level}%
    \@easy@glet(@easy@miny)      {@easy@miny\romannumeral\@easy@level}%
    \@easy@glet(@easy@maxx)      {@easy@maxx\romannumeral\@easy@level}%
    \@easy@glet(@easy@maxy)      {@easy@maxy\romannumeral\@easy@level}%
    %
    \@easy@glet(@easy@spread)    {@tab@spread\romannumeral\@easy@level}%
    \@easy@glet(@easy@balance)   {@tab@balance\romannumeral\@easy@level}%
    %
    \global\let\@easy@size@dash\@tab@size@dash
    \global\let\@easy@size@rule\@tab@size@rule
    %
    \@easy@evaldim%
    \typeout{Easytable [row:\the\@easy@nrow,col:\the\@easy@ncol]}
    \@easy@balance@row@col%
    \@easy@buildbox%
    \@easy@vlines%
    \@easy@hlines%
	\mbox{\rlap{\box\@ne}
	      \rlap{\box\tw@}
	      \ifx\@easy@path\@empty\else\@easy@dopath\rlap{\box\thr@@}\fi
	      \box\@easy@mainbox}%
    \advance\@easy@level\m@ne
}

\@easy@enable@space

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