% $Source: /home/bricks/source/greater/cvs/greaterrepository/greater-pre-processing/doc/ManualTabular.sty,v $

% $Author: jan $

% $Revision: 1.1 $
% $Date: 2002-09-18 12:55:31 $
% $Locker:  $

% This file (`ManualTabular.sty') is based in the file `supertabular.sty'.
% It includes some adaptations of `supertabular.sty' to the needs of
% the GREAT-ER manuals.
% You find the original header below.

%% 
%% This is file `supertabular.sty', generated 
%% on <1992/7/10> with the docstrip utility (2.0n).
%% 
%% The original source files were:
%% 
%% supertabular.doc 
%% 
%% Copyright (C) 1988-92 by Theo Jurriens, Johanes Braams (90-92). 
%% All rights reserved. 
%% 
%% IMPORTANT NOTICE: 
%% 
%% You are not allowed to change this file. You may however copy this file 
%% to a file with a different name and then change the copy. 
%% 
%% You are NOT ALLOWED to distribute this file alone. You are NOT ALLOWED 
%% to take money for the distribution or use of this file (or a changed 
%% version) except for a nominal charge for copying etc. 
%% 
%% You are allowed to distribute this file under the condition that it is 
%% distributed together with all files mentioned below. 
%% 
%% If you receive only some of these files from someone, complain! 
%% 
%% Error Reports in case of UNCHANGED versions to either of 
%% 
%% J. Braams 
%% PTT Research, dr Neher Laboratorium 
%% P.O. box 421 
%% 2260 AK Leidschendam 
%% The Netherlands 
%% Internet: <J.L.Braams@research.ptt.nl> 
%% 
%% Theo Jurriens 
%% Rijks Universiteit Groningen 
%% P.O Box 800, 
%% 9700 AV Groningen 
%% The Netherlands 
%% Internet: <TAJ@rug.nl> 
%% 
\newif\if@topcaption \@topcaptiontrue
\def\topcaption{\@topcaptiontrue\tablecaption}
\def\bottomcaption{\@topcaptionfalse\tablecaption}
\long\def\tablecaption{\refstepcounter{TabCnt} \@dblarg{\@xtablecaption}}
\long\def\@xtablecaption[#1]#2{%
  \long\gdef\@process@tablecaption{\@stcaption{TabCnt}[#1]{#2}}}
\global\let\@process@tablecaption\relax
\long\def\@stcaption#1[#2]#3{\par%
	\addcontentsline{lot}{table}%
		{\protect\numberline{\thesection.\arabic{TabCnt}}{#3}}
%    \addcontentsline{\csname ext@#1\endcsname}{#1}%
%        {\protect\numberline{\csname the#1\endcsname}{\ignorespaces #2}}
  \begingroup
    \@parboxrestore
    \normalsize
    \if@topcaption \vskip -10pt \fi % 'fix'
    \@makecaption{Table \thesection.\arabic{TabCnt}}{\it #3}\par
%    \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces #3}\par
    \if@topcaption \vskip 10pt \fi % 'fix'
  \endgroup}
\def\@tablehead{}
\def\tablehead#1{\gdef\@tablehead{#1}}
\def\tablefirsthead#1{\gdef\@table@first@head{#1}}
\def\@tabletail{}
\def\tabletail#1{%
    \gdef\@tabletail{\noalign{\global\let\@savcr=\\\global\let\\=\cr}%
                     #1\noalign{\global\let\\=\@savcr}}}
\def\tablelasttail#1{\gdef\@table@last@tail{#1}}
\newdimen\maxsize            % maximum pagesize
\newdimen\actsize            % actual pagesize
\newdimen\twocolsize         % needed for correct max height if twocolumn
\newdimen\parboxheight       % height plus depth of a parbox-argument
\newdimen\addspace           % stores the value of \\[#1]
\newdimen\midlineheight      % estimated size of a normal line
\newdimen\pargcorrection     % to set page height tolerance if p-arg
\newdimen\computedimens      % computation variable
\newbox\tabparbox
\def\@stabularcr{{\ifnum0=`}\fi\@ifstar{\@sxtabularcr}{\@sxtabularcr}}
\def\@sxtabularcr{\@ifnextchar[{\@sargtabularcr}%
                 {\ifnum0=`{\fi}\cr\nextline}}
\def\@sargtabularcr[#1]{\ifnum0=`{\fi}\ifdim #1>\z@
    \unskip\@sxargarraycr{#1}\else \@syargarraycr{#1}\fi}
\def\@sxargarraycr#1{\@tempdima #1\advance\@tempdima \dp \@arstrutbox
    \vrule \@height\z@ \@depth\@tempdima \@width\z@ \cr
    \noalign{\global\addspace=#1}\nextline}
\def\@syargarraycr#1{\cr\noalign{\vskip #1\global\addspace=#1}\nextline}
\def\@sstartpbox#1{\global\advance\maxsize by -\pargcorrection
                   \global\pargcorrection=0pt
                   \setbox\tabparbox%
                          \vtop\bgroup\hsize#1\@arrayparboxrestore}
\def\@sastartpbox#1{\bgroup\hsize#1%
                    \global\advance\maxsize by -\pargcorrection
                    \global\pargcorrection=0pt
                    \setbox\tabparbox
                          \vtop\bgroup\hsize#1\@arrayparboxrestore}
\def\@sendpbox{\unskip\strut\par\egroup
               \computedimens=\ht\tabparbox
               \advance\computedimens by \dp\tabparbox
               \ifnum\parboxheight<\computedimens
                  \global\parboxheight=\computedimens
               \fi
               \computedimens=\z@
               \box\tabparbox\hfil}
\def\@saendpbox{\unskip\strut\par\egroup
                \computedimens=\ht\tabparbox
                \advance\computedimens by \dp\tabparbox
                \ifnum\parboxheight<\computedimens
                   \global\parboxheight=\computedimens
                \fi
                \computedimens=\z@
                \unvbox\tabparbox\egroup}
\def\calmidlineheight{\midlineheight=\arraystretch \baslineskp
                      \global\advance\midlineheight by 1\p@
                      \global\pargcorrection=4\midlineheight}
\def\calpage{\global\actsize=\pagetotal  % where am I on the actual page?
             \twocolsize=\textheight            %  added 06.06.89
             \advance\twocolsize by -\@colroom  %        "
             \advance\actsize by \twocolsize    %        "
             \global\advance\actsize by \midlineheight
             \maxsize=\textheight        % start a new page when 90% of
             \multiply \maxsize by 9     % the page are used
             \divide\maxsize by 10
             \advance\actsize 2\midlineheight
             \ifnum\actsize > \maxsize
                   \clearpage
                   \global\actsize=\pagetotal
             \fi
             \maxsize=\textheight       % now set \maxsize with tolerance
             \setbox\@tempboxa=\vbox{\@arrayparboxrestore%
                    \expandafter\tabular\expandafter{\tableformat}
                    \@tabletail\endtabular}
             \global\advance\maxsize by-\ht\@tempboxa}
                             % Here is the definition of supertabular
\def\supertabular#1 {\def\tableformat{#1}         % store preamble
    \global\starfalse % remember this is the normal version
    \if@topcaption\@process@tablecaption
    \fi
    \global\let\@oldcr=\\
    \def\baslineskp{\baselineskip}%
    \calmidlineheight% estimate height of a normal line
    \calpage         % calculate max. pagesize and startpoint
    \ifx\undefined\@classix      % then array.sty is not loaded
      \let\@@tabularcr\@tabularcr%             Added JB 4/2/91
      \let\@tabularcr\@stabularcr
      \let\@@startpbox=\@sstartpbox
      \let\@@endpbox=\@sendpbox
    \else
      \let\@@tabularcr\@arraycr
      \let\@arraycr\@stabularcr
      \let\org@startpbox=\@startpbox
      \let\org@endpbox=\@endpbox
      \let\@startpbox=\@sastartpbox
      \let\@endpbox=\@saendpbox
    \fi
    \ifx\@table@first@head\undefined
        \let\@@tablehead=\@tablehead
    \else
        \let\@@tablehead=\@table@first@head
    \fi%                                     Added JB 4/2/91
    \expandafter\tabular\expandafter{\tableformat}
    \@@tablehead}%   Added JB 15/2/91
\def\endsupertabular{%
    \ifx\@table@last@tail\undefined
        \@tabletail
    \else
        \@table@last@tail
    \fi%                                     Added JB 4/2/91
    \endtabular
    \ifx\undefined\@classix      % then array.sty is not loaded
      \let\@tabularcr\@@tabularcr             % Added JB 4/2/91
    \else
      \let\@arraycr\@@tabularcr
      \let\@startpbox=\org@startpbox
      \let\@endpbox=\org@endpbox
    \fi
    \if@topcaption
    \else
        \@process@tablecaption
        \@topcaptiontrue
    \fi
    \global\let\\=\@oldcr
    \let\@table@first@head\undefined        % For the next ocurrence
    \let\@table@last@tail\undefined         % of this environment
    \global\let\@process@tablecaption\relax
}
\newif\ifstar
\newdimen\tabularwidth
\@namedef{supertabular*}#1#2 {\def\tableformat{#2}          % store preamble
    \tabularwidth=#1 % The total width of the tabular
    \global\startrue % remember this is the *-version
    \if@topcaption\@process@tablecaption\fi
    \def\baslineskp{\baselineskip}%
    \calmidlineheight% estimate height of a normal line
    \calpage         % calculate max. pagesize and startpoint
    \ifx\undefined\@classix      % then array.sty is not loaded
      \let\@@tabularcr\@tabularcr%             Added JB 4/2/91
      \let\@tabularcr\@stabularcr
      \let\@@startpbox=\@sstartpbox
      \let\@@endpbox=\@sendpbox
    \else
      \let\@@tabularcr\@arraycr
      \let\@arraycr\@stabularcr
      \let\org@startpbox=\@startpbox
      \let\org@endpbox=\@endpbox
      \let\@startpbox=\@sastartpbox
      \let\@endpbox=\@saendpbox
    \fi
    \ifx\@table@first@head\undefined
        \let\@@tablehead\@tablehead
    \else
        \let\@@tablehead\@table@first@head
    \fi%                                     Added JB 4/2/91
    \expandafter\csname tabular*\expandafter\endcsname
    \expandafter{\expandafter\tabularwidth\expandafter}%
    \expandafter{\tableformat}%
    \@@tablehead}%
\@namedef{endsupertabular*}{%
    \ifx\@table@last@tail\undefined
        \@tabletail
    \else
        \@table@last@tail
    \fi%                                     Added JB 4/2/91
    \csname endtabular*\endcsname
    \ifx\undefined\@classix      % then array.sty is not loaded
      \let\@tabularcr\@@tabularcr             % Added JB 4/2/91
    \else
      \let\@arraycr\@@tabularcr
      \let\@startpbox=\org@startpbox
      \let\@endpbox=\org@endpbox
    \fi
                                 % Check if we have to insert a caption
    \if@topcaption
    \else
        \@process@tablecaption
                                 % restore to default behaviour
        \@topcaptiontrue
    \fi
    \global\let\\=\@oldcr
    \let\@table@first@head\undefined        % For the next ocurrence
    \let\@table@last@tail\undefined         % of this environment
    \global\let\@process@tablecaption\relax}
\def\nextline{%           %%% algorithm to calculate the pagebreaks %%%
    \noalign{\ifnum\parboxheight<\midlineheight
                   \advance\actsize by \midlineheight
                   \global\advance\actsize by \addspace
             \else
                   \global\advance\actsize by \parboxheight
                   \divide\parboxheight by 11\relax
                   \global\advance\actsize by \parboxheight%
                   \global\parboxheight=0pt
             \fi
             \global\addspace=0pt}%
    \ifnum\actsize<\maxsize
    \noalign{\global\let\next\@empty}%
    \else
         \@tabletail
         \ifstar%                     % Added 16-10-90
           \csname endtabular*\endcsname
         \else
           \endtabular
         \fi
         \if@twocolumn%                        % added 10.05.89
            \if@firstcolumn%                   %
               \newpage%                       %
            \else%                             %
               \clearpage%                     %
            \fi%                               %
            \twocolsize=\textheight%           % added 06.06.89
            \advance\twocolsize by -\@colroom% %       "
            \global\actsize=\twocolsize%       %       "
            \global\advance\actsize by \midlineheight
         \else                                 %
            \clearpage                         %
            \global\actsize=\midlineheight
         \fi                                   %
         \let\next\@tablehead%                 % Added 15.2.91
         \ifstar%                              % Added 16-10-90
           \expandafter\csname tabular*\expandafter\endcsname
           \expandafter{\expandafter\tabularwidth\expandafter}%
           \expandafter{\tableformat}%
         \else
           \expandafter\tabular\expandafter{\tableformat}%
         \fi
    \fi\next}%                                % Added \next 15.2.91
\endinput
%% 
%% End of file `supertabular.sty'.
