\ProvidesClass{tables}

\PassOptionsToClass
  {8pt, a4paper, article, nonumbering, nooffsetpages}
  {strayman}
\LoadClass{strayman}
\RequirePackage{dnd}

%%% page layout
\textheight = \paperheight \advance\textheight by -2in
\headsep = 0pt \headheight = 0pt
\footskip = 20pt
\fancypagestyle{foots}{%
  \fancyhf{}%
  \fancyfoot[RE, RO]{\itshape\small \sectname\ \thepage/\thepagemax}%
}
\pagestyle{foots}

\count1 = 0
\def\thepagemax{\pageref{pgn:\the\count1}}
\def\sect#1{%
  \label{pgn:\the\count1}%
  \newpage\section{#1}%
  \gdef\sectname{#1}%
  \global\advance\count1by1%
  \global\count0=1%
}
\AtEndDocument{\label{pgn:\the\count1}}

%%% tables
\tabcolsep = 0.5em

%%% orders of events
\newcount\itemcount \newcount\levelcount

\newenvironment{order}[1]{%
  \global\itemcount=0%
  \def\item{\global\advance\itemcount by1\relax\the\itemcount.&}
  \begin{tabular}{rl} \hlx*{hv}
    \tt{#1} \\ \hlx{vhv}
}{%
  \hlx*{vh} \end{tabular}%
}

\newenvironment{order*}[1]{%
  \def\item{$\bullet$&}
  \begin{tabular}{rl} \hlx*{hv}
    \tt{#1} \\ \hlx{vhv}
}{%
  \hlx*{vh} \end{tabular}%
}

%%% table sets
\def\col{\vbox\bgroup\halign\bgroup\hfil\ignorespaces##\unskip\hfil\cr}
\def\endcol{\crcr\egroup\egroup}
\def\row{\hbox to\hsize\bgroup\valign\bgroup\vskip\topglue@\centering\hbox{##}\vskip\botglue@\cr\noalign{\hfil}\col}
\def\endrow{\endcol\cr\noalign{\hfil}\egroup\egroup}
\def\rowgap{\endcol\cr\noalign{\hskip1em plus1fil}\col}
\def\colgap{\cr\noalign{\medskip}}
\def\line{\endrow\medskip\row}
\def\set{\@ifnextchar[\set@{\set@[c]}}
\newskip\topglue@ \newskip\botglue@
\def\set@[#1]{\topglue@0ptplus1fil\botglue@0ptplus1fil\ifx
  b#1\botglue@\z@\else\ifx t#1\topglue@\z@\fi\fi\vspace\bigskipamount\vbox\bgroup\row}
\def\endset{\endrow\egroup}

