The Supertabular

Here is the description of a new style file called supertab. This new style offers a new environment, the supertabular environment. As the name says it is an extension of the normal tabular environment.

With the original tabular environment a tabular must always fit on one page. If the tabular becomes too large the text overwrites the page's bottom margin and you get an Overfull vbox message.

The supertabular environment uses the tabular environment internally, but it evaluates the used space every time it gets a \\ command. If the tabular reaches the textheight, it automatically inserts an \end{tabular} command, starts a new page and inserts the tablehead on the new page continuing the tabular.

New commands to use with supertabular are:

\tablefirsthead{...} defines the contents of the first occurence of the tabular head. The use of this command is optional. Don't forget to close the head by a \\ or \newline.
\tablehead{...} defines the contents of all subsequent ocurrences of the tabular head. Don't forget to close the head by a \\ or \newline.
\tabletail{...} defines something which should be inserted before each \end{tabular}, except the last.
\tablelasttail{...} defines something which should be inserted before the last \end{tabular}. The use of this command is optional.
\topcaption{...}  
\bottomcaption{...}  
\tablecaption{...} Provide a caption for the super-table, either at the top or at the bottom of the table. When \tablecaption is used the caption will be placed at the default location, which is at the top.
Note that you define new lines inside the supertabular as normal by \\ or \\[...pt]. All column definition commands can be used, including @{...} and p{...}. You can not use the optional positioning argument and the width argument which are possible with the \begin{tabular} command.

Here is an example of a supertabular. You will find the definitions at the end of the supertabular.

This table is split across pages

Number  Number2  Number4 Number!
1  1  1 1
2  4  16 2
3  9  81 6
4  16  256 24
5  25  625 120
6  36  1296 720
7  49  2401 5040
8  64  4096 40320
9  81  6561 362880
10  100  10000 3628800
11  121  14641 39916800
12  144  20736 479001600
         
13  169  28561 6.22702080E+9
14  196  38416 8.71782912E+10
15  225  50625 1.30767437E+12
16  256  65536 2.09227899E+13
17  289  83521 3.55687428E+14
18  324  104976 6.40237370E+15
19  361  130321 1.21645100E+17
20  400  160000 2.43290200E+18
         
And here are the definitions:
\newcommand{\tbsp}{\rule{0pt}{18pt}}
                  % I use \tbsp to get a vertical distance after \hline
\tablefirsthead{\hline  \multicolumn{1}{|c}{\tbsp Number}
                       & \multicolumn{1}{c}{Number$^2$}
                       & Number$^4$
                       & \multicolumn{1}{c|}{Number!} \\ \hline\tbsp  }
\tablehead{\hline \multicolumn{4}{|l|}%
                {\small\sl continued from previous page}\\
           \hline \multicolumn{1}{|c}{\tbsp Number}
                       & \multicolumn{1}{c}{Number$^2$}
                       & Number$^4$
                       & \multicolumn{1}{c|}{Number!} \\ \hline\tbsp  }
\tabletail{\hline\multicolumn{4}{|r|}%
                {\small\sl continued on next page}\\\hline}
\tablelasttail{\hline}
\bottomcaption{This table is split across pages}
\begin{supertabular}{| r@{\hspace{6.5mm}}| r@{\hspace{5.5mm}}| r | r|}
1   &     1  &        1  &           1    \\
2   &     4  &       16  &           2    \\
3   &     9  &       81  &           6    \\
4   &    16  &      256  &          24    \\[5mm]
...
19  &   361  &   130321  &  1.21645100E+17\\
20  &   400  &   160000  &  2.43290200E+18\\
\end{supertabular}

Here is another example whith a p column-definition. The tablehead is the same as above. The tabletail is a double \hline \arraystretch is set to 1.5 and font size is \small.

This table should also be split accross pages.
1   1   1 here is a relative short entry
2   1   1 and here is a long entry, where line breaks and line breaks and line breaks have to occur
3   1   1 here is also a long entry, where also a line break should occur
4   1   1 here is also a long entry, where also a line break should occur
5   1   1 here is a relative short entry
6   1   1 here is also a long entry, where also a line break should occur
7   1   1 here is also a long entry, where also a line break should occur
8   1   1 and here is a long entry, where line breaks and line breaks and line breaks have to occur
9   1   1 and here is a long entry, where line breaks and line breaks and line breaks have to occur
10   1   1 here is also a long entry, where also a line break should occur
11   1   1 here is also a long entry, where also a line break should occur
12   1   1 here is a relative short entry
13   1   1 here is also a long entry, where also a line break should occur
14   1   1 and here is a long entry, where line breaks and line breaks and line breaks have to occur
15   1   1 and here is a long entry, where line breaks and line breaks and line breaks have to occur
16   1   1 here is also a long entry, where also a line break should occur
17   1   1 and here is a long entry, where line breaks and line breaks and line breaks have to occur
18   1   1 and here is a long entry, where line breaks and line breaks and line breaks have to occur
   

Here is the same table again, but this time using the supertabular* environment and stretching the table to the full width of the text.


\begin{supertabular*}{\textwidth}%
{\vert r@{\extracolsep{6.5mm plus 1fil}}\ver...
...ne breaks and line
breaks and line breaks have to occur \\
\end{supertabular*}