% \iffalse meta-comment
%
% Copyright (C) 2012 by Sigitas Tolu\v{s}is <sigitas@vtex.lt>
% ---------------------------------------------------------------------------
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
% of this license or (at your option) any later version.
% The latest version of this license is in
%   http://www.latex-project.org/lppl.txt
% and version 1.3 or later is part of all distributions of LaTeX
% version 2005/12/01 or later.
%
% This work has the LPPL maintenance status `maintained'.
%
% The Current Maintainer of this work is Sigitas Tolu\v{s}is.
%
% This work consists of the files stabular.dtx and stabular.ins
% and the derived filebase stabular.sty.
%
% \fi
%
% \iffalse
%<*driver>
\ProvidesFile{stabular.dtx}
%</driver>
%<*package>
%% Copyright (C) 1998-2012 by Sigitas Tolu\v{s}is <sigitas@vtex.lt>
%% VTeX Ltd., Akademijos 4, Vilnius, Lithuania
%% http://www.vtex.lt/tex/download/macros/
%% --------------------------------------------------------------------------
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3
%% of this license or (at your option) any later version.
%% The latest version of this license is in
%%   http://www.latex-project.org/lppl.txt
%% and version 1.3 or later is part of all distributions of LaTeX
%% version 2005/12/01 or later.
%%
%% PURPOSE:   Improve tabular environment.
%%
%</package>
%<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
%<package>\ProvidesPackage{stabular}
%<*package>
    [2012/05/29 v1.1 Improve tabular environment]
%</package>
%
%<*driver>
\documentclass{ltxdoc}
\usepackage{stabular}[2012/05/29]
\EnableCrossrefs
\CodelineIndex
%%\RecordChanges
\begin{document}
  \DocInput{stabular.dtx}
  %%\PrintChanges
  %%\PrintIndex
\end{document}
%</driver>
% \fi
%
% \CheckSum{322}
%
% \CharacterTable
%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%   Digits        \0\1\2\3\4\5\6\7\8\9
%   Exclamation   \!     Double quote  \"     Hash (number) \#
%   Dollar        \$     Percent       \%     Ampersand     \&
%   Acute accent  \'     Left paren    \(     Right paren   \)
%   Asterisk      \*     Plus          \+     Comma         \,
%   Minus         \-     Point         \.     Solidus       \/
%   Colon         \:     Semicolon     \;     Less than     \<
%   Equals        \=     Greater than  \>     Question mark \?
%   Commercial at \@     Left bracket  \[     Backslash     \\
%   Right bracket \]     Circumflex    \^     Underscore    \_
%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%   Right brace   \}     Tilde         \~}
%
%
% \changes{<+version+>}{<+date+>}{Converted to DTX file}
%
% \DoNotIndex{\newcommand,\newenvironment}
%
% \providecommand*{\url}{\texttt}
% \GetFileInfo{stabular.dtx}
% \title{The \textsf{stabular} package}
% \author{Sigitas Tolu\v{s}is \\ \url{sigitas@vtex.lt}}
% \date{\fileversion~from \filedate}
%
% \maketitle
%
% \section{Introduction}
%
% \textbf{Purpose}: improve tabular environment by providing 
% new commands for adds between tabular rows and allowing page break.
%
% \section{Usage}
%
% Provides new commands in tabular (used after command |\\|).
%
% \DescribeMacro{\emptyrow[\meta{row height}]}
%
% \medskip
% Adds empty row with specified \meta{row height}. 
%
% \medskip
% \DescribeMacro{\tabrow\marg{tokens}[\meta{adds}]}
%
% Adds row of natural height: \meta{tokens}|\\|[\meta{adds}].
%
% \medskip
% \DescribeMacro{stabular}
% \DescribeMacro{stabular*}
% Provides new environments: |stabular| and |stabular*|. 
% It is one more multi-page version of tabular.
%
% \StopEventually{}
%
% \section{Implementation}
%
% Changed internal commands: |\@mkpream|, |\@addamp|, |\@xhline|.
%
% \iffalse
%<*package>
% \fi
%
%
%    \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{stabular}[1998/03/19]
%    \end{macrocode}
%
% \begin{macro}{\empty@finalstrut}
%
%    \begin{macrocode}
\def\empty@finalstrut#1{%
  \unskip
  \ifhmode\nobreak\fi
  \vrule\@width\z@\@height\z@\@depth\z@
  }
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\no@strut}
%    \begin{macrocode}
\def\no@strut{%
  \global\setbox\@arstrutbox\hbox{%
    \vrule \@height\z@
           \@depth\z@
           \@width\z@
    }%
  \gdef\@endpbox{\empty@finalstrut\@arstrutbox\par\egroup\hfil}%
  }%
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\yes@strut}
%    \begin{macrocode}
\def\yes@strut{\global\setbox\@arstrutbox\hbox{%
    \vrule \@height\arraystretch \ht\strutbox
           \@depth\arraystretch \dp\strutbox
           \@width\z@}%
    \gdef\@endpbox{\@finalstrut\@arstrutbox\par\egroup\hfil}%
}%
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\@mkpream}
%    \begin{macrocode}
\def\@mkpream#1{\@firstamptrue\@lastchclass6
  \let\@preamble\@empty\def\empty@preamble{\add@ins}%
  \let\protect\@unexpandable@protect
  \let\@sharp\relax
  \let\add@ins\relax
  \let\@startpbox\relax
  \let\@endpbox\relax
  \@expast{#1}%
  \expandafter\@tfor \expandafter
    \@nextchar \expandafter:\expandafter=\reserved@a\do
       {\@testpach\@nextchar
    \ifcase \@chclass \@classz \or \@classi \or \@classii \or \@classiii
      \or \@classiv \or\@classv \fi\@lastchclass\@chclass}%
  \ifcase \@lastchclass \@acol
      \or \or \@preamerr \@ne\or \@preamerr \tw@\or \or \@acol \fi
  }
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\@addamp}
%    \begin{macrocode}
\def\@addamp{%
  \if@firstamp
    \@firstampfalse
    \edef\empty@preamble{\add@ins}%
  \else
    \edef\@preamble{\@preamble &}%
    \edef\empty@preamble{\expandafter\noexpand\empty@preamble &\add@ins}%
  \fi
  }
\newif\iftw@hlines \tw@hlinesfalse
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\@xhline}
%    \begin{macrocode}
\def\@xhline{%
  \ifx\reserved@a\hline
    \tw@hlinestrue
  \else
    \ifx\reserved@a\Hline
      \tw@hlinestrue
    \else
      \tw@hlinesfalse
    \fi
  \fi
  \iftw@hlines
    \aftergroup\do@after
  \fi
  \ifnum0=`{\fi}%
  }
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\do@after}
%    \begin{macrocode}
\def\do@after{\emptyrow[\the\doublerulesep]}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\emptyrow}
%    \begin{macrocode}
\def\emptyrow{\noalign\bgroup
  \@ifnextchar[\@emptyrow{\@emptyrow[\z@]}%
  }
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\@emptyrow}
%    \begin{macrocode}
\def\@emptyrow[#1]{%
    \no@strut
    \gdef\add@ins{\vrule \@height\z@ \@depth#1 \@width\z@}%
  \egroup
  \empty@preamble\\
  \noalign{%
    \yes@strut
    \gdef\add@ins{\vrule \@height\z@ \@depth\z@ \@width\z@}%
    }%
  }
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\tabrow}
%    \begin{macrocode}
\def\tabrow#1{\noalign\bgroup
  \@ifnextchar[{\@tabrow{#1}}{\@tabrow{#1}[]}%
  }
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\@tabrow}
%    \begin{macrocode}
\def\@tabrow#1[#2]{\no@strut\egroup
  #1\ifx.#2.\\\else\\[#2]\fi
  \noalign{\yes@strut}%
  }
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\endstabular}
%
%    \begin{macrocode}
\def\endstabular{\crcr\egroup\egroup\egroup}
%    \end{macrocode}
% \end{macro}
%
%    \begin{macrocode}
\expandafter\let\csname endstabular*\endcsname\endstabular
%    \end{macrocode}
%
% \begin{macro}{\stabular}
%    \begin{macrocode}
\def\stabular{\let\@halignto\@empty\@stabular}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\stabular}
%    \begin{macrocode}
\@namedef{stabular*}#1{\def\@halignto{to#1}\@stabular}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\@stabular}
%    \begin{macrocode}
\def\@stabular{\leavevmode 
  \bgroup 
    \let\@acol\@tabacol
    \let\@classz\@tabclassz
    \let\@classiv\@tabclassiv
    \let\\\@tabularcr
    \@stabarray
  }
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\@stabarray}
%    \begin{macrocode}
\def\@stabarray{\m@th\@ifnextchar[\@sarray{\@sarray[c]}}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\@sarray}
%    \begin{macrocode}
\def\@sarray[#1]#2{%
  \bgroup
    \setbox\@arstrutbox\hbox{%
      \vrule \@height\arraystretch\ht\strutbox
             \@depth\arraystretch \dp\strutbox
             \@width\z@
             }%
  \@mkpream{#2}%
  \edef\@preamble{%
    \ialign \noexpand\@halignto
      \bgroup \@arstrut \@preamble \tabskip\z@skip \cr
    }%
  \let\@startpbox\@@startpbox \let\@endpbox\@@endpbox
  \let\tabularnewline\\
  \let\par\@empty
  \let\@sharp##%
  \set@typeset@protect
  \lineskip\z@skip \baselineskip\z@skip
  \@preamble
  }
%    \end{macrocode}
% \end{macro}
%
%    \begin{macrocode} 
%\endinput 
%    \end{macrocode} 
%
% \iffalse
%</package>
% \fi
%
% \Finale
