%% %% This is file `xtab.sty', %% generated with the docstrip utility. %% %% The original source files were: %% %% xtab.dtx (with options: `xtab') %% %% ----------------------------------------------------------------- %% Author: Peter Wilson %% Maintainer: Will Robertson (will dot robertson at latex-project dot org) %% Copyright 1998 -- 2008 Peter R. Wilson %% Copyright 2010 Will Robertson %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either %% version 1.3c of this license or (at your option) any %% later version: %% %% This work has the LPPL maintenance status "maintained". %% The Current Maintainer of this work is Will Robertson. %% %% This work consists of the files listed in the README file. %% ----------------------------------------------------------------- %% \ProvidesPackage{xtab} [2011/07/31 v2.3f Extended supertabular package] \newcount\c@tracingst \DeclareOption{errorshow}{\c@tracingst\z@} %%%%\DeclareOption{pageshow}{\c@tracingst\tw@} \DeclareOption{pageshow}{\c@tracingst\thr@@} \DeclareOption{debugshow}{\c@tracingst5\relax} \ProcessOptions \newif\if@topcaption \@topcaptiontrue \def\topcaption{\@topcaptiontrue\tablecaption} \def\bottomcaption{\@topcaptionfalse\tablecaption} \gdef\PWST@thecaption{} \newdimen\PWSTcapht \long\def\tablecaption{% \refstepcounter{table}\@dblarg{\@xtablecaption}} \long\def\@xtablecaption[#1]#2{% \long\gdef\PWST@thecaption{#2}% \long\gdef\@process@tablecaption{\ST@caption{table}[#1]{#2}}} \global\let\@process@tablecaption\relax \newif\ifST@star \newif\ifST@mp \newdimen\ST@wd \newskip\ST@rightskip \newskip\ST@leftskip \newskip\ST@parfillskip \@ifundefined{@initisotab}{% \newcommand{\@initisotab}{}% \newif\ifinfloat}{\typeout{xtab using iso captions}} \long\def\ST@caption#1[#2]#3{\par% \@initisotab \addcontentsline{\csname ext@#1\endcsname}{#1}% {\protect\numberline{% \csname the#1\endcsname}{\ignorespaces #2}}% \begingroup \@parboxrestore \normalsize %% \if@topcaption \vskip -10\p@ \fi \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces #3}\par %% \if@topcaption \vskip 10\p@ \fi \endgroup \global\advance\ST@pageleft -\PWSTcapht \ST@trace\tw@{Added caption. Space left for xtabular: \the\ST@pageleft}} \newcommand\tablehead[1]{% \gdef\@tablehead{% \noalign{% \global\let\@savcr=\\% \global\let\\=\org@tabularcr}% #1% \noalign{\global\let\\=\@savcr}}} \tablehead{} \newcommand\tablefirsthead[1]{\gdef\@table@first@head{#1}} \newcounter{PWSTtable} \newcount\PWSTlastpage \newcount\PWSTpenultimate \newcount\PWSTcurpage \newcount\PWSTtempc \newcount\PWSTlines %%% \newcount\PWSThead %%% \newcount\PWSTlasthead \newif\iffirstcall \newdimen\PWST@lastht \newdimen\PWST@generalht \newdimen\PWST@ht \newcommand{\tablelasthead}[1]{\gdef\@table@last@head{#1}} \newcommand{\notablelasthead}{\let\@table@last@head\relax} \tablelasthead{} \notablelasthead \newcommand\tabletail[1]{% \gdef\@tabletail{% \noalign{% \global\let\@savcr=\\% \global\let\\=\org@tabularcr}% #1% \noalign{\global\let\\=\@savcr}}} \tabletail{} \newcommand\tablelasttail[1]{\gdef\@table@last@tail{#1}} \tablelasttail{} \newcommand\sttraceon{\c@tracingst5\relax} \newcommand\sttraceoff{\c@tracingst\z@} \newcommand\ST@trace[2]{% \ifnum\c@tracingst>#1\relax \GenericWarning{(xtab)\@spaces\@spaces}{Package xtab: #2}% \fi} \newdimen\ST@pageleft \newcommand*\shrinkheight[1]{% \noalign{\global\advance\ST@pageleft-#1\relax}} \newcommand*\setSTheight[1]{% \noalign{\global\ST@pageleft=#1\relax}} \newcommand{\xentrystretch}[1]{\def\PWST@xentrystretch{#1}} \xentrystretch{0.1} \newdimen\ST@headht \newdimen\ST@tailht \newdimen\ST@pagesofar \newdimen\ST@pboxht \newdimen\ST@lineht \newdimen\ST@stretchht \newdimen\ST@prevht \newdimen\ST@toadd \newdimen\ST@dimen \newbox\ST@pbox \def\ST@tabularcr{% {\ifnum0=`}\fi \@ifstar{\ST@xtabularcr}{\ST@xtabularcr}} \def\ST@xtabularcr{% \@ifnextchar[%] {\ST@argtabularcr}% {\ifnum0=`{\fi}\cr\ST@cr}} \def\ST@argtabularcr[#1]{% \ifnum0=`{\fi}% \setlength\@tempdima{#1}% \ifdim \@tempdima>\z@ \unskip\ST@xargarraycr{#1}% \else \ST@yargarraycr{#1}% \fi} \def\ST@xargarraycr#1{% \setlength\@tempdima{#1}% \advance\@tempdima \dp \@arstrutbox \vrule \@height\z@ \@depth\@tempdima \@width\z@ \cr \noalign{\setlength{\global\ST@toadd}{#1}}\ST@cr } \def\ST@yargarraycr#1{% \cr\noalign{% \setlength{\global\ST@toadd}{#1}% \vskip\ST@toadd }\ST@cr } \def\ST@startpbox#1{% %%%% \setbox\ST@pbox\vtop\bgroup\hsize#1\@arrayparboxrestore} \setbox\ST@pbox\vtop\bgroup\setlength\hsize{#1}\@arrayparboxrestore} \def\ST@astartpbox#1{% \bgroup\setlength\hsize{#1}% %%%% \setbox\ST@pbox\vtop\bgroup\hsize#1\@arrayparboxrestore} \setbox\ST@pbox\vtop\bgroup\setlength\hsize{#1}\@arrayparboxrestore} \def\ST@endpbox{% \@finalstrut\@arstrutbox\par\egroup \ST@dimen=\ht\ST@pbox \advance\ST@dimen by \dp\ST@pbox \ifnum\ST@pboxht<\ST@dimen \global\ST@pboxht=\ST@dimen \fi \ST@dimen=\z@ \box\ST@pbox\hfil} \def\ST@aendpbox{% \@finalstrut\@arstrutbox\par\egroup \ST@dimen=\ht\ST@pbox \advance\ST@dimen by \dp\ST@pbox \ifnum\ST@pboxht<\ST@dimen \global\ST@pboxht=\ST@dimen \fi \ST@dimen=\z@ \unvbox\ST@pbox\egroup\hfil} \def\estimate@lineht{% \ST@lineht=\arraystretch \baselineskip \global\advance\ST@lineht by 1\p@ \ST@stretchht\ST@lineht\advance\ST@stretchht-\baselineskip \ifdim\ST@stretchht<\z@\ST@stretchht\z@\fi \ST@trace\tw@{Basic line height: \the\ST@lineht\MessageBreak% Arrayed line height: \the\ST@stretchht}% \global\advance\ST@lineht \PWST@xentrystretch\ST@lineht \ST@trace\tw@{Stretched line height: \the\ST@lineht}} \def\@calfirstpageht{% \ST@trace\tw@{Calculating height of xtabular on first page}% \global\ST@pagesofar\pagetotal \global\ST@pageleft\@colroom \ST@trace\tw@{Height of previous text = \the\pagetotal; \MessageBreak Height of column = \the\ST@pageleft}% \if@twocolumn \ST@trace\tw@{two column mode}% \if@firstcolumn \ST@trace\tw@{First column}% \ifnum\ST@pagesofar > \ST@pageleft \global\ST@pageleft=2\ST@pageleft \ifnum\ST@pagesofar > \ST@pageleft \newpage\@calnextpageht \ST@trace\tw@{starting new page}% \else \ST@trace\tw@{Second column}% \global\advance\ST@pageleft -\ST@pagesofar \global\advance\ST@pageleft -\@colroom \fi \else \global\advance\ST@pageleft by -\ST@pagesofar \global\ST@pagesofar\z@ \fi \else \ST@trace\tw@{Second column}% \ifnum\ST@pagesofar > \ST@pageleft \ST@trace\tw@{starting new page}% \newpage\@calnextpageht \else \global\advance\ST@pageleft by -\ST@pagesofar \global\ST@pagesofar\z@ \fi \fi \else \ST@trace\tw@{one column mode}% \ifnum\ST@pagesofar > \ST@pageleft \ST@trace\tw@{starting new page}% \newpage\@calnextpageht \else \global\advance\ST@pageleft by -\ST@pagesofar \global\ST@pagesofar\z@ \fi \fi \ST@trace\tw@{Available height: \the\ST@pageleft}% \ifx\@@tablehead\@empty \ST@headht=\z@ \else \setbox\@tempboxa=\vbox{\@arrayparboxrestore \ST@restore \expandafter\tabular\expandafter{\ST@tableformat}% \@@tablehead\endtabular}% \ST@headht=\ht\@tempboxa\advance\ST@headht\dp\@tempboxa \fi \ST@trace\tw@{Height of head: \the\ST@headht}% \ifx\@tabletail\@empty \ST@tailht=\z@ \else \setbox\@tempboxa=\vbox{\@arrayparboxrestore \ST@restore \expandafter\tabular\expandafter{\ST@tableformat}% \@tabletail\endtabular}% \ST@tailht=\ht\@tempboxa\advance\ST@tailht\dp\@tempboxa \fi \advance\ST@tailht by \ST@lineht \ST@trace\tw@{Height of tail: \the\ST@tailht}% \ST@trace\tw@{Maximum space for xtabular: \the\ST@pageleft}% \@tempdima\ST@headht \advance\@tempdima\ST@lineht \advance\@tempdima\ST@tailht \if@topcaption \setbox\@tempboxa=\vbox{\PWST@thecaption}% \PWSTcapht=\ht\@tempboxa\advance\PWSTcapht\dp\@tempboxa \advance\PWSTcapht by 20\p@ \else \PWSTcapht = 10\p@ \fi \ST@trace\tw@{Caption height: \the\PWSTcapht}% \advance\@tempdima\PWSTcapht \ST@trace\tw@{Minimum height of xtabular: \the\@tempdima}% \ifnum\@tempdima>\ST@pageleft \ST@trace\tw@{starting new page}% \newpage \global\ST@pageleft\@colroom \global\advance\ST@pageleft by -\PWSTcapht \global\ST@pagesofar=\z@ \fi} % end \@calfirstpageheight \def\@calnextpageht{% \ST@trace\tw@{Calculating height of xtabular on next page}% \global\ST@pageleft\@colroom \global\ST@pagesofar=\z@ \ST@trace\tw@{Maximum space for xtabular: \the\ST@pageleft}} \newcommand{\PWSTcalchtlines}{% \setbox\@tempboxa=\vbox{\@arrayparboxrestore \ST@restore \expandafter\tabular\expandafter{\ST@tableformat}% \@table@last@tail\endtabular}% \PWST@ht=\ht\@tempboxa\advance\PWST@ht\dp\@tempboxa \global\PWST@lastht = \PWST@ht \setbox\@tempboxa=\vbox{\@arrayparboxrestore \ST@restore \expandafter\tabular\expandafter{\ST@tableformat}% \@table@last@head\endtabular}% \PWST@ht = \ht\@tempboxa\advance\PWST@ht\dp\@tempboxa \global\advance\PWST@lastht by \PWST@ht \ST@trace\tw@{Height of empty xtabular on last page = \the\PWST@lastht}% \setbox\@tempboxa=\vbox{\@arrayparboxrestore \ST@restore \expandafter\tabular\expandafter{\ST@tableformat}% \@tabletail\endtabular}% \PWST@ht=\ht\@tempboxa\advance\PWST@ht\dp\@tempboxa \global\PWST@generalht = \PWST@ht \setbox\@tempboxa=\vbox{\@arrayparboxrestore \ST@restore \expandafter\tabular\expandafter{\ST@tableformat}% \@tablehead\endtabular}% \PWST@ht = \ht\@tempboxa\advance\PWST@ht\dp\@tempboxa \global\advance\PWST@generalht by \PWST@ht} \newcommand{\PWSTcalnextpageht}{% \ifnum\PWSTcurpage = \PWSTpenultimate \ST@trace\tw@{Calculating height of xtabular on last page}% \PWST@ht=\PWST@lastht \else \ST@trace\tw@{Calculating height of xtabular on next general page}% \PWST@ht=\PWST@generalht \fi \global\ST@pageleft\@colroom \global\advance\ST@pageleft -\PWST@ht \global\ST@pagesofar=\z@ \ST@trace\tw@{Available space for xtabular: \the\ST@pageleft}} \def\x@supertabular{% \let\org@tabular\tabular \let\tabular\inner@tabular \expandafter\let \csname org@tabular*\expandafter\endcsname \csname tabular*\endcsname \expandafter\let\csname tabular*\expandafter\endcsname \csname inner@tabular*\endcsname %%%% \if@topcaption \@process@tablecaption \fi \global\let\@oldcr=\\% \def\baslineskp{\baselineskip}% \ifx\undefined\@classix \let\org@tabularcr\@tabularcr \let\@tabularcr\ST@tabularcr \let\org@startpbox=\@startpbox \let\org@endpbox=\@endpbox \let\@@startpbox=\ST@startpbox \let\@@endpbox=\ST@endpbox \else \let\org@tabularcr\@arraycr \let\@arraycr\ST@tabularcr \let\org@startpbox=\@startpbox \let\org@endpbox=\@endpbox \let\@startpbox=\ST@astartpbox \let\@endpbox=\ST@aendpbox \fi \ifx\@table@first@head\undefined \let\@@tablehead=\@tablehead \else \let\@@tablehead=\@table@first@head \fi \let\ST@skippage\ST@skipfirstpart \estimate@lineht \@calfirstpageht \PWSTinit \if@topcaption \@process@tablecaption \fi \noindent \global\advance\ST@pageleft -\ST@headht% \ST@trace\tw@{Available space after accounting for header: \the\ST@pageleft}% \global\advance\ST@pageleft -\ST@tailht% \ST@trace\tw@{Available space after accounting for tail: \the\ST@pageleft}} \newcommand{\PWSTinit}{% \global\advance\c@PWSTtable\@ne \global\expandafter\let\expandafter\PWSTtempc \csname PWST@\romannumeral\c@PWSTtable\endcsname \ifx\PWSTtempc\relax \ST@trace\tw@{Table \the\c@PWSTtable: Processing for the first time}% \PWSTlastpage=\@m% = 1000 \else \PWSTlastpage=\PWSTtempc \fi \ST@trace\tw@{Table \the\c@PWSTtable: last page set to \the\PWSTlastpage}% \PWSTcurpage=\@ne \PWSTcalchtlines \global\PWSTlines=\z@ \global\firstcalltrue \infloattrue} \def\xtabular{% \@ifnextchar[{\@supertabular}%] {\@supertabular[]}} \def\@supertabular[#1]#2{% \def\ST@tableformat{#2}% \ST@trace\tw@{Starting a new xtabular}% \global\ST@starfalse \global\ST@mpfalse \x@supertabular \expandafter\org@tabular\expandafter{\ST@tableformat}% \@@tablehead} \@namedef{xtabular*}#1{% \@ifnextchar[{\@nameuse{@supertabular*}{#1}}% {\@nameuse{@supertabular*}{#1}[]}%] } \@namedef{@supertabular*}#1[#2]#3{% \ST@trace\tw@{Starting a new xtabular*}% \def\ST@tableformat{#3}% \ST@wd=#1\relax \global\ST@startrue \global\ST@mpfalse \x@supertabular \expandafter\csname org@tabular*\expandafter\endcsname \expandafter{\expandafter\ST@wd\expandafter}% \expandafter{\ST@tableformat}% \@@tablehead} \def\mpxtabular{% \@ifnextchar[{\@mpsupertabular}%] {\@mpsupertabular[]}} \def\@mpsupertabular[#1]#2{% \def\ST@tableformat{#2}% \ST@trace\tw@{Starting a new mpxtabular}% \global\ST@starfalse \global\ST@mptrue \ST@rightskip \rightskip \ST@leftskip \leftskip \ST@parfillskip \parfillskip \x@supertabular \minipage{\columnwidth}% \parfillskip\ST@parfillskip \rightskip \ST@rightskip \leftskip \ST@leftskip \noindent\expandafter\org@tabular\expandafter{\ST@tableformat}% \@@tablehead} \@namedef{mpxtabular*}#1{% \@ifnextchar[{\@nameuse{@mpsupertabular*}{#1}}% {\@nameuse{@mpsupertabular*}{#1}[]}%] } \@namedef{@mpsupertabular*}#1[#2]#3{% \ST@trace\tw@{Starting a new mpxtabular*}% \def\ST@tableformat{#3}% \ST@wd=#1\relax \global\ST@startrue \global\ST@mptrue \ST@rightskip \rightskip \ST@leftskip \leftskip \ST@parfillskip \parfillskip \x@supertabular \minipage{\columnwidth}% \parfillskip\ST@parfillskip \rightskip \ST@rightskip \leftskip \ST@leftskip \noindent\expandafter\csname org@tabular*\expandafter\endcsname \expandafter{\expandafter\ST@wd\expandafter}% \expandafter{\ST@tableformat}% \@@tablehead} \def\endxtabular{% \ifx\@table@last@tail\undefined \@tabletail \else \@table@last@tail \fi \csname endtabular\ifST@star*\fi\endcsname \x@endsupertabular \ST@trace\tw@{Ended a xtabular\ifST@star*\fi}} \expandafter\let\csname endxtabular*\endcsname\endxtabular \newcommand{\x@endsupertabular}{% \ST@restore \if@topcaption \else \@process@tablecaption \global\@topcaptiontrue \fi \global\let\\=\@oldcr \global\let\@table@first@head\undefined %%% \global\let\@table@last@tail\undefined \global\let\@process@tablecaption\relax \PWSToplastpagenum \infloatfalse} \newcommand{\PWSToplastpagenum}{% \ifnum\PWSTcurpage=\PWSTlastpage \iffirstcall % on last, no overflow %% \ifnum\PWSTlines < \PWSTlasthead % this table is empty \ifnum\PWSTlines < \@ne % this table is empty \global\advance\PWSTcurpage \m@ne \fi \else % overflow %% \ifnum\PWSTlines > \tw@ % enough for another page \ifnum\PWSTlines > \z@ % enough for another page \global\advance\PWSTcurpage \@ne \fi \fi \else %% \ifnum\PWSTlines < \PWSThead % empty table \ifnum\PWSTlines < \@ne % empty table \global\advance\PWSTcurpage \m@ne \fi \fi \if@filesw\immediate\write\@auxout% {\gdef\string\PWST@\romannumeral\c@PWSTtable{\the\PWSTcurpage}}% \ST@trace\tw@{Table \the\c@PWSTtable:\MessageBreak wrote \the\PWSTcurpage\space as the last page}% \fi} \def\endmpxtabular{% \ifx\@table@last@tail\undefined \@tabletail \else \@table@last@tail \fi \csname endtabular\ifST@star*\fi\endcsname \endminipage \x@endsupertabular \ST@trace\tw@{Ended an mpxtabular\ifST@star*\fi}} \expandafter\let\csname endmpxtabular*\endcsname\endmpxtabular \def\ST@restore{% \ifx\undefined\@classix \let\@tabularcr\org@tabularcr \else \let\@arraycr\org@tabularcr \fi \let\@startpbox\org@startpbox \let\@endpbox\org@endpbox} \def\inner@tabular{% \ST@restore \let\\=\@oldcr \noindent \org@tabular} \@namedef{inner@tabular*}{% \ST@restore \let\\=\@oldcr \noindent \csname org@tabular*\endcsname} \def\ST@cr{% \noalign{% \ST@trace\thr@@{Parbox height: \the\ST@pboxht\MessageBreak Line height: \the\ST@lineht}% \ifnum\ST@pboxht<\ST@lineht \global\advance\ST@pageleft -\ST@lineht \global\ST@prevht\ST@lineht \else \global\advance\ST@pboxht \PWST@xentrystretch\ST@pboxht \global\advance\ST@pboxht \ST@stretchht \ST@trace\thr@@{Added par box with height \the\ST@pboxht}% \global\advance\ST@pageleft -\ST@pboxht \global\ST@prevht\ST@pboxht \global\ST@pboxht\z@ \fi \global\advance\ST@pageleft -\ST@toadd \global\ST@toadd=\z@ \ST@trace\thr@@{Space left for xtabular: \the\ST@pageleft}% \global\advance\PWSTlines \@ne \ST@trace\thr@@{Line counter incremented by one to: \the\PWSTlines}% }% end of noalign \ifnum\PWSTcurpage=\PWSTlastpage \PWST@lastpagecr \else \ifnum\ST@pageleft<\z@ \ST@skippage \else \noalign{\global\@tempdima\ST@tailht \global\advance\@tempdima\ST@prevht \ifST@mp \ifvoid\@mpfootins\else \global\advance\@tempdima\ht\@mpfootins \global\advance\@tempdima 3pt \fi \fi}% end noalign \ifnum\ST@pageleft<\@tempdima \ST@newpage \else \noalign{\global\let\ST@next\@empty}% \fi \fi \fi \ST@next} \newcommand{\PWST@lastpagecr}{% \noalign{% \ifnum\ST@pageleft<\z@ \PWST@setfirstcall \fi \global\@tempdima\ST@tailht \global\advance\@tempdima\ST@prevht \ifST@mp \ifvoid\@mpfootins\else \global\advance\@tempdima\ht\@mpfootins \global\advance\@tempdima 3pt \fi \fi \ifnum\ST@pageleft<\@tempdima \PWST@setfirstcall \fi \global\let\ST@next\@empty }} \newcommand{\PWST@setfirstcall}{% \iffirstcall \global\firstcallfalse \global\PWSTlines=\z@ \ST@trace\thr@@{Overflow on last page. Line counter set to \the\PWSTlines}% \fi} \def\ST@skipfirstpart{% \noalign{% \ST@trace\tw@{Tabular too high, moving to next page}% \global\advance\ST@pageleft\pagetotal \global\ST@pagesofar\z@ \newpage \global\let\ST@skippage\ST@newpage }} \def\ST@newpage{% \noalign{\ST@trace\tw@{Starting new page, writing tail}}% \@tabletail \ifST@star \csname endtabular*\endcsname \else \endtabular \fi \ifST@mp \endminipage \fi \global\let\ST@skippage\ST@newpage \newpage\PWSTcalnextpageht \ST@trace\tw@{writing head}% \PWSTsethead \ifST@mp \noindent\minipage{\columnwidth}% \parfillskip\ST@parfillskip \rightskip \ST@rightskip \leftskip \ST@leftskip \fi \noindent \ifST@star \expandafter\csname org@tabular*\expandafter\endcsname \expandafter{\expandafter\ST@wd\expandafter}% \expandafter{\ST@tableformat}% \else \expandafter\org@tabular\expandafter{\ST@tableformat}% \fi} \newcommand{\PWSTsethead}{% \global\PWSTlines=\z@ \ST@trace\thr@@{Newpage, line counter set to: \the\PWSTlines}% \global\advance\PWSTcurpage\@ne \ST@trace\tw@{Table \the\c@PWSTtable:\MessageBreak current page = \the\PWSTcurpage,\MessageBreak last page = \the\PWSTlastpage}% \ifnum\PWSTcurpage=\PWSTlastpage \ST@trace\tw@{Newpage is the last page}% \ifnum\PWSTcurpage>\@ne \ifx\@table@last@head\relax \let\ST@next\@tablehead \ST@trace\tw@{Set heading to tablehead}% \else \let\ST@next\@table@last@head \ST@trace\tw@{Set heading to tablelasthead}% \fi \fi \else \let\ST@next\@tablehead \ST@trace\tw@{Set heading to tablehead}% \fi} \endinput %% %% End of file `xtab.sty'.