Debian Codegraph @

texmf-dist/source/latex/xtab/xtab.dtx

raw
1 % \iffalse meta-comment
2 %
3 % xtab.dtx
4 % Author: Peter Wilson (herries dot press (at) earthlink dor net)
5 % Maintainer: Will Robertson (will dot robertson at latex-project dot org)
6 % Copyright 1998--2008 Peter R. Wilson
7 % Copyright 2010--2011 Will Robertson
8 %
9 % This work may be distributed and/or modified under the
10 % conditions of the LaTeX Project Public License, either
11 % version 1.3c of this license or (at your option) any
12 % later version: <http://www.latex-project.org/lppl.txt>
13 %
14 % This work has the LPPL maintenance status "maintained".
15 % The Current Maintainer of this work is Will Robertson.
16 %
17 % This work consists of the files listed in the README file.
18 %
19 %<*driver>
20 \ProvidesFile{xtab.dtx}
21 %</driver>
22 %<xtab>\ProvidesPackage{xtab}
23 %<*xtab>
24 [2011/07/31 v2.3f Extended supertabular package]
25 %</xtab>
26 %
27 %<*driver>
28 \documentclass{ltxdoc}
29 \usepackage{xtab}
30 %\usepackage{xtab-b}
31 \providecommand{\captionsize}{}
32 \EnableCrossrefs
33 \CodelineIndex
34 \setcounter{StandardModuleDepth}{1}
35 \begin{document}
36 \DocInput{xtab.dtx}
37 \end{document}
38 %</driver>
39 %
40 % \fi
41 % \CheckSum{1527}
42 %
43 % \DoNotIndex{\',\.,\@M,\@@input,\@addtoreset,\@arabic,\@badmath}
44 % \DoNotIndex{\@centercr,\@cite}
45 % \DoNotIndex{\@dotsep,\@empty,\@float,\@gobble,\@gobbletwo,\@ignoretrue}
46 % \DoNotIndex{\@input,\@ixpt,\@m}
47 % \DoNotIndex{\@minus,\@mkboth,\@ne,\@nil,\@nomath,\@plus,\@set@topoint}
48 % \DoNotIndex{\@tempboxa,\@tempcnta,\@tempdima,\@tempdimb}
49 % \DoNotIndex{\@tempswafalse,\@tempswatrue,\@viipt,\@viiipt,\@vipt}
50 % \DoNotIndex{\@vpt,\@warning,\@xiipt,\@xipt,\@xivpt,\@xpt,\@xviipt}
51 % \DoNotIndex{\@xxpt,\@xxvpt,\\,\ ,\addpenalty,\addtolength,\addvspace}
52 % \DoNotIndex{\advance,\Alph,\alph}
53 % \DoNotIndex{\arabic,\ast,\begin,\begingroup,\bfseries,\bgroup,\box}
54 % \DoNotIndex{\bullet}
55 % \DoNotIndex{\cdot,\cite,\CodelineIndex,\cr,\day,\DeclareOption}
56 % \DoNotIndex{\def,\DisableCrossrefs,\divide,\DocInput,\documentclass}
57 % \DoNotIndex{\DoNotIndex,\egroup,\ifdim,\else,\fi,\em,\endtrivlist}
58 % \DoNotIndex{\EnableCrossrefs,\end,\end@dblfloat,\end@float,\endgroup}
59 % \DoNotIndex{\endlist,\everycr,\everypar,\ExecuteOptions,\expandafter}
60 % \DoNotIndex{\fbox}
61 % \DoNotIndex{\filedate,\filename,\fileversion,\fontsize,\framebox,\gdef}
62 % \DoNotIndex{\global,\halign,\hangindent,\hbox,\hfil,\hfill,\hrule}
63 % \DoNotIndex{\hsize,\hskip,\hspace,\hss,\if@tempswa,\ifcase,\or,\fi,\fi}
64 % \DoNotIndex{\ifhmode,\ifvmode,\ifnum,\iftrue,\ifx,\fi,\fi,\fi,\fi,\fi}
65 % \DoNotIndex{\input}
66 % \DoNotIndex{\jobname,\kern,\leavevmode,\let,\leftmark}
67 % \DoNotIndex{\list,\llap,\long,\m@ne,\m@th,\mark,\markboth,\markright}
68 % \DoNotIndex{\month,\newcommand,\newcounter,\newenvironment}
69 % \DoNotIndex{\NeedsTeXFormat,\newdimen}
70 % \DoNotIndex{\newlength,\newpage,\nobreak,\noindent,\null,\number}
71 % \DoNotIndex{\numberline,\OldMakeindex,\OnlyDescription,\p@}
72 % \DoNotIndex{\pagestyle,\par,\paragraph,\paragraphmark,\parfillskip}
73 % \DoNotIndex{\penalty,\PrintChanges,\PrintIndex,\ProcessOptions}
74 % \DoNotIndex{\protect,\ProvidesClass,\raggedbottom,\raggedright}
75 % \DoNotIndex{\refstepcounter,\relax,\renewcommand,\reset@font}
76 % \DoNotIndex{\rightmargin,\rightmark,\rightskip,\rlap,\rmfamily,\roman}
77 % \DoNotIndex{\roman,\secdef,\selectfont,\setbox,\setcounter,\setlength}
78 % \DoNotIndex{\settowidth,\sfcode,\skip,\sloppy,\slshape,\space}
79 % \DoNotIndex{\symbol,\the,\trivlist,\typeout,\tw@,\undefined,\uppercase}
80 % \DoNotIndex{\usecounter,\usefont,\usepackage,\vfil,\vfill,\viiipt}
81 % \DoNotIndex{\viipt,\vipt,\vskip,\vspace}
82 % \DoNotIndex{\wd,\xiipt,\year,\z@}
83 %
84 % \def\dtxfile{xtab.dtx}
85 % \GetFileInfo{\dtxfile}
86 % \newcommand*{\Lpack}[1]{\textsf {#1}} ^^A typeset a package
87 % \newcommand*{\Lopt}[1]{\textsf {#1}} ^^A typeset an option
88 % \newcommand*{\file}[1]{\texttt {#1}} ^^A typeset a file
89 % \newcommand*{\Lcount}[1]{\textsl {\small#1}} ^^A typeset a counter
90 % \newcommand*{\pstyle}[1]{\textsl {#1}} ^^A typeset a pagestyle
91 % \newcommand*{\Lenv}[1]{\texttt {#1}} ^^A typeset an environment
92 %
93 % \changes{v2.2}{1998/10/14}{Rewrote the documentation}
94 % \changes{v2.2}{1998/10/14}{Changed names from ...supertab... to ...xtab...}
95 % \changes{v2.2}{1998/10/14}{Kept supertab... as synonyms for xtab..., but deprecated them}
96 % \changes{v2.2a}{2000/02/15}{Deleted supertab... }
97 % \changes{v2.2a}{2000/02/15}{Updated to latest ISO class}
98 % \changes{v2.3}{2000/04/09}{Improved pagebreak control via \cs{xentrystretch} }
99 % \changes{v2.3b}{2007/03/24}{Allow calc package calculations}
100 % \changes{v2.3c}{2008/07/26}{Tried to eliminate all extraneous spaces}
101 % \changes{v2.3d}{2009/09/04}{New maintainer (Will Robertson)}
102 % \changes{v2.3f}{2011/07/31}{Escape some line-endings}
103 %
104 % \title{The \Lpack{xtab} package\thanks{This
105 % file (\texttt{\dtxfile}) has version number \fileversion, last revised
106 % \filedate.}}
107 %
108 % \author{
109 % Author: Peter Wilson, Herries Press \\
110 % Maintainer: Will Robertson \\
111 % \texttt{will dot robertson at latex-project dot org}
112 % }
113 % \date{\filedate}
114 % \maketitle
115 % \begin{abstract}
116 % The \Lpack{xtab} package enables long tables to be automatically broken
117 % at page boundaries. It is an extension of the \Lpack{supertabular}
118 % package and also reduces or eliminates some of its weaknesses.
119 % \end{abstract}
120 % \tableofcontents
121 % \listoftables
122 %
123 % \StopEventually{}
124 %
125 % \section{Introduction}
126 %
127 % Although the \Lpack{xtab} package was originally developed as part of a
128 % suite for typesetting ISO international standards~\cite{PRW96i}, it
129 % is also applicable for use with the \LaTeX{} standard classes.
130 % The package is an extension of the \Lpack{supertabular} package
131 % developed by Johannes Braams and Theo
132 % Jurriens.\footnote{\Lpack{supertabular.sty}, version 4.1c, 7 November 1997.}
133 % It reduces some of the weaknesses noted in the \Lpack{supertabular}
134 % documentation and provides additional functionality.
135 %
136 %
137 % Section~\ref{sec:usr} provides the user manual for the package which
138 % enables long tables to be automatically broken across multiple pages.
139 % Section~\ref{sec:xtab} describes the implementation.
140 %
141 % This manual is typeset according to the conventions of the
142 % \LaTeX{} \textsc{docstrip} utility which enables the automatic
143 % extraction of the \LaTeX{} macro source files~\cite{GOOSSENS94}.
144 %
145 %
146 % \section{The \Lpack{xtab} package} \label{sec:usr}
147 %
148 % The \Lpack{supertabular} package provides for the automatic
149 % breaking of a long table across page boundaries.
150 % The extension provided here enables the
151 % heading on the table on the last page to differ from those on earlier
152 % pages of the table.
153 % The downside of the extension is that \LaTeX{} has to be run twice
154 % if the document contains a |supertabular|. However, \LaTeX{} is usually
155 % run at least twice for any but the simplest document in order to get
156 % cross-references and Table of Contents, etc., resolved correctly.
157 %
158 % The current version of the extension also either cures or reduces
159 % following
160 % weaknesses in the \Lpack{supertabular} package.\footnote{I have
161 % corresponded with the authors of \Lpack{supertabular} about these.}
162 % \begin{enumerate}
163 % \item Sometimes the top caption of a |supertabular| is printed on
164 % one page and the body is printed on the following page(s).
165 % That is, there is a lonely caption.
166 % \item Sometimes the last page of a |supertabular| consists of an
167 % empty table. That is, just the head and foot of the table are
168 % printed.
169 % \item If the number of lines in the first header for the table differs
170 % from the number of lines in subsequent headers, then the
171 % continuation pages of the table may be too short or, more
172 % troubling, too long.
173 % \end{enumerate}
174 %
175 % The weaknesses are caused by trying to guess where \TeX{} will put a page
176 % break. The package has to guesstimate how long the next entry will be in
177 % the table and, if it is too long for the available space, it puts in its
178 % own page break. If its guess is off too much in one direction, \TeX{} will
179 % break the page unexpectadly; if it's off in the other direction
180 % \Lpack{supertabular} will put in an unnecessary page break.
181 %
182 % The \Lpack{xtab} package has reduced, but perhaps not entirely
183 % eliminated, these weaknesses. Some hand tuning may still be required.
184 %
185 %
186 %
187 % The principal commands available are given in Table~\ref{tab:xtab}.
188 % \DeleteShortVerb{\|}
189 % \MakeShortVerb{\?}
190 % \topcaption{The principal xtab package commands} \label{tab:xtab}
191 % \tablefirsthead{\hline \multicolumn{1}{|c|}{\textbf{Command}} &
192 % \multicolumn{1}{c|}{\textbf{Effect}} \\ \hline }
193 % \tablehead{\multicolumn{2}{c}%
194 % {{\captionsize\bfseries \tablename\ \thetable{} -- continued from previous page}} \\
195 % \hline \multicolumn{1}{|c|}{\textbf{Command}} &
196 % \multicolumn{1}{c|}{\textbf{Effect}} \\ \hline }
197 % \tablelasthead{\multicolumn{2}{c}%
198 % {{\captionsize\bfseries \tablename\ \thetable{} -- concluded from previous page}} \\
199 % \hline \multicolumn{1}{|c|}{\textbf{Command}} &
200 % \multicolumn{1}{c|}{\textbf{Effect}} \\ \hline }
201 % \tabletail{\hline \multicolumn{2}{|r|}{{Continued on next page}} \\ \hline}
202 % \tablelasttail{\hline \hline}
203 %
204 % \begin{center}
205 % \begin{xtabular}{|l|p{0.5\textwidth}|}
206 % ?\begin{xtabular}{...}? & This is equivalent to the normal
207 % ?\begin{tabular}{...}? environment.
208 % You supply the specification of the columns
209 % just as for the normal tabular environment.
210 % \\
211 % &
212 % All commands that can be used within a
213 % \Lenv{tabular}
214 % environment can also be used within
215 % the \Lenv{xtabular} environment.
216 % \\
217 % &
218 % Unlike the \Lenv{tabular} environment which prevents page breaking
219 % within the tabular, the \Lenv{xtabular} allows page breaking, so that
220 % tabulars can extend automatically across several pages.
221 % \\
222 % &
223 % \Lenv{xtabular}
224 % starts off with a \Lenv{tabular} environment and checks the amount of
225 % space left on the page as it adds each row to the tabulation.
226 % If the space left on the page is too short for another row, then
227 % it ends the current \Lenv{tabular}, performs a page break and starts
228 % another \Lenv{tabular} on the following page. This process is repeated
229 % until all the rows have been output.
230 % \\
231 % &
232 % There are special commands for captioning an \Lenv{xtabular} as a
233 % table, and also elements can be automatically inserted after each
234 % (internal) ?\begin{tabular}? and immediately before each
235 % ?\end{tabular}?.
236 % \\
237 % &
238 % Do not put a \Lenv{xtabular} in a \Lenv{table} environment,
239 % as the \Lenv{table}
240 % environment keeps its contents on a single page (presumably you
241 % are using \Lenv{xtabular} because its contents are longer than
242 % one page).
243 % \\
244 % ?\end{xtabular}? & End the \Lenv{xtabular} environment. \\ \hline
245 % ?\begin{mpxtabular}? & Like the \Lenv{xtabular} environment
246 % except that each `page' is put into a ?minipage? first.
247 % \\
248 % &
249 % Thus it is possible to have footnotes inside an \Lenv{mpxtabular}.
250 % The footnote text is printed at the end of each page.
251 % \\
252 % ?\end{mpxtabular}? & End the \Lenv{mpxtabular} environment. \\ \hline
253 % & \textbf{Note:} If any of the following commands
254 % are used, then they should be placed
255 % before the particular \Lenv{xtabular}
256 % environment that they apply to. \\
257 % ?\topcaption{...}? & A command to provide a caption for the
258 % table. The caption is placed at the top
259 % of the table. \\
260 % ?\bottomcaption{...}? & A command to provide a caption for the
261 % table. The caption is placed at the bottom
262 % of the table. \\
263 % ?\tablecaption{...}? & A command to provide a caption for the
264 % table. The caption is placed at the default
265 % position, which is at the top
266 % of the table.
267 % \\
268 % &
269 % \textbf{Notes:} You cannot use the ?\caption?
270 % command but you can put a label after
271 % any of these captioning commands. If you
272 % want captioning, the command must be specified
273 % before the start of the supertabular environment.
274 % \\
275 % &
276 % The ?\...caption{}? command(s) remain
277 % in effect until changed by another
278 % ?\...caption? command.
279 % \\
280 % ?\tablefirsthead{...}? & Defines the contents of the first occurence
281 % of the tabular head. The tabular head is some
282 % special treatment of the first row in the table.
283 % This command is optional.
284 % \\
285 % &
286 % If used, the header must be closed by the
287 % end of line command for tabulars (e.g., ?\\?). \\
288 % ?\tablehead{...}? & Defines the contents of the table head on
289 % subsequent pages.
290 % \\
291 % &
292 % For example, you might want to note that
293 % this is a continuation of the table on
294 % the previous page, as well as repeating
295 % any column headings that were given
296 % at the start of the \Lenv{xtabular} by
297 % ?\tablefirsthead?.
298 % \\
299 % &
300 % The header must be closed like the
301 % ?\tablefirsthead? command.
302 % \\
303 % ?\tablelasthead{...}? & Defines the contents of the table head
304 % on the last page of the table.
305 % \\
306 % &
307 % For example, you might want to note that the table
308 % is concluded on this page.
309 % \\
310 % &
311 % The header must be closed like the
312 % ?\tablefirsthead? command.
313 % \\
314 % ?\notablelasthead? & Switches off the last ?\tablelasthead?.
315 % A ?\tablelasthead? stays in effect until
316 % overwritten by a new ?\tablelasthead?
317 % or cancelled by this command.
318 % \\
319 % ?\tabletail{...}? & The contents of this command are inserted before
320 % the (internal) ?\end{tabular}? on each page except
321 % for the last page of the table.
322 % \\
323 % &
324 % For example, you might want to note that the
325 % table is continued on the next page.
326 % \\
327 % ?\tablelasttail{...}? & The contents of this command are inserted before
328 % the final (internal) ?\end{tabular}? of the table.
329 % \\
330 % &
331 % For example, you might want to note that
332 % this is where the table ends.
333 % \\
334 % \end{xtabular}
335 % \end{center}
336 % \DeleteShortVerb{\?}
337 % \MakeShortVerb{\|}
338 %
339 % As well as the \Lenv{xtabular} and \Lenv{mpxtabular} environments there
340 % are the corresponding starred versions
341 % (i.e., \Lenv{xtabular*} and \Lenv{mpxtabular*} for use in
342 % two column mode where the table is meant to span both columns.
343 %
344 % Table~\ref{tab:xtab} was produced by code similar to the following:
345 % \begin{verbatim}
346 % \topcaption{The principal xtab package commands} \label{tab:xtab}
347 % \tablefirsthead{\hline \multicolumn{1}{|c|}{\textbf{Command}} &
348 % \multicolumn{1}{c|}{\textbf{Effect}} \\ \hline }
349 % \tablehead{\multicolumn{2}{c}%
350 % {{\captionsize\bfseries \tablename\ \thetable{} --
351 % continued from previous page}} \\
352 % \hline \multicolumn{1}{|c|}{\textbf{Command}} &
353 % \multicolumn{1}{c|}{\textbf{Effect}} \\ \hline }
354 % \tablelasthead{\multicolumn{2}{c}%
355 % {{\captionsize\bfseries \tablename\ \thetable{} --
356 % concluded from previous page}} \\
357 % \hline \multicolumn{1}{|c|}{\textbf{Command}} &
358 % \multicolumn{1}{c|}{\textbf{Effect}} \\ \hline }
359 % \tabletail{\hline \multicolumn{2}{|r|}{{Continued on next page}} \\ \hline}
360 % \tablelasttail{\hline \hline}
361 %
362 % \begin{center}
363 % \begin{xtabular}{|l|p{0.5\textwidth}|}
364 % \verb|\begin{xtabular}{...}| & This is equivalent to the normal
365 % \verb|\begin{tabular}{...}| environment.
366 % You supply the specification of the columns
367 % just as for the normal \Lenv{tabular} environment.
368 % \\
369 % &
370 % All commands that can be used within a \Lenv{tabular}
371 % environment can also be used within
372 % the \Lenv{xtabular} environment.
373 % \\
374 % &
375 % Unlike the \Lenv{tabular} environment which prevents page breaking
376 % within the tabular, the \Lenv{xtabular} allows page breaking, so that
377 % tabulars can extend automatically across several pages.
378 % ... ... ...
379 % \verb|\tablelasttail{...}| & The contents of this command are inserted before
380 % the final (internal) \verb|\end{tabular}| of the table.
381 % \\
382 % &
383 % For example, you might want to note that this is where
384 % the table ends.
385 % \\
386 % \end{xtabular}
387 % \end{center}
388 % \end{verbatim}
389 %
390 % The table is only broken between rows --- a row will not be split
391 % across pages. This can lead to some bad page breaks, especially if
392 % there are rows with a large vertical height (like some in Table~\ref{tab:xtab}).
393 % It is best to keep rows not too tall.
394 %
395 % Unkike the \Lenv{table} environment which floats, an \Lenv{xtabular}
396 % environment is typeset at the point in the document where the environment
397 % is specified. It is best not to start an \Lenv{xtabular} too close to the
398 % bottom of a page otherwise there might be an ugly page break.
399 %
400 % \DescribeMacro{\shrinkheight}
401 % The command
402 % |\shrinkheight{|\meta{length}|}| may be
403 % used after the first |\\| in the table to modify the allowed
404 % height of the table on that page. A positive \meta{length} decreases
405 % the allowed space on the page and a negative \meta{length} increases
406 % the allowed space.
407 %
408 % For example: \\
409 % |\shrinkheight{2\baselineskip}| decreases the space per page by
410 % two lines. \\
411 % |\shrinkheight{-\baselineskip}| increases the space per page by
412 % one line. \\
413 % Note that I have never tried using this command so I cannot comment
414 % on its efficacy. Instead, I use the
415 % |\xentrystretch| command when necessary.
416 %
417 % \DescribeMacro{\xentrystretch}
418 % The command |\xentrystretch{|\meta{decimal-fraction}|}| can be used before
419 % a table to modify the amount of vertical space apparently
420 % consumed by each entry in the subsequent table(s).
421 % The default is |\xentrystretch{0.1}| which
422 % specifies a 10\% overestimate in the vertical space. Similarly,
423 % |\xentrystretch{0.25}| will overestimate the space by 25\%. A different
424 % value may be used for each table in order to eliminate, or at least reduce,
425 % bad page breaks. Increasing the value causes fewer entries to be put on
426 % a page, thus reducing the chance of \TeX{} putting in a page break before
427 % the \Lpack{xtab} package is prepared for one.
428 %
429 %
430 % You may specify the font used for the
431 % |\tablehead| and |\tablelasthead| yourself.
432 %
433 % \textbf{Note:} Within ISO documents, captions shall
434 % be in bold font. The \file{iso} class also provides
435 % a command for
436 % setting the size of the font used in captions, namely
437 % |\captionsize|. The default value for this is set by the \file{iso} class.
438 % For the curious, the default definition is: \\
439 % |\newcommand{\captionsize}{\normalsize}|
440 %
441 % \subsection{Options}
442 %
443 % The \Lpack{xtab} package has three options which control the amount of
444 % information that is written to the \file{.log} file. The
445 % options are:
446 % \begin{enumerate}
447 % \item The option \Lopt{errorshow} (the default) does not
448 % write any extra information;
449 % \item The option \Lopt{pageshow} writes information
450 % about when and why \Lpack{xtab} decides to produce a new page;
451 % \item The option \Lopt{debugshow}, which also includes
452 % \Lopt{pageshow}, additionally writes information about each line
453 % that is added to the table.
454 % \end{enumerate}
455 %
456 % Under normal circumstances \Lpack{xtab} is used without invoking any
457 % option. The \Lopt{pageshow} option may be useful when attempting to cure
458 % a bad page break. The \Lopt{debugshow} option, as its name implies, is
459 % principally of use to the \Lpack{xtab} developer.
460 %
461 % Independently of the options, the command
462 % |\sstraceon| may be used at any
463 % point in the document to turn on printing of \Lopt{debugshow} data. This
464 % can be turned off later by the |\sstraceoff|
465 % command, which will stop all \Lopt{\ldots show} printing.
466 %
467 %
468 % \section{The implementation} \label{sec:xtab}
469 %
470 % The \Lpack{xtab} package provides an extension to the
471 % \Lpack{supertabular} package
472 % written by Johannes Braams and Theo
473 % Jurriens.\footnote{\texttt{supertabular.sty}, version 4.1c, 7 November 1997.}
474 % The major portion of the following documentation is taken from
475 % \file{supertabular.dtx}.
476 % The package is designed to be used with the \file{iso} class in addition
477 % to the usual \file{article}, etc., classes.
478 %
479 % \changes{v2}{1997/11/30}{xtab updated from version 3.7 to version 4.1c of supertabular}
480 % The extension provided here enables the
481 % heading on the table on the last page to differ from those on earlier
482 % pages of the table. The implementation of the extension is based
483 % on ideas in David Carlisle's \Lpack{longtable} package.
484 % The downside of the extension is that \LaTeX{} has to be run twice
485 % if the document contains a |supertabular|. However, \LaTeX{} is usually
486 % run at least twice for any but the simplest document in order to get
487 % cross-references and Table of Contents, etc., resolved correctly.
488 %
489 % The current version of the extension also either cures or reduces
490 % following
491 % weaknesses in the \Lpack{supertabular} package.\footnote{Only the first
492 % two of these have been recognised by the authors of \Lpack{supertabular}.}
493 % \begin{enumerate}
494 % \item Sometimes the top caption of a |supertabular| is printed on
495 % one page and the body is printed on the following page(s).
496 % That is, there is a lonely caption.
497 % \item Sometimes the last page of a |supertabular| consists of an
498 % empty table. That is, just the head and foot of the table are
499 % printed.
500 % \item If the number of lines in the first header for the table differs
501 % from the number of lines in subsequent headers, then the
502 % continuation pages of the table may be too short or, more
503 % troubling, too long.
504 % \end{enumerate}
505 %
506 % The first version of \Lpack{xtab} imported much of the code from the
507 % supertabular package (version 3.7) but I found that this did not work
508 % well because there were incompatible coded versions of supertabular
509 % available on CTAN. Further, I
510 % found that there were some problems with the original \file{supertabular}
511 % code in any case.\footnote{I also found a bug in the 4.1b version which
512 % the authors kindly fixed in version 4.1c.}
513 % I have to make the assumption that other users may have dissimilar
514 % or problematic versions, so include all the code here, and thus any errors
515 % can now be laid at my door.
516 %
517 % The requirement for compatibilty with the \file{iso} class is
518 % achieved by modifications to the |\ST@caption| command only. Effectively
519 % this is orthogonal to the code required to implement the extension.
520 %
521 % Now for the code itself. As syntactic sugar, all new macros for the
522 % extension have the prefix `PWST' to distinguish them from the original
523 % macros. I have also denoted all extensions to the original
524 % \Lpack{supertabular} by introducing them as \emph{Extension:}.
525 %
526 % Announce the name and version of the package, which requires \LaTeXe.
527 % \begin{macrocode}
528 %<*xtab>
529 % \end{macrocode}
530 %
531 % \begin{macro}{\c@tracingst}
532 % There are three options with the package which control the amount
533 % of information written to the log file:
534 % \begin{enumerate}
535 % \item \Lopt{errorshow} (the default) no extra information
536 % \item \Lopt{pageshow} writes information about page breaking
537 % \item \Lopt{debugshow} adds information about each line that
538 % is added to the tabular
539 % \end{enumerate}
540 % \changes{v2}{1997/11/30}{Added options to xtab}
541 % \begin{macrocode}
542 \newcount\c@tracingst
543 \DeclareOption{errorshow}{\c@tracingst\z@}
544 % \end{macrocode}
545 % \emph{Extension:} The next line in the original code did not do what
546 % the authors intended; the number should have been 3 rather than 2.
547 % \begin{macrocode}
548 %%%%\DeclareOption{pageshow}{\c@tracingst\tw@}
549 \DeclareOption{pageshow}{\c@tracingst\thr@@}
550 \DeclareOption{debugshow}{\c@tracingst5\relax}
551 \ProcessOptions
552 % \end{macrocode}
553 % \end{macro} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
554 %
555 % \begin{macro}{\if@topcaption}
556 % \begin{macro}{\topcaption}
557 % \begin{macro}{\bottomcaption}
558 % The user-commands |\topcaption| and |\bottomcaption| set the
559 % flag |@topcaption| to determine where to put the
560 % tablecaption. The default is to put the caption on the top of
561 % the table
562 % \begin{macrocode}
563 \newif\if@topcaption \@topcaptiontrue
564 \def\topcaption{\@topcaptiontrue\tablecaption}
565 \def\bottomcaption{\@topcaptionfalse\tablecaption}
566 % \end{macrocode}
567 % \end{macro}
568 % \end{macro}
569 % \end{macro}
570 %
571 % \begin{macro}{\PWST@thecaption}
572 % \begin{macro}{\PWSTcapht}
573 % \emph{Extension:} |\PWST@thecaption| is used to store
574 % the text of the table's caption. The vertical space required by
575 % a caption is stored in |\PWSTcapht|.
576 % \changes{v2}{1997/11/30}{Added PWST@thecaption and PWSTcapht}
577 % \begin{macrocode}
578 \gdef\PWST@thecaption{}
579 \newdimen\PWSTcapht
580 % \end{macrocode}
581 % \end{macro}
582 % \end{macro}
583 %
584 % \begin{macro}{\tablecaption}
585 % \begin{macro}{\@xtablecaption}
586 % This command has to function exactly like |\caption| does except
587 % it has to store its argument (and the optional argument) for
588 % later processing \emph{within} the supertabular environment.
589 % \begin{macrocode}
590 \long\def\tablecaption{%
591 \refstepcounter{table}\@dblarg{\@xtablecaption}}
592 \long\def\@xtablecaption[#1]#2{%
593 % \end{macrocode}
594 % \emph{Extension:} I store the caption text for later measurement.
595 % \begin{macrocode}
596 \long\gdef\PWST@thecaption{#2}%
597 % \end{macrocode}
598 % Finish up with the original code.
599 % \begin{macrocode}
600 \long\gdef\@process@tablecaption{\ST@caption{table}[#1]{#2}}}
601 \global\let\@process@tablecaption\relax
602 % \end{macrocode}
603 % \end{macro}
604 % \end{macro}
605 %
606 % \begin{macro}{\ifST@star}
607 % This switch is used in the internal macros to remember which
608 % kind of environment was started.
609 % \begin{macrocode}
610 \newif\ifST@star
611 % \end{macrocode}
612 % \end{macro}
613 %
614 % \begin{macro}{\ifST@mp}
615 % This flag is used in the internal macros to remember if the
616 % tabular is to be put in a minipage.
617 % \changes{v2}{1997/11/30}{Added ifST@mp}
618 % \begin{macrocode}
619 \newif\ifST@mp
620 % \end{macrocode}
621 % \end{macro}
622 %
623 % \begin{macro}{\ST@wd}
624 % For the \Lenv{supertabular*} environment it is necessary to
625 % store the intended width of the tabular.
626 % \begin{macrocode}
627 \newdimen\ST@wd
628 % \end{macrocode}
629 % \end{macro}
630 %
631 % \begin{macro}{\ST@rightskip}
632 % \begin{macro}{\ST@leftskip}
633 % \begin{macro}{\ST@parfillskip}
634 % For the \Lenv{mpsupertabular} environments we need special versions
635 % of |\leftskip|, |\rightskip| and |\parfillskip|.
636 % \changes{v2}{1997/11/30}{Added ST@rightskip, ST@leftskip and ST@parfillskip}
637 % \begin{macrocode}
638 \newskip\ST@rightskip
639 \newskip\ST@leftskip
640 \newskip\ST@parfillskip
641 % \end{macrocode}
642 % \end{macro}
643 % \end{macro}
644 % \end{macro}
645 %
646 % \begin{macro}{\@initisotab}
647 % Required for ISO class, and check if class loaded.
648 % \changes{v2.2a}{2000/02/15}{Added \cs{@initisotab} command}
649 % \begin{macrocode}
650 \@ifundefined{@initisotab}{%
651 \newcommand{\@initisotab}{}%
652 \newif\ifinfloat}{\typeout{xtab using iso captions}}
653 % \end{macrocode}
654 % \end{macro}
655 %
656 % \begin{macro}{\ST@caption}
657 % This is a redefinition of LaTeX's |\@caption|, |\@makecaption| is
658 % called within a group so as not to return to |\normalsize|
659 % globally. In the original a fix was made for the `feature' of the
660 % |\@makecaption| of \file{article.sty} and friends that a caption
661 % \emph{always} gets a |\vskip 10pt| at the top and \emph{none}
662 % at the bottom; if a user
663 % wants to precede his table with a caption this results in a
664 % collision. This fix is not implemented here as I think it should
665 % be done by the user modifying |\beforecaptionskip| and |\aftercaptionskip|.
666 %
667 % \emph{Extension:} The ISO captioning is also initialised.
668 %
669 % \begin{macrocode}
670 \long\def\ST@caption#1[#2]#3{\par%
671 \@initisotab
672 \addcontentsline{\csname ext@#1\endcsname}{#1}%
673 {\protect\numberline{%
674 \csname the#1\endcsname}{\ignorespaces #2}}%
675 \begingroup
676 \@parboxrestore
677 \normalsize
678 %% \if@topcaption \vskip -10\p@ \fi
679 \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces #3}\par
680 %% \if@topcaption \vskip 10\p@ \fi
681 \endgroup
682 % \end{macrocode}
683 % \emph{Extension:} The height of the caption is subtracted from the available
684 % space on the page.
685 % \changes{v2.3}{2000/04/09}{Subtracted caption height from available space in
686 % \cs{ST@caption} }
687 % \begin{macrocode}
688 \global\advance\ST@pageleft -\PWSTcapht
689 \ST@trace\tw@{Added caption. Space left for xtabular: \the\ST@pageleft}}
690 % \end{macrocode}
691 % \end{macro}
692 %
693 % \begin{macro}{\tablehead}
694 % \begin{macro}{\tablefirsthead}
695 %
696 % |\tablehead| activates the new tabular |\cr| commands.
697 % \changes{v2}{1997/11/30}{Using version 4.1b of tablehead}
698 % \begin{macrocode}
699 \newcommand\tablehead[1]{%
700 \gdef\@tablehead{%
701 \noalign{%
702 \global\let\@savcr=\\%
703 \global\let\\=\org@tabularcr}%
704 #1%
705 \noalign{\global\let\\=\@savcr}}}
706 \tablehead{}
707 \newcommand\tablefirsthead[1]{\gdef\@table@first@head{#1}}
708 % \end{macrocode}
709 % \end{macro}
710 % \end{macro}
711 %
712 % \begin{macro}{\c@PWSTtable}
713 % \begin{macro}{\PWSTlastpage}
714 % \begin{macro}{\PWSTcurpage}
715 % \begin{macro}{\PWSTpenultimate}
716 % \begin{macro}{\PWSTtempc}
717 % \begin{macro}{\PWSTlines}
718 % \begin{macro}{\PWSThead}
719 % \begin{macro}{\PWSTlasthead}
720 % \emph{Extension:} These are counters for the supertabular extension.
721 % \Lcount{c@PWSTtable}
722 % counts the number of supertabulars in case one or more are not captioned.
723 % \Lcount{PWSTlastpage} is a counter holding the number of pages that a
724 % supertabular uses and \Lcount{PWSTpenultimate} is the penultimate page.
725 % \Lcount{PWSTcurpage} counts the current number
726 % of supertabular pages processed. \Lcount{PWSTtempc} is a scratch
727 % counter for page processing.
728 % \changes{v2}{1997/11/30}{Changed PWSToldpages to PWSTlastpage}
729 % \changes{v2}{1997/11/30}{Added counters PWSTpenultimate, PWSTlines, PWSThead and PWSTlasthead}
730 % \begin{macrocode}
731 \newcounter{PWSTtable}
732 \newcount\PWSTlastpage
733 \newcount\PWSTpenultimate
734 \newcount\PWSTcurpage
735 \newcount\PWSTtempc
736 % \end{macrocode}
737 % \emph{Extension:} \Lcount{PWSTlines} is used to count the number of
738 % supertabular entry
739 % lines on a page. Estimates of the number of lines in the normal table
740 % heading is held by \Lcount{PWSThead}, and similarly \Lcount{PWSTlasthead}
741 % is for the number of lines in the last heading.
742 % \begin{macrocode}
743 \newcount\PWSTlines
744 %%% \newcount\PWSThead
745 %%% \newcount\PWSTlasthead
746 % \end{macrocode}
747 % \end{macro}
748 % \end{macro}
749 % \end{macro}
750 % \end{macro}
751 % \end{macro}
752 % \end{macro}
753 % \end{macro}
754 % \end{macro}
755 %
756 % \begin{macro}{\iffirstcall}
757 % \emph{Extension:} This is used by the extension code to flag if the presumed last
758 % page overflows. If overflow occurs, then |firstcall| is set to false.
759 % \changes{v2}{1997/11/30}{Added iffirstcall}
760 % \begin{macrocode}
761 \newif\iffirstcall
762 % \end{macrocode}
763 % \end{macro}
764 %
765 % \begin{macro}{\PWST@lastht}
766 % \begin{macro}{\PWST@generalht}
767 % \begin{macro}{\PWST@ht}
768 % \emph{Extension:} The estimated height of a table header and tail (i.e., the height of
769 % an empty table) for the last page of a supertabular is stored in
770 % |\PWSTlastht|. Similarly, the corresponding height of an empty table on
771 % a general page (neither the first nor the last) is stored in
772 % |\PWSTgeneralht|. |\PWST@ht| is a scratch variable.
773 % \changes{v2}{1997/11/30}{Added PWST@generalht, PWST@lastht and PWST@ht}
774 % \begin{macrocode}
775 \newdimen\PWST@lastht
776 \newdimen\PWST@generalht
777 \newdimen\PWST@ht
778 % \end{macrocode}
779 % \end{macro}
780 % \end{macro}
781 % \end{macro}
782 %
783 % \begin{macro}{\tablelasthead}
784 % \begin{macro}{\@table@last@head}
785 % \begin{macro}{\notablelasthead}
786 % \emph{Extension:} |\tablelasthead| is the extension user command
787 % to specify the heading for
788 % the last page of a supertabular. The command |\notablelasthead|
789 % switches off the last heading. This has to be used if a last headed
790 % table precedes one that does not have a special last head.
791 % \begin{macrocode}
792 \newcommand{\tablelasthead}[1]{\gdef\@table@last@head{#1}}
793 \newcommand{\notablelasthead}{\let\@table@last@head\relax}
794 % \end{macrocode}
795 % Now initialize these commands.
796 % \begin{macrocode}
797 \tablelasthead{}
798 \notablelasthead
799 % \end{macrocode}
800 % \end{macro}
801 % \end{macro}
802 % \end{macro}
803 %
804 % \begin{macro}{\tabletail}
805 % \begin{macro}{\tablelasttail}
806 % |\tabletail| is the user command to specify the appearance of
807 % the bottom of each tabular on a page. Special treatment is
808 % given to the end of the supertabular via the |\tablelasttail|
809 % command.
810 %
811 % If the user uses an extra amount of tabular-data (like
812 % |\multicolumn|) in |\tabletail| \TeX\ starts looping because of
813 % the definition of |\nextline|. So make |\\| act like just a |\cr|
814 % inside this tail to prevent the loop. Save and restore the value
815 % of |\\|
816 %
817 % \changes{v2}{1997/11/30}{tabletail revised to 4.1b version}
818 % \changes{v2.1}{1998/4/13}{Added initialization of tablelasttail}
819 % \begin{macrocode}
820 \newcommand\tabletail[1]{%
821 \gdef\@tabletail{%
822 \noalign{%
823 \global\let\@savcr=\\%
824 \global\let\\=\org@tabularcr}%
825 #1%
826 \noalign{\global\let\\=\@savcr}}}
827 \tabletail{}
828 \newcommand\tablelasttail[1]{\gdef\@table@last@tail{#1}}
829 \tablelasttail{}
830 % \end{macrocode}
831 % \end{macro}
832 % \end{macro}
833 %
834 % \begin{macro}{\sttraceon}
835 % \begin{macro}{\sttraceoff}
836 % The original supertabular included a tracing mechanism to
837 % follow the decisions supertabular made about page breaking.
838 % This is now also used as a debugging mechanism for the
839 % extension.
840 %
841 % \changes{v2}{1997/11/30}{Tracing revised}
842 % \begin{macrocode}
843 \newcommand\sttraceon{\c@tracingst5\relax}
844 \newcommand\sttraceoff{\c@tracingst\z@}
845 % \end{macrocode}
846 % \end{macro}
847 % \end{macro}
848 %
849 % \begin{macro}{\ST@trace}
850 % A macro that gets the trace message as its argument
851 % \changes{v2}{1997/11/30}{ST@trace revised to version 4.1b}
852 % \begin{macrocode}
853 \newcommand\ST@trace[2]{%
854 \ifnum\c@tracingst>#1\relax
855 \GenericWarning{(xtab)\@spaces\@spaces}{Package xtab: #2}%
856 \fi}
857 % \end{macrocode}
858 % \end{macro}
859 %
860 % \begin{macro}{\ST@pageleft}
861 % This register holds the estimate of the amount of space left over
862 % on the current page. This is used in the decision when to start a
863 % new page.
864 % \begin{macrocode}
865 \newdimen\ST@pageleft
866 % \end{macrocode}
867 % \end{macro}
868 %
869 % \begin{macro}{\shrinkheight}
870 % \begin{macro}{\setSTheight}
871 % |\shrinkheight| is a command to diminish the value of
872 % |\ST@pageleft| if necessary.
873 %
874 % |\setSTheight| sets the value of |\ST@pageleft| if necessary.
875 %
876 % \changes{v2}{1997/30/11}{Added shrinkheight and setSTheight commands}
877 % \begin{macrocode}
878 \newcommand*\shrinkheight[1]{%
879 \noalign{\global\advance\ST@pageleft-#1\relax}}
880 \newcommand*\setSTheight[1]{%
881 \noalign{\global\ST@pageleft=#1\relax}}
882 % \end{macrocode}
883 % \end{macro}
884 % \end{macro}
885 %
886 % \begin{macro}{\xentrystretch}
887 % \begin{macro}{\PWST@xentrystretch}
888 % \emph{Extension:} Provide a user and internal command for fudging
889 % the estimated space taken by a table entry. Initialise to 10\% increase.
890 % \changes{v2.3}{2000/04/09}{Added \cs{xentrystretch} command}
891 % \begin{macrocode}
892 \newcommand{\xentrystretch}[1]{\def\PWST@xentrystretch{#1}}
893 \xentrystretch{0.1}
894 % \end{macrocode}
895 % \end{macro}
896 % \end{macro}
897 %
898 %
899 % \begin{macro}{\ST@headht}
900 % \begin{macro}{\ST@tailht}
901 % The register |\ST@headht| holds the height of the first head of
902 % a \Lenv{supertabular}. The register |\ST@tailht| holds the
903 % height of the tail.
904 %
905 % \changes{v2}{1997/11/30}{ST@heightht and ST@tailht defined}
906 % \begin{macrocode}
907 \newdimen\ST@headht
908 \newdimen\ST@tailht
909 % \end{macrocode}
910 % \end{macro}
911 % \end{macro}
912 %
913 % \begin{macro}{\ST@pagesofar}
914 % Register |\ST@pagesofar| stores the estimate of the amount of the
915 % page already filled up.
916 % \begin{macrocode}
917 \newdimen\ST@pagesofar
918 % \end{macrocode}
919 % \end{macro}
920 %
921 % \begin{macro}{\ST@pboxht}
922 % The measured (total) height of a parbox argument.
923 % \begin{macrocode}
924 \newdimen\ST@pboxht
925 % \end{macrocode}
926 % \end{macro}
927 %
928 % \begin{macro}{\ST@lineht}
929 % \begin{macro}{\ST@stretchht}
930 % \begin{macro}{\ST@prevht}
931 % The estimated height of a normal line is stored in |\ST@lineht|.
932 % The register |\ST@stretchht| is used to store the difference
933 % between the normal line height and the line height when |\arraystretch|
934 % has a non-standard value. This is used in the case when p-box
935 % entries are added to the tabular. |\ST@prevht| stores the height
936 % of the previous line to use it as an estimate for the height
937 % of the next line. This is needed for a better estimate of when to
938 % break the tabular.
939 % \begin{macrocode}
940 \newdimen\ST@lineht
941 \newdimen\ST@stretchht
942 \newdimen\ST@prevht
943 % \end{macrocode}
944 % \end{macro}
945 % \end{macro}
946 % \end{macro}
947 %
948 % \begin{macro}{\ST@toadd}
949 % When a tabular row is ended with |\\[...]| we need to temporarily
950 % store the optional argument in |\ST@toadd|.
951 % \begin{macrocode}
952 \newdimen\ST@toadd
953 % \end{macrocode}
954 % \end{macro}
955 %
956 % \begin{macro}{\ST@dimen}
957 % A private scratch dimension register.
958 % \begin{macrocode}
959 \newdimen\ST@dimen
960 % \end{macrocode}
961 % \end{macro}
962 %
963 % \begin{macro}{\ST@pbox}
964 % A box register to store the contents of a parbox.
965 % \begin{macrocode}
966 \newbox\ST@pbox
967
968 % \end{macrocode}
969 % \end{macro}
970 %
971 %
972 % \begin{macro}{\ST@tabularcr}
973 % \begin{macro}{\ST@xtabularcr}
974 % \begin{macro}{\ST@argtabularcr}
975 % These are redefinitions of |\@tabularcr| and |\@xtabularcr|. This
976 % is needed to include |\ST@cr| in the definition of
977 % |\@xtabularcr|.
978 %
979 % All redefined macros have names that are similar to the original
980 % names, except with a leading `ST'.
981 % \changes{v2.3e}{2010/02/06}{Allow calc use.}
982 % \begin{macrocode}
983 \def\ST@tabularcr{%
984 {\ifnum0=`}\fi
985 \@ifstar{\ST@xtabularcr}{\ST@xtabularcr}}
986 \def\ST@xtabularcr{%
987 \@ifnextchar[%]
988 {\ST@argtabularcr}%
989 {\ifnum0=`{\fi}\cr\ST@cr}}
990 \def\ST@argtabularcr[#1]{%
991 \ifnum0=`{\fi}%
992 \setlength\@tempdima{#1}%
993 \ifdim \@tempdima>\z@
994 \unskip\ST@xargarraycr{#1}%
995 \else
996 \ST@yargarraycr{#1}%
997 \fi}
998 % \end{macrocode}
999 % \end{macro}
1000 % \end{macro}
1001 % \end{macro}
1002 %
1003 %
1004 % \begin{macro}{\ST@xargarraycr}
1005 % \begin{macro}{\ST@yargarraycr}
1006 % \changes{v2.3e}{2010/02/06}{Allow calc use.}
1007 % In this case we need to copy the value of the optional argument
1008 % of |\\| in our private register |\ST@toadd|.
1009 % \begin{macrocode}
1010 \def\ST@xargarraycr#1{%
1011 \setlength\@tempdima{#1}%
1012 \advance\@tempdima \dp \@arstrutbox
1013 \vrule \@height\z@ \@depth\@tempdima \@width\z@ \cr
1014 \noalign{\setlength{\global\ST@toadd}{#1}}\ST@cr
1015 }
1016 % \end{macrocode}
1017 %
1018 % Here we need to insert |\ST@cr|
1019 % \begin{macrocode}
1020 \def\ST@yargarraycr#1{%
1021 \cr\noalign{%
1022 \setlength{\global\ST@toadd}{#1}%
1023 \vskip\ST@toadd
1024 }\ST@cr
1025 }
1026 % \end{macrocode}
1027 % \end{macro}
1028 % \end{macro}
1029 %
1030 % \begin{macro}{\ST@startpbox}
1031 % The macros that deal with parbox columns need to be redefined,
1032 % because we need to know the size of the parbox.
1033 % \changes{v2}{1997/11/30}{ST@startpbox changed to 4.1b version}
1034 % \changes{v2.3b}{2007/03/24}{Added \cs{setlength} to \cs{ST@startpbox} and
1035 % \cs{ST@astartpbox} (courtesy of Heiko Oberdiek)}
1036 % \begin{macrocode}
1037 \def\ST@startpbox#1{%
1038 % \end{macrocode}
1039 % To achieve our goal we need to save the text in box.
1040 % \begin{macrocode}
1041 %%%% \setbox\ST@pbox\vtop\bgroup\hsize#1\@arrayparboxrestore}
1042 \setbox\ST@pbox\vtop\bgroup\setlength\hsize{#1}\@arrayparboxrestore}
1043 % \end{macrocode}
1044 % \end{macro}
1045 %
1046 % \begin{macro}{\ST@astartpbox}
1047 % \changes{v2.3e}{2010/02/06}{Allow calc use.}
1048 % supertabular version of |\@astartpbox|.
1049 % \begin{macrocode}
1050 \def\ST@astartpbox#1{%
1051 \bgroup\setlength\hsize{#1}%
1052 %%%% \setbox\ST@pbox\vtop\bgroup\hsize#1\@arrayparboxrestore}
1053 \setbox\ST@pbox\vtop\bgroup\setlength\hsize{#1}\@arrayparboxrestore}
1054 % \end{macrocode}
1055 % \end{macro}
1056 %
1057 % \begin{macro}{\ST@endpbox}
1058 % \begin{macro}{\ST@aendpbox}
1059 % supertabular versions of |\@endpbox| and |\@aendpbox|.
1060 % \begin{macrocode}
1061 \def\ST@endpbox{%
1062 \@finalstrut\@arstrutbox\par\egroup
1063 \ST@dimen=\ht\ST@pbox
1064 \advance\ST@dimen by \dp\ST@pbox
1065 \ifnum\ST@pboxht<\ST@dimen
1066 \global\ST@pboxht=\ST@dimen
1067 \fi
1068 \ST@dimen=\z@
1069 \box\ST@pbox\hfil}
1070 \def\ST@aendpbox{%
1071 \@finalstrut\@arstrutbox\par\egroup
1072 \ST@dimen=\ht\ST@pbox
1073 \advance\ST@dimen by \dp\ST@pbox
1074 \ifnum\ST@pboxht<\ST@dimen
1075 \global\ST@pboxht=\ST@dimen
1076 \fi
1077 \ST@dimen=\z@
1078 \unvbox\ST@pbox\egroup\hfil}
1079 % \end{macrocode}
1080 % \end{macro}
1081 % \end{macro}
1082 %
1083 %
1084 % \begin{macro}{\estimate@lineht}
1085 % Estimates the height of normal line taking |\arraystretch| into
1086 % account. Also computes the difference between a `normal' line
1087 % and a stretched one.
1088 % \changes{v2.3}{2000/04/09}{Added fudge to \cs{estimate@lineht} }
1089 % \begin{macrocode}
1090 \def\estimate@lineht{%
1091 \ST@lineht=\arraystretch \baselineskip
1092 \global\advance\ST@lineht by 1\p@
1093 \ST@stretchht\ST@lineht\advance\ST@stretchht-\baselineskip
1094 \ifdim\ST@stretchht<\z@\ST@stretchht\z@\fi
1095 \ST@trace\tw@{Basic line height: \the\ST@lineht\MessageBreak%
1096 Arrayed line height: \the\ST@stretchht}%
1097 \global\advance\ST@lineht \PWST@xentrystretch\ST@lineht
1098 \ST@trace\tw@{Stretched line height: \the\ST@lineht}}
1099 % \end{macrocode}
1100 % \end{macro}
1101 %
1102 % \begin{macro}{\@calfirstpageht}
1103 % Estimates the space left on the current page and decides whether
1104 % the tabular can be started on this page or on a new page. Aspects
1105 % of the original code are modified for the extension.
1106 % \begin{macrocode}
1107 \def\@calfirstpageht{%
1108 \ST@trace\tw@{Calculating height of xtabular on first page}%
1109 % \end{macrocode}
1110 % The \TeX{} register |\pagetotal| contains the height of the page
1111 % sofar, the \LaTeX{} register |\@colroom| contains the height of
1112 % the column.
1113 % \begin{macrocode}
1114 \global\ST@pagesofar\pagetotal
1115 \global\ST@pageleft\@colroom
1116 \ST@trace\tw@{Height of previous text = \the\pagetotal; \MessageBreak
1117 Height of column = \the\ST@pageleft}%
1118 % \end{macrocode}
1119 % When we are in twocolumn mode \TeX{} may still be collecting
1120 % material for the first column although there seems to be no space
1121 % left. In this case we have to check against two times |\ST@pageleft|.
1122 % \begin{macrocode}
1123 \if@twocolumn
1124 \ST@trace\tw@{two column mode}%
1125 \if@firstcolumn
1126 \ST@trace\tw@{First column}%
1127 \ifnum\ST@pagesofar > \ST@pageleft
1128 \global\ST@pageleft=2\ST@pageleft
1129 \ifnum\ST@pagesofar > \ST@pageleft
1130 \newpage\@calnextpageht
1131 \ST@trace\tw@{starting new page}%
1132 \else
1133 % \end{macrocode}
1134 % In this case we're in the second column, so we have to compensate
1135 % for the material in the first column.
1136 % \begin{macrocode}
1137 \ST@trace\tw@{Second column}%
1138 \global\advance\ST@pageleft -\ST@pagesofar
1139 \global\advance\ST@pageleft -\@colroom
1140 \fi
1141 % \end{macrocode}
1142 % When |\ST@pagesofar| is smaller than |\ST@pageleft| \TeX{} is still
1143 % collecting material for the first column, so we can start a new
1144 % tabular environment like we do on a single column page.
1145 % \begin{macrocode}
1146 \else
1147 \global\advance\ST@pageleft by -\ST@pagesofar
1148 \global\ST@pagesofar\z@
1149 \fi
1150 \else
1151 % \end{macrocode}
1152 % When we end up here, \TeX{} has already decided it had enough
1153 % material for the first column and is building the second column.
1154 % \begin{macrocode}
1155 \ST@trace\tw@{Second column}%
1156 \ifnum\ST@pagesofar > \ST@pageleft
1157 \ST@trace\tw@{starting new page}%
1158 \newpage\@calnextpageht
1159 \else
1160 \global\advance\ST@pageleft by -\ST@pagesofar
1161 \global\ST@pagesofar\z@
1162 \fi
1163 \fi
1164 \else
1165 % \end{macrocode}
1166 % In one column mode there is a simple decision.
1167 % \begin{macrocode}
1168 \ST@trace\tw@{one column mode}%
1169 \ifnum\ST@pagesofar > \ST@pageleft
1170 \ST@trace\tw@{starting new page}%
1171 \newpage\@calnextpageht
1172 % \end{macrocode}
1173 % When we are not starting a new page subtract the size of the
1174 % material already on it from the available space.
1175 % \begin{macrocode}
1176 \else
1177 \global\advance\ST@pageleft by -\ST@pagesofar
1178 \global\ST@pagesofar\z@
1179 \fi
1180 \fi
1181 \ST@trace\tw@{Available height: \the\ST@pageleft}%
1182 % \end{macrocode}
1183 % Now we need to know the height of the head of the table. In order
1184 % to measure this we typeset it in a normal \Lenv{tabular} environment.
1185 % \begin{macrocode}
1186 \ifx\@@tablehead\@empty
1187 \ST@headht=\z@
1188 \else
1189 \setbox\@tempboxa=\vbox{\@arrayparboxrestore
1190 \ST@restore
1191 \expandafter\tabular\expandafter{\ST@tableformat}%
1192 \@@tablehead\endtabular}%
1193 \ST@headht=\ht\@tempboxa\advance\ST@headht\dp\@tempboxa
1194 \fi
1195 \ST@trace\tw@{Height of head: \the\ST@headht}%
1196 % \end{macrocode}
1197 % To decide when to start a new page, we need to know the vertical
1198 % size of the tail of the table.
1199 % \begin{macrocode}
1200 \ifx\@tabletail\@empty
1201 \ST@tailht=\z@
1202 \else
1203 \setbox\@tempboxa=\vbox{\@arrayparboxrestore
1204 \ST@restore
1205 \expandafter\tabular\expandafter{\ST@tableformat}%
1206 \@tabletail\endtabular}%
1207 \ST@tailht=\ht\@tempboxa\advance\ST@tailht\dp\@tempboxa
1208 \fi
1209 % \end{macrocode}
1210 % We add the average height of a line to this because when we
1211 % decide to continue the tabular we need to have enough space left
1212 % for one line and the tail.
1213 % \begin{macrocode}
1214 \advance\ST@tailht by \ST@lineht
1215 \ST@trace\tw@{Height of tail: \the\ST@tailht}%
1216 % \end{macrocode}
1217 % \begin{macrocode}
1218 \ST@trace\tw@{Maximum space for xtabular: \the\ST@pageleft}%
1219 % \end{macrocode}
1220 % Now we decide whether we can continue on the current page or
1221 % whether we need to start a new page. We assume that the minimum
1222 % height of a tabular is the height of the head and tail and one line
1223 % of data. If that doesn't fit, start a new page.
1224 % \begin{macrocode}
1225 \@tempdima\ST@headht
1226 \advance\@tempdima\ST@lineht
1227 \advance\@tempdima\ST@tailht
1228 % \end{macrocode}
1229 % \emph{Extension:} I also add the height of the caption to the required
1230 % space. The amount to be added depends on whether it is a top or bottom
1231 % caption. Allowance is also made for skips around the caption.
1232 % \begin{macrocode}
1233 \if@topcaption
1234 \setbox\@tempboxa=\vbox{\PWST@thecaption}%
1235 \PWSTcapht=\ht\@tempboxa\advance\PWSTcapht\dp\@tempboxa
1236 \advance\PWSTcapht by 20\p@
1237 \else
1238 \PWSTcapht = 10\p@
1239 \fi
1240 \ST@trace\tw@{Caption height: \the\PWSTcapht}%
1241 \advance\@tempdima\PWSTcapht
1242 % \end{macrocode}
1243 % Continue with the original code.
1244 % \begin{macrocode}
1245 \ST@trace\tw@{Minimum height of xtabular: \the\@tempdima}%
1246 \ifnum\@tempdima>\ST@pageleft
1247 \ST@trace\tw@{starting new page}%
1248 % \end{macrocode}
1249 % \emph{Extension:} The next line in the original code is
1250 % |\newpage\@calnextpageht|. I need to start a new page, making allowance
1251 % for the space required by the caption.
1252 % \begin{macrocode}
1253 \newpage
1254 \global\ST@pageleft\@colroom
1255 \global\advance\ST@pageleft by -\PWSTcapht
1256 \global\ST@pagesofar=\z@
1257 % \end{macrocode}
1258 % Finish up with the original code.
1259 % \begin{macrocode}
1260 \fi} % end \@calfirstpageheight
1261
1262 % \end{macrocode}
1263 % \end{macro}
1264 %
1265 % \begin{macro}{\@calnextpageht}
1266 % This calculates the maximum height of the tabular on all
1267 % subsequent pages of the supertabular environment.
1268 % \begin{macrocode}
1269 \def\@calnextpageht{%
1270 \ST@trace\tw@{Calculating height of xtabular on next page}%
1271 \global\ST@pageleft\@colroom
1272 \global\ST@pagesofar=\z@
1273 \ST@trace\tw@{Maximum space for xtabular: \the\ST@pageleft}}
1274 % \end{macrocode}
1275 % \end{macro}
1276 %
1277 % \begin{macro}{\PWSTcalchtlines}
1278 % \emph{Extension:} A macro to calculate the space required by an empty table
1279 % and the number of lines in an empty table.
1280 % \changes{v2.3}{2000/04/09}{Don't calculate number of head/tail lines}
1281 %
1282 % The appropriate heads and tails are typeset in a temporary box
1283 % so we can measure them.
1284 % \changes{v2}{1997/11/30}{Added PWSTcalchtlines routine}
1285 % \begin{macrocode}
1286 \newcommand{\PWSTcalchtlines}{%
1287 % \end{macrocode}
1288 % Measure the lasttail.
1289 % \begin{macrocode}
1290 \setbox\@tempboxa=\vbox{\@arrayparboxrestore
1291 \ST@restore
1292 \expandafter\tabular\expandafter{\ST@tableformat}%
1293 \@table@last@tail\endtabular}%
1294 \PWST@ht=\ht\@tempboxa\advance\PWST@ht\dp\@tempboxa
1295 \global\PWST@lastht = \PWST@ht
1296 % \end{macrocode}
1297 % And repeat for the lasthead.
1298 % \begin{macrocode}
1299 \setbox\@tempboxa=\vbox{\@arrayparboxrestore
1300 \ST@restore
1301 \expandafter\tabular\expandafter{\ST@tableformat}%
1302 \@table@last@head\endtabular}%
1303 \PWST@ht = \ht\@tempboxa\advance\PWST@ht\dp\@tempboxa
1304 \global\advance\PWST@lastht by \PWST@ht
1305 \ST@trace\tw@{Height of empty xtabular on last page = \the\PWST@lastht}%
1306 % \end{macrocode}
1307 % Now repeat pretty well all of the above for a general table (i.e.,
1308 % one that is not on the first page nor the designated last page).
1309 %
1310 % First the tail.
1311 % \begin{macrocode}
1312 \setbox\@tempboxa=\vbox{\@arrayparboxrestore
1313 \ST@restore
1314 \expandafter\tabular\expandafter{\ST@tableformat}%
1315 \@tabletail\endtabular}%
1316 \PWST@ht=\ht\@tempboxa\advance\PWST@ht\dp\@tempboxa
1317 \global\PWST@generalht = \PWST@ht
1318 % \end{macrocode}
1319 % And on to the general head.
1320 % \begin{macrocode}
1321 \setbox\@tempboxa=\vbox{\@arrayparboxrestore
1322 \ST@restore
1323 \expandafter\tabular\expandafter{\ST@tableformat}%
1324 \@tablehead\endtabular}%
1325 \PWST@ht = \ht\@tempboxa\advance\PWST@ht\dp\@tempboxa
1326 \global\advance\PWST@generalht by \PWST@ht}
1327 % \end{macrocode}
1328 % \end{macro}
1329 %
1330 % \begin{macro}{\PWSTcalnextpageht}
1331 % \emph{Extension:} From some experiments that I ran it appeared as
1332 % though the \Lpack{supertabular} package ignored the
1333 % possibility that the
1334 % space required for the table header and tail on pages after the
1335 % first one might be different. If the subsequent head/tail combination
1336 % were longer (i.e., took more vertical space) then the table could
1337 % overflow the page. This is an attempt to fix this problem by
1338 % calculating the actual minimum space required after the first page.
1339 %
1340 % The calculations are similar to, but simpler, than those for
1341 % |\@calfirstpageht|.
1342 % \changes{v2}{1997/11/30}{Added PWSTcalnextpageht routine}
1343 % \begin{macrocode}
1344 \newcommand{\PWSTcalnextpageht}{%
1345 \ifnum\PWSTcurpage = \PWSTpenultimate
1346 \ST@trace\tw@{Calculating height of xtabular on last page}%
1347 % \end{macrocode}
1348 % We are on the penultimate page, so get the height of the
1349 % last head/tail.
1350 % \begin{macrocode}
1351 \PWST@ht=\PWST@lastht
1352 % \end{macrocode}
1353 % Otherwise I need the general page data.
1354 % \begin{macrocode}
1355 \else
1356 \ST@trace\tw@{Calculating height of xtabular on next general page}%
1357 \PWST@ht=\PWST@generalht
1358 \fi
1359 % \end{macrocode}
1360 % Having dealt with the two cases, I can now calculate the minimum
1361 % space for a supertabular on the following page.
1362 % \begin{macrocode}
1363 \global\ST@pageleft\@colroom
1364 \global\advance\ST@pageleft -\PWST@ht
1365 \global\ST@pagesofar=\z@
1366 \ST@trace\tw@{Available space for xtabular: \the\ST@pageleft}}
1367 % \end{macrocode}
1368 % \end{macro}
1369 %
1370 % \begin{macro}{\x@supertabular}
1371 % The various supertabular environments share a lot of code. Thus,
1372 % to avoid needless repetition, the shared code is defined
1373 % in this macro.
1374 %
1375 % This macro has been modified as part of the supertabular extension.
1376 % \begin{macrocode}
1377 \def\x@supertabular{%
1378 % \end{macrocode}
1379 % First save the original definition of |\tabular| and then make it
1380 % point to |\inner@tabular|. This is done to enable supertabular
1381 % cells to contain a \Lenv{tabular} environment without getting
1382 % unexpected results when the \Lenv{supertabular} would be split
1383 % across this inner \Lenv{tabular} environment.
1384 % \begin{macrocode}
1385 \let\org@tabular\tabular
1386 \let\tabular\inner@tabular
1387 % \end{macrocode}
1388 % The same has to be done for the \Lenv{tabular*} environment. The
1389 % coding is more verbose.
1390 % \begin{macrocode}
1391 \expandafter\let
1392 \csname org@tabular*\expandafter\endcsname
1393 \csname tabular*\endcsname
1394 \expandafter\let\csname tabular*\expandafter\endcsname
1395 \csname inner@tabular*\endcsname
1396 % \end{macrocode}
1397 % \emph{Extension:} The original code printed out the top caption
1398 % at this point. If there is too little space on the first page of
1399 % the table, the tabular data is printed on the following page.
1400 % If this is the case (and its not known yet whether it is), then
1401 % the caption should also be printed on the following page.
1402 % \begin{macrocode}
1403 %%%% \if@topcaption \@process@tablecaption \fi
1404 % \end{macrocode}
1405 % Back to the original code. Save the original definition of |\\|.
1406 % \begin{macrocode}
1407 \global\let\@oldcr=\\%
1408 % \end{macrocode}
1409 % Save the current value of |\baselineskip|, as we need it in the
1410 % calculation of the average height of a line.
1411 % \begin{macrocode}
1412 \def\baslineskp{\baselineskip}%
1413 % \end{macrocode}
1414 % We have to check whether \texttt{array.sty} was loaded, because
1415 % some of the internal macros have different names.
1416 % \begin{macrocode}
1417 \ifx\undefined\@classix
1418 % \end{macrocode}
1419 % Save old |\@tabularcr| and insert the definition of
1420 % |\@stabularcr|.
1421 % \begin{macrocode}
1422 \let\org@tabularcr\@tabularcr
1423 \let\@tabularcr\ST@tabularcr
1424 % \end{macrocode}
1425 % Activate the new parbox algorithm.
1426 % \begin{macrocode}
1427 \let\org@startpbox=\@startpbox
1428 \let\org@endpbox=\@endpbox
1429 \let\@@startpbox=\ST@startpbox
1430 \let\@@endpbox=\ST@endpbox
1431 \else
1432 % \end{macrocode}
1433 % When \texttt{array.sty} was loaded things are a bit different.
1434 % \begin{macrocode}
1435 \let\org@tabularcr\@arraycr
1436 \let\@arraycr\ST@tabularcr
1437 \let\org@startpbox=\@startpbox
1438 \let\org@endpbox=\@endpbox
1439 \let\@startpbox=\ST@astartpbox
1440 \let\@endpbox=\ST@aendpbox
1441 \fi
1442 % \end{macrocode}
1443 %
1444 % Check if the head of the table should be different for the first
1445 % and subsequent pages.
1446 % \begin{macrocode}
1447 \ifx\@table@first@head\undefined
1448 \let\@@tablehead=\@tablehead
1449 \else
1450 \let\@@tablehead=\@table@first@head
1451 \fi
1452 % \end{macrocode}
1453 % The first part of a supertabular may be moved to the next page
1454 % if it doesn't fit on the current page. Subsequent parts can not
1455 % be moved; therefore we will have to switch the definition of
1456 % |\ST@skippart| around.
1457 % \begin{macrocode}
1458 \let\ST@skippage\ST@skipfirstpart
1459 % \end{macrocode}
1460 % Now we can estimate the average line height and the height
1461 % of the first page of the supertabular.
1462 % \begin{macrocode}
1463 \estimate@lineht
1464 \@calfirstpageht
1465 % \end{macrocode}
1466 % \emph{Extension:} Call the macro to initialize the extension code for
1467 % this table.
1468 % \begin{macrocode}
1469 \PWSTinit
1470 % \end{macrocode}
1471 % \emph{Extension:} At this point I know, and have adjusted for, the
1472 % page on which the first part of the table will be printed. It should now
1473 % be safe to print the top caption, if any. Unfortunately, in spite of
1474 % everthing, the \TeX{} page breaking
1475 % mechanism might still think that there is too little space left.
1476 % \begin{macrocode}
1477 \if@topcaption \@process@tablecaption \fi
1478 \noindent
1479 % \end{macrocode}
1480 % \emph{Extension:} Finally, subtract the space required by the header
1481 % and the tail (as these don't update the available space when output).
1482 % \changes{v2.3}{2000/04/09}{Subtracted head/tail space in \cs{x@supertabular} }
1483 % \begin{macrocode}
1484 \global\advance\ST@pageleft -\ST@headht%
1485 \ST@trace\tw@{Available space after accounting for header: \the\ST@pageleft}%
1486 \global\advance\ST@pageleft -\ST@tailht%
1487 \ST@trace\tw@{Available space after accounting for tail: \the\ST@pageleft}}
1488 % \end{macrocode}
1489 % \end{macro}
1490 %
1491 % \begin{macro}{\PWSTinit}
1492 % \emph{Extension:} This routine initialises the extension data.
1493 % \changes{v2}{1997/11/30}{Added PWSTinit routine}
1494 % \begin{macrocode}
1495 \newcommand{\PWSTinit}{%
1496 % \end{macrocode}
1497 % At the end of processing each supertabular (see later) the number of
1498 % pages consumed by the supertabular is written to the \file{.aux} file.
1499 % At the start of a supertabular, after incrementing the number of
1500 % supertabulars processed, the prior number of pages are read from
1501 % the file. These are stored in \Lcount{PWSTlastpage}.
1502 % \begin{macrocode}
1503 \global\advance\c@PWSTtable\@ne
1504 \global\expandafter\let\expandafter\PWSTtempc
1505 \csname PWST@\romannumeral\c@PWSTtable\endcsname
1506 % \end{macrocode}
1507 % I have to take account of the fact that there might be no entry in
1508 % the \file{.aux} file, and hence the lastpage number might not be set.
1509 % \begin{macrocode}
1510 \ifx\PWSTtempc\relax
1511 \ST@trace\tw@{Table \the\c@PWSTtable: Processing for the first time}%
1512 \PWSTlastpage=\@m% = 1000
1513 \else
1514 \PWSTlastpage=\PWSTtempc
1515 \fi
1516 \ST@trace\tw@{Table \the\c@PWSTtable: last page set to \the\PWSTlastpage}%
1517 % \end{macrocode}
1518 % Set the current page counter to unity.
1519 % \begin{macrocode}
1520 \PWSTcurpage=\@ne
1521 % \end{macrocode}
1522 % Perform the calculations for the empty table data.
1523 % \begin{macrocode}
1524 \PWSTcalchtlines
1525 % \end{macrocode}
1526 % Initialise the line counter and set |firstcall| to TRUE.
1527 % \begin{macrocode}
1528 \global\PWSTlines=\z@
1529 \global\firstcalltrue
1530 % \end{macrocode}
1531 % If we have the \file{iso} class, then I have to flag that we are
1532 % in a `float'.
1533 % \changes{v2}{1997/12/02}{Added setting of \cs{ifinfloat}}
1534 % \begin{macrocode}
1535 \infloattrue}
1536 % \end{macrocode}
1537 % \end{macro}
1538 %
1539 % \begin{macro}{\xtabular}
1540 % We start by looking for an optional argument, which will be duly
1541 % ignored as it seems to make no sense to try to align a multipage
1542 % table in the middle...
1543 %
1544 % \emph{Extension:} Use \Lenv{xtabular} instead of \Lenv{supertabular},
1545 % and similarly for the others, so this will
1546 % not be mentioned explicitly again.
1547 % \begin{macrocode}
1548 \def\xtabular{%
1549 \@ifnextchar[{\@supertabular}%]
1550 {\@supertabular[]}}
1551 % \end{macrocode}
1552 % \end{macro}
1553 %
1554 % \begin{macro}{\@supertabular}
1555 % We can now save the preamble of the tabular in a macro.
1556 % \begin{macrocode}
1557 \def\@supertabular[#1]#2{%
1558 \def\ST@tableformat{#2}%
1559 \ST@trace\tw@{Starting a new xtabular}%
1560 % \end{macrocode}
1561 % Then remember that this is not a \textsf{supertabular*}
1562 % environment.
1563 % \begin{macrocode}
1564 \global\ST@starfalse
1565 % \end{macrocode}
1566 % Don't use minipages.
1567 % \begin{macrocode}
1568 \global\ST@mpfalse
1569 % \end{macrocode}
1570 % Most of the following code is shared between the
1571 % \Lenv{supertabbular} and \Lenv{supertabular*} environments. So to
1572 % avoid duplication it is stored in a macro.
1573 % \begin{macrocode}
1574 \x@supertabular
1575 % \end{macrocode}
1576 % Finally start a normal \Lenv{tabular} environment.
1577 % \begin{macrocode}
1578 \expandafter\org@tabular\expandafter{\ST@tableformat}%
1579 \@@tablehead}
1580 % \end{macrocode}
1581 % \end{macro}
1582 %
1583 % \begin{macro}{\xtabular*}
1584 % We start by looking for the optional argument of the tabular
1585 % environment.
1586 % \begin{macrocode}
1587 \@namedef{xtabular*}#1{%
1588 \@ifnextchar[{\@nameuse{@supertabular*}{#1}}%
1589 {\@nameuse{@supertabular*}{#1}[]}%]
1590 }
1591 % \end{macrocode}
1592 % We start by saving the intended width and the preamble of the
1593 % \Lenv{tabular*}.
1594 % \begin{macrocode}
1595 \@namedef{@supertabular*}#1[#2]#3{%
1596 \ST@trace\tw@{Starting a new xtabular*}%
1597 \def\ST@tableformat{#3}%
1598 \ST@wd=#1\relax
1599 \global\ST@startrue
1600 \global\ST@mpfalse
1601 % \end{macrocode}
1602 % Now we can call the common code for both environments.
1603 % \begin{macrocode}
1604 \x@supertabular
1605 % \end{macrocode}
1606 % And we can start a normal \Lenv{tabular*} environment.
1607 % \begin{macrocode}
1608 \expandafter\csname org@tabular*\expandafter\endcsname
1609 \expandafter{\expandafter\ST@wd\expandafter}%
1610 \expandafter{\ST@tableformat}%
1611 \@@tablehead}
1612 % \end{macrocode}
1613 % \end{macro}
1614 %
1615 % \begin{macro}{\mpxtabular}
1616 % This version of the supertabular environment puts each tabular into
1617 % a minipage, thus making footnotes possible. We start by looking for
1618 % an optional argument, which will be ignored as it makes no sense
1619 % to try and align a multipage table in the middle\ldots
1620 % \changes{v2}{1997/11/30}{Added the mpsupertabular}
1621 % \begin{macrocode}
1622 \def\mpxtabular{%
1623 \@ifnextchar[{\@mpsupertabular}%]
1624 {\@mpsupertabular[]}}
1625 % \end{macrocode}
1626 %
1627 % We can now save the preamble in a macro.
1628 % \begin{macrocode}
1629 \def\@mpsupertabular[#1]#2{%
1630 \def\ST@tableformat{#2}%
1631 \ST@trace\tw@{Starting a new mpxtabular}%
1632 % \end{macrocode}
1633 % Remember that this is not a \Lenv{mpsupertabular*} environment
1634 % and also note we have to close the minipage later.
1635 % \begin{macrocode}
1636 \global\ST@starfalse
1637 \global\ST@mptrue
1638 % \end{macrocode}
1639 % Since we are about to start a minipage of |\columnwidth| the
1640 % horizontal alignment will not work. We have to remember the values
1641 % and then restore them inside the minipage.
1642 % \begin{macrocode}
1643 \ST@rightskip \rightskip
1644 \ST@leftskip \leftskip
1645 \ST@parfillskip \parfillskip
1646 % \end{macrocode}
1647 % Call the code that is common to all the environments.
1648 % \begin{macrocode}
1649 \x@supertabular
1650 % \end{macrocode}
1651 % Finally, start a normal \Lenv{tabular}
1652 % \begin{macrocode}
1653 \minipage{\columnwidth}%
1654 \parfillskip\ST@parfillskip
1655 \rightskip \ST@rightskip
1656 \leftskip \ST@leftskip
1657 \noindent\expandafter\org@tabular\expandafter{\ST@tableformat}%
1658 \@@tablehead}
1659
1660 % \end{macrocode}
1661 % \end{macro}
1662 %
1663 % \begin{macro}{\mpxtabular*}
1664 % We start by looking for the optional argument of the tabular environment.
1665 % \begin{macrocode}
1666 \@namedef{mpxtabular*}#1{%
1667 \@ifnextchar[{\@nameuse{@mpsupertabular*}{#1}}%
1668 {\@nameuse{@mpsupertabular*}{#1}[]}%]
1669 }
1670 % \end{macrocode}
1671 %
1672 % Now we can save the intended width and the preamble of
1673 % the \Lenv{tabular*}.
1674 % \begin{macrocode}
1675 \@namedef{@mpsupertabular*}#1[#2]#3{%
1676 \ST@trace\tw@{Starting a new mpxtabular*}%
1677 \def\ST@tableformat{#3}%
1678 \ST@wd=#1\relax
1679 \global\ST@startrue
1680 \global\ST@mptrue
1681 \ST@rightskip \rightskip
1682 \ST@leftskip \leftskip
1683 \ST@parfillskip \parfillskip
1684 % \end{macrocode}
1685 % Now is the time to call the common code for both environments.
1686 % \begin{macrocode}
1687 \x@supertabular
1688 % \end{macrocode}
1689 % And we can start a normal \Lenv{tabular*} environment.
1690 % \begin{macrocode}
1691 \minipage{\columnwidth}%
1692 \parfillskip\ST@parfillskip
1693 \rightskip \ST@rightskip
1694 \leftskip \ST@leftskip
1695 \noindent\expandafter\csname org@tabular*\expandafter\endcsname
1696 \expandafter{\expandafter\ST@wd\expandafter}%
1697 \expandafter{\ST@tableformat}%
1698 \@@tablehead}
1699 % \end{macrocode}
1700 % \end{macro}
1701 %
1702 % \begin{macro}{\endxtabular}
1703 % \begin{macro}{\endxtabular*}
1704 % These close the \Lenv{xtabular} and \Lenv{xtabular*}
1705 % environments.
1706 %
1707 % For the extension, this macro has been modified to write out
1708 % to the \file{.aux} file the
1709 % number of pages used for the supertabular.
1710 % \begin{macrocode}
1711 \def\endxtabular{%
1712 \ifx\@table@last@tail\undefined
1713 \@tabletail
1714 \else
1715 \@table@last@tail
1716 \fi
1717 \csname endtabular\ifST@star*\fi\endcsname
1718 % \end{macrocode}
1719 % While studying the original code to determine where additions were
1720 % needed for the extension, I realized that the last part of
1721 % the |\end...| code was common to all the environments. I have broken
1722 % it out into a seperate routine which also includes the modification
1723 % needed for the extension.
1724 % \begin{macrocode}
1725 \x@endsupertabular
1726 % \end{macrocode}
1727 % And back to the original code.
1728 % \begin{macrocode}
1729 \ST@trace\tw@{Ended a xtabular\ifST@star*\fi}}
1730 % \end{macrocode}
1731 %
1732 % The definition of the ending of the \Lenv{xtabular*}
1733 % environment is simple:
1734 % \begin{macrocode}
1735 \expandafter\let\csname endxtabular*\endcsname\endxtabular
1736 % \end{macrocode}
1737 % \end{macro}
1738 % \end{macro}
1739 %
1740 % \begin{macro}{\x@endsupertabular}
1741 % This macro contains the code that is common to all the |\end...|
1742 % commands. It includes the modification required for the extension.
1743 % \changes{v2}{1997/11/30}{Added x@endsupertabular routine}
1744 % \begin{macrocode}
1745 \newcommand{\x@endsupertabular}{%
1746 % \end{macrocode}
1747 % Restore the original definition of |\@tabularcr|
1748 % \begin{macrocode}
1749 \ST@restore
1750 % \end{macrocode}
1751 % Check if we have to insert a caption and restore to default
1752 % behaviour of putting captions at the top.
1753 % \begin{macrocode}
1754 \if@topcaption
1755 \else
1756 \@process@tablecaption
1757 \global\@topcaptiontrue
1758 \fi
1759 % \end{macrocode}
1760 % Restore the meaning of |\\| to the one it had before the start
1761 % of this environment. Also re-initialize some control-sequences
1762 % \begin{macrocode}
1763 \global\let\\=\@oldcr
1764 \global\let\@table@first@head\undefined
1765 %%% \global\let\@table@last@tail\undefined
1766 \global\let\@process@tablecaption\relax
1767 % \end{macrocode}
1768 % \emph{Extension:} For the extension, write the number of the last page
1769 % to the \file{.aux} file. Also, if we are in the \file{iso} class, reset
1770 % the `float' flag.
1771 % \changes{v2}{1997/12/02}{Added resetting of \cs{ifinfloat}}
1772 % \begin{macrocode}
1773 \PWSToplastpagenum
1774 \infloatfalse}
1775 % \end{macrocode}
1776 % \end{macro}
1777 %
1778 % \begin{macro}{\PWSToplastpagenum}
1779 % \emph{Extension:} This routine is responsible for writing the number of the
1780 % last page of the supertabular to the \file{.aux} file.
1781 %
1782 % What gets written is
1783 % |\PWST@vi{4}|, assuming that the value of \Lcount{c@PWSTtable} is 6
1784 % and the value of \Lcount{PWSTcurpage} is 4.
1785 % \changes{v2}{1997/11/30}{Added PWSToplastpagenum routine}
1786 % \changes{v2.3}{2000/04/09}{Just checked for number of entry lines in \cs{PWSToplastpagenum} }
1787 % \begin{macrocode}
1788 \newcommand{\PWSToplastpagenum}{%
1789 % \end{macrocode}
1790 % There are a number of cases to consider. The first decision is whether
1791 % the current page is the previously calculated last page.
1792 % \begin{macrocode}
1793 \ifnum\PWSTcurpage=\PWSTlastpage
1794 % \end{macrocode}
1795 % The current table ends on the calculated last page. There are four
1796 % cases to consider:
1797 % \begin{enumerate}
1798 % \item The table has not overflowed (|firstcall| is TRUE) and the table
1799 % is not empty --- this page is still the last page.
1800 % \item The table has not overflowed (|firstcall| is TRUE) and the table
1801 % is empty --- this page is after the actual last page, so decrease
1802 % the page number.
1803 % \item The table has overflowed (|firstcall| is FALSE) and the overflow
1804 % is large enough to generate a non-empty table on the next page ---
1805 % increment the page number.
1806 % \item The table has overflowed (|firstcall| is FALSE) and the overflow
1807 % is small enough to generate an empty table on the next page ---
1808 % this page is still the last page.
1809 % \end{enumerate}
1810 % \begin{macrocode}
1811 \iffirstcall % on last, no overflow
1812 %% \ifnum\PWSTlines < \PWSTlasthead % this table is empty
1813 \ifnum\PWSTlines < \@ne % this table is empty
1814 \global\advance\PWSTcurpage \m@ne
1815 \fi
1816 \else % overflow
1817 %% \ifnum\PWSTlines > \tw@ % enough for another page
1818 \ifnum\PWSTlines > \z@ % enough for another page
1819 \global\advance\PWSTcurpage \@ne
1820 \fi
1821 \fi
1822 \else
1823 % \end{macrocode}
1824 % The table has ended on a page that is not the calculated last page.
1825 % If the table is empty, then decrement the page number, else this is
1826 % the last page.
1827 % \begin{macrocode}
1828 %% \ifnum\PWSTlines < \PWSThead % empty table
1829 \ifnum\PWSTlines < \@ne % empty table
1830 \global\advance\PWSTcurpage \m@ne
1831 \fi
1832 \fi
1833 % \end{macrocode}
1834 % Finally, write out the `new' last page number.
1835 % \begin{macrocode}
1836 \if@filesw\immediate\write\@auxout%
1837 {\gdef\string\PWST@\romannumeral\c@PWSTtable{\the\PWSTcurpage}}%
1838 \ST@trace\tw@{Table \the\c@PWSTtable:\MessageBreak
1839 wrote \the\PWSTcurpage\space as the last page}%
1840 \fi}
1841
1842 % \end{macrocode}
1843 % \end{macro}
1844 %
1845 %
1846 % \begin{macro}{\endmpxtabular}
1847 % \begin{macro}{\endmpxtabular*}
1848 % These close the \Lenv{mpxtabular} and \Lenv{mpxtabular*}
1849 % environments.
1850 % \begin{macrocode}
1851 \def\endmpxtabular{%
1852 \ifx\@table@last@tail\undefined
1853 \@tabletail
1854 \else
1855 \@table@last@tail
1856 \fi
1857 \csname endtabular\ifST@star*\fi\endcsname
1858 \endminipage
1859 % \end{macrocode}
1860 % Now call the common code for all |\end...|.
1861 % \begin{macrocode}
1862 \x@endsupertabular
1863 % \end{macrocode}
1864 % Finish per the original code.
1865 % \begin{macrocode}
1866 \ST@trace\tw@{Ended an mpxtabular\ifST@star*\fi}}
1867 % \end{macrocode}
1868 %
1869 % The definition of the ending of the \Lenv{mpxtabular*}
1870 % environment is simple:
1871 % \begin{macrocode}
1872 \expandafter\let\csname endmpxtabular*\endcsname\endmpxtabular
1873 % \end{macrocode}
1874 % \end{macro}
1875 % \end{macro}
1876 %
1877 % \begin{macro}{\ST@restore}
1878 % This macro restores the original definitions of the macros that
1879 % handle parbox entries and the `end of row' macros.
1880 % \begin{macrocode}
1881 \def\ST@restore{%
1882 \ifx\undefined\@classix
1883 \let\@tabularcr\org@tabularcr
1884 \else
1885 \let\@arraycr\org@tabularcr
1886 \fi
1887 \let\@startpbox\org@startpbox
1888 \let\@endpbox\org@endpbox}
1889 % \end{macrocode}
1890 % \end{macro}
1891 %
1892 % \begin{macro}{\inner@tabular}
1893 % \begin{macro}{\inner@tabular*}
1894 % In order to facilitate complete \Lenv{tabular} environments to be in
1895 % a cell of a \Lenv{supertabular} we need to adapt the definition
1896 % of the original environments. For the inner \Lenv{tabular} a
1897 % number of definitions have to be restored.
1898 % \begin{macrocode}
1899 \def\inner@tabular{%
1900 \ST@restore
1901 \let\\=\@oldcr
1902 \noindent
1903 \org@tabular}
1904 \@namedef{inner@tabular*}{%
1905 \ST@restore
1906 \let\\=\@oldcr
1907 \noindent
1908 \csname org@tabular*\endcsname}
1909 % \end{macrocode}
1910 % \end{macro}
1911 % \end{macro}
1912 %
1913 % \begin{macro}{\ST@cr}
1914 % This macro is called by each |\\| inside the tabular environment.
1915 % It updates the estimate of the amount of space left on the
1916 % current page and starts a new page if necessary.
1917 % \begin{macrocode}
1918 \def\ST@cr{%
1919 \noalign{%
1920 \ST@trace\thr@@{Parbox height: \the\ST@pboxht\MessageBreak
1921 Line height: \the\ST@lineht}%
1922 \ifnum\ST@pboxht<\ST@lineht
1923 % \end{macrocode}
1924 % If there is a non-empty line, but an empty parbox, then
1925 % |\ST@pboxht| might be non-zero, but too small thereby breaking
1926 % the algorithm. Therefore we estimate the height of the line to be
1927 % |\ST@lineht| in this case, and store it in |\ST@prevht|.
1928 % \begin{macrocode}
1929 \global\advance\ST@pageleft -\ST@lineht
1930 \global\ST@prevht\ST@lineht
1931 \else
1932 % \end{macrocode}
1933 % When the parbox is not empty we take its height into account
1934 % plus a little extra.
1935 % \changes{v2.3}{2000/04/09}{Used \cs{PWST@xentrystretch} in \cs{ST@cr} }
1936 % \begin{macrocode}
1937 \global\advance\ST@pboxht \PWST@xentrystretch\ST@pboxht
1938 \global\advance\ST@pboxht \ST@stretchht
1939 \ST@trace\thr@@{Added par box with height \the\ST@pboxht}%
1940 \global\advance\ST@pageleft -\ST@pboxht
1941 \global\ST@prevht\ST@pboxht
1942 \global\ST@pboxht\z@
1943 \fi
1944 % \end{macrocode}
1945 % |\ST@toadd| is the value of the optional argument of |\\|.
1946 % \begin{macrocode}
1947 \global\advance\ST@pageleft -\ST@toadd
1948 \global\ST@toadd=\z@
1949 \ST@trace\thr@@{Space left for xtabular: \the\ST@pageleft}%
1950 % \end{macrocode}
1951 % \emph{Extension:} Increment the line number at this point.
1952 % \begin{macrocode}
1953 \global\advance\PWSTlines \@ne
1954 \ST@trace\thr@@{Line counter incremented by one to: \the\PWSTlines}%
1955 }% end of noalign
1956 % \end{macrocode}
1957 % In general, when the |\ST@pageleft| has become negative,
1958 % the last row was so high
1959 % that the supertabular doesn't fit on the current page. In this case we
1960 % skip the current page and start at the top of the next one; otherwise
1961 % \TeX{} will move this part of the table to a new page anyway, probably
1962 % with a message about an overfull |\vbox|.
1963 %
1964 % \emph{Extension:} For the extension I do some special handling if we are on the last
1965 % page. Essentially the idea is not to start a new page, but to continue
1966 % on the current page, noting any overflow.
1967 % \begin{macrocode}
1968 \ifnum\PWSTcurpage=\PWSTlastpage
1969 \PWST@lastpagecr
1970 \else
1971 % \end{macrocode}
1972 % Execute the original code.
1973 % \begin{macrocode}
1974 \ifnum\ST@pageleft<\z@
1975 \ST@skippage
1976 \else
1977 % \end{macrocode}
1978 % When there is not enough space left on the current page, we start
1979 % a new page. To compute the amount of space needed we use the height
1980 % of the previous line (|\ST@prevht|) as an estimate of the height
1981 % of the next line. If we are processing an \Lenv{mpsupertabular}
1982 % we also need to take the height of the footnotes into account.
1983 % \begin{macrocode}
1984 \noalign{\global\@tempdima\ST@tailht
1985 \global\advance\@tempdima\ST@prevht
1986 \ifST@mp
1987 \ifvoid\@mpfootins\else
1988 \global\advance\@tempdima\ht\@mpfootins
1989 \global\advance\@tempdima 3pt
1990 \fi
1991 \fi}% end noalign
1992 \ifnum\ST@pageleft<\@tempdima
1993 \ST@newpage
1994 \else
1995 % \end{macrocode}
1996 % This line is necessary because the tablehead has to be inserted
1997 % \emph{after} the |\if\else\fi|-clause. For this purpose |\ST@next| is
1998 % used. In the middle of tableprocessing it should be an \emph{empty}
1999 % macro (\emph{not} |\relax|).
2000 % \begin{macrocode}
2001 \noalign{\global\let\ST@next\@empty}%
2002 \fi
2003 \fi
2004 % \end{macrocode}
2005 % \emph{Extension:} Close off the |\iflastpage|;
2006 % \begin{macrocode}
2007 \fi
2008 % \end{macrocode}
2009 % and finish per the original code.
2010 % \begin{macrocode}
2011 \ST@next}
2012
2013 % \end{macrocode}
2014 % \end{macro}
2015 %
2016 % \begin{macro}{\PWST@lastpagecr}
2017 % \emph{Extension:} This routine handles newlines on the last page
2018 % of a supertabular. The idea is that when we are on the last page the
2019 % table continues to be processed until the end without calling for a
2020 % newpage even if the table will be too long. I do need to record whether
2021 % or not the table has `overflowed' the allowable space on the page.
2022 % The code is very similar to the last part of the code for |\ST@cr|.
2023 % \changes{v2}{1997/11/30}{Added PWST@lastpagecr routine}
2024 % \begin{macrocode}
2025 \newcommand{\PWST@lastpagecr}{%
2026 \noalign{%
2027 \ifnum\ST@pageleft<\z@
2028 % \end{macrocode}
2029 % The table has overflowed, so record the fact.
2030 % \begin{macrocode}
2031 \PWST@setfirstcall
2032 \fi
2033 % \end{macrocode}
2034 % Now continue along the lines of |\ST@cr|.
2035 % \begin{macrocode}
2036 \global\@tempdima\ST@tailht
2037 \global\advance\@tempdima\ST@prevht
2038 \ifST@mp
2039 \ifvoid\@mpfootins\else
2040 \global\advance\@tempdima\ht\@mpfootins
2041 \global\advance\@tempdima 3pt
2042 \fi
2043 \fi
2044 \ifnum\ST@pageleft<\@tempdima
2045 % \end{macrocode}
2046 % Again, the table has overflowed.
2047 % \begin{macrocode}
2048 \PWST@setfirstcall
2049 \fi
2050 % \end{macrocode}
2051 % Finish like |\ST@cr|.
2052 % \begin{macrocode}
2053 \global\let\ST@next\@empty
2054 }}
2055 % \end{macrocode}
2056 % \end{macro}
2057 %
2058 % \begin{macro}{\PWST@setfirstcall}
2059 % \emph{Extension:} This routine records that a table on the last page
2060 % has overflowed
2061 % by setting |firstcall| to FALSE. If it is the first such overflow
2062 % it also zeroes the line counter.
2063 % \changes{v2}{1997/11/30}{Added PWST@setfirstcall routine}
2064 % \begin{macrocode}
2065 \newcommand{\PWST@setfirstcall}{%
2066 \iffirstcall
2067 \global\firstcallfalse
2068 \global\PWSTlines=\z@
2069 \ST@trace\thr@@{Overflow on last page. Line counter set to \the\PWSTlines}%
2070 \fi}
2071 % \end{macrocode}
2072 % \end{macro}
2073 %
2074 % \begin{macro}{\ST@skipfirstpart}
2075 % This macro skips the current page and moves the entire supertabular
2076 % that has been built so far to the next page.
2077 % \begin{macrocode}
2078 \def\ST@skipfirstpart{%
2079 \noalign{%
2080 \ST@trace\tw@{Tabular too high, moving to next page}%
2081 % \end{macrocode}
2082 % In order for this to work properly we need to adapt the value of
2083 % |\ST@pageleft|. When this macro is called it has a negative value.
2084 % We should add the height of the next page to that (|\@colroom|).
2085 % From the result the `normal' height of the supertabular should be
2086 % subtracted (|\@colroom - \pagetotal|). This could be coded as follows:
2087 % \begin{verbatim}
2088 % \ST@dimen\@colroom
2089 % \advance\ST@dimen-\pagetotal
2090 % \global\advance\ST@pageleft\@colroom
2091 % \global\advance\ST@pageleft-\ST@dimen
2092 % \end{verbatim}
2093 % However, note that |\@colroom| is added \emph{and} subtracted. Thus the
2094 % code can be simplified to:
2095 % \begin{macrocode}
2096 \global\advance\ST@pageleft\pagetotal
2097 % \end{macrocode}
2098 % Then we can set |\ST@pagesofar| to zero and start the new page.
2099 % \begin{macrocode}
2100 \global\ST@pagesofar\z@
2101 \newpage
2102 % \end{macrocode}
2103 % Finally we make sure that this macro can only be executed once for
2104 % each supertabular by changing the definition of |\ST@skippage|.
2105 % \begin{macrocode}
2106 \global\let\ST@skippage\ST@newpage
2107 }}
2108 % \end{macrocode}
2109 % \end{macro}
2110 %
2111 % \begin{macro}{\ST@newpage}
2112 % This macro performs the actions necessary to start a new page.
2113 %
2114 % This macro is also modified for the extension to supertabluar.
2115 %
2116 % \begin{macrocode}
2117 \def\ST@newpage{%
2118 \noalign{\ST@trace\tw@{Starting new page, writing tail}}%
2119 % \end{macrocode}
2120 % Output |\tabletail|, close the tabular environment, close a minipage
2121 % if necessary, output all material and start a fresh new page.
2122 % \begin{macrocode}
2123 \@tabletail
2124 \ifST@star
2125 \csname endtabular*\endcsname
2126 \else
2127 \endtabular
2128 \fi
2129 \ifST@mp
2130 \endminipage
2131 \fi
2132 % \end{macrocode}
2133 % Then we make sure that |\ST@skippage| can no longer be executed for
2134 % this supertabular by changing its definition.
2135 % \begin{macrocode}
2136 \global\let\ST@skippage\ST@newpage
2137 % \end{macrocode}
2138 % On with the output.
2139 %
2140 % \emph{Extension:} The original code had the next line as
2141 % |\newpage\@calnextpageht|. However, if the general header has a
2142 % vertical height that differs from the first header, then the table
2143 % on the continuation pages may run short or, more disconcerting, long.
2144 % The extension, I think, cures that by using a different algorithm to
2145 % calculate the height on the next page.
2146 % \changes{v2}{1997/11/30}{Replaced @calnextpageht by PWSTcalnextpageht in ST@newpage}
2147 % \begin{macrocode}
2148 \newpage\PWSTcalnextpageht
2149 \ST@trace\tw@{writing head}%
2150 % \end{macrocode}
2151 % \emph{Extension:} The original code just let |\ST@next| to |\@tablehead|.
2152 % The extension
2153 % has to handle the special case of of the heading on the last page.
2154 % \begin{macrocode}
2155 \PWSTsethead
2156 % \end{macrocode}
2157 % Now we are back to the original supertabular code.
2158 % \begin{macrocode}
2159 \ifST@mp
2160 \noindent\minipage{\columnwidth}%
2161 \parfillskip\ST@parfillskip
2162 \rightskip \ST@rightskip
2163 \leftskip \ST@leftskip
2164 \fi
2165 \noindent
2166 \ifST@star
2167 \expandafter\csname org@tabular*\expandafter\endcsname
2168 \expandafter{\expandafter\ST@wd\expandafter}%
2169 \expandafter{\ST@tableformat}%
2170 \else
2171 \expandafter\org@tabular\expandafter{\ST@tableformat}%
2172 \fi}
2173 % \end{macrocode}
2174 % \end{macro}
2175 %
2176 % \begin{macro}{\PWSTsethead}
2177 % \emph{Extension:} This is more extension code for use within |\ST@newpage|.
2178 % It provides the proper table head for the page about to be processed.
2179 % \changes{v2}{1997/11/30}{Added PWSTsethead routine}
2180 % \begin{macrocode}
2181 \newcommand{\PWSTsethead}{%
2182 % \end{macrocode}
2183 % First the line counter is zeroed.
2184 % \begin{macrocode}
2185 \global\PWSTlines=\z@
2186 \ST@trace\thr@@{Newpage, line counter set to: \the\PWSTlines}%
2187 % \end{macrocode}
2188 % The current page counter is incremented
2189 % and it is checked against the old page counter to see if this is
2190 % the last page of this supertabular.
2191 % \begin{macrocode}
2192 \global\advance\PWSTcurpage\@ne
2193 \ST@trace\tw@{Table \the\c@PWSTtable:\MessageBreak
2194 current page = \the\PWSTcurpage,\MessageBreak
2195 last page = \the\PWSTlastpage}%
2196 \ifnum\PWSTcurpage=\PWSTlastpage
2197 \ST@trace\tw@{Newpage is the last page}%
2198 % \end{macrocode}
2199 % We are on the last page. If there are more than
2200 % one pages and the last table heading has been specified,
2201 % then the heading is set to |\@table@last@head|, otherwise it is set
2202 % to |\@tablehead|.
2203 % \begin{macrocode}
2204 \ifnum\PWSTcurpage>\@ne
2205 \ifx\@table@last@head\relax
2206 \let\ST@next\@tablehead
2207 \ST@trace\tw@{Set heading to tablehead}%
2208 \else
2209 \let\ST@next\@table@last@head
2210 \ST@trace\tw@{Set heading to tablelasthead}%
2211 \fi
2212 \fi
2213 \else
2214 % \end{macrocode}
2215 % We are not on the last page, so just set the heading to |\@tablehead|.
2216 % \begin{macrocode}
2217 \let\ST@next\@tablehead
2218 \ST@trace\tw@{Set heading to tablehead}%
2219 \fi}
2220 % \end{macrocode}
2221 % \end{macro}
2222
2223 % The end of this package
2224 % \begin{macrocode}
2225 %</xtab>
2226 % \end{macrocode}
2227 %
2228 %
2229 %
2230 % \bibliographystyle{alpha}
2231 %
2232 % \begin{thebibliography}{GMS94}
2233 %
2234 % \bibitem[GMS94]{GOOSSENS94}
2235 % Michel Goossens, Frank Mittelbach, and Alexander Samarin.
2236 % \newblock {\em The LaTeX Companion}.
2237 % \newblock Addison-Wesley Publishing Company, 1994.
2238 %
2239 % \bibitem[Wil96]{PRW96i}
2240 % Peter~R. Wilson.
2241 % \newblock {\em {LaTeX for standards: The LaTeX package files user manual}}.
2242 % \newblock NIST Report NISTIR, June 1996.
2243 %
2244 % \end{thebibliography}
2245 %
2246 %
2247 % \Finale
2248 % \PrintIndex
2249 %
2250 \endinput
2251
2252 %% \CharacterTable
2253 %% {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
2254 %% 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
2255 %% Digits \0\1\2\3\4\5\6\7\8\9
2256 %% Exclamation \! Double quote \" Hash (number) \#
2257 %% Dollar \$ Percent \% Ampersand \&
2258 %% Acute accent \' Left paren \( Right paren \)
2259 %% Asterisk \* Plus \+ Comma \,
2260 %% Minus \- Point \. Solidus \/
2261 %% Colon \: Semicolon \; Less than \<
2262 %% Equals \= Greater than \> Question mark \?
2263 %% Commercial at \@ Left bracket \[ Backslash \\
2264 %% Right bracket \] Circumflex \^ Underscore \_
2265 %% Grave accent \` Left brace \{ Vertical bar \|
2266 %% Right brace \} Tilde \~}