communigate provisioning phase 2: add svc_domain.trailer -> communigate TrailerText...
[freeside.git] / etc / fslongtable.sty
1 %%
2 %% This is file `fslongtable.sty',
3 %%
4 %% Copyright 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003
5 %% The LaTeX3 Project and any individual authors listed elsewhere
6 %% in this file.
7 %% 
8 %% This file was forked from file(s) of the Standard LaTeX `Tools Bundle'.
9 %% This file includes a new length LTextracouponspace which modifies
10 %% the behavior of the package at the end of a page.  This feature 
11 %% and package is not supported or acknowledged by Dave Carlisle.
12 %% Do not contact him for such support.
13 %% --------------------------------------------------------------------------
14 %% 
15 %% It may be distributed and/or modified under the
16 %% conditions of the LaTeX Project Public License, either version 1.3
17 %% of this license or (at your option) any later version.
18 %% The latest version of this license is in
19 %%    http://www.latex-project.org/lppl.txt
20 %% and version 1.3 or later is part of all distributions of LaTeX
21 %% version 2003/12/01 or later.
22 %% 
23 %% File: longtable.dtx Copyright (C) 1990-2001 David Carlisle
24 %% File: fslongtable.sty Copyright (C) 2008 Jeff Finucane
25 \NeedsTeXFormat{LaTeX2e}[1995/06/01]
26 \ProvidesPackage{longtable}
27           [2004/02/01 v4.11 Multi-page Table package (DPC)]
28 \def\LT@err{\PackageError{longtable}}
29 \def\LT@warn{\PackageWarning{longtable}}
30 \def\LT@final@warn{%
31   \AtEndDocument{%
32     \LT@warn{Table \@width s have changed. Rerun LaTeX.\@gobbletwo}}%
33   \global\let\LT@final@warn\relax}
34 \DeclareOption{errorshow}{%
35   \def\LT@warn{\PackageInfo{longtable}}}
36 \DeclareOption{pausing}{%
37   \def\LT@warn#1{%
38     \LT@err{#1}{This is not really an error}}}
39 \DeclareOption{set}{}
40 \DeclareOption{final}{}
41 \ProcessOptions
42 \newskip\LTleft       \LTleft=\fill
43 \newskip\LTright      \LTright=\fill
44 \newskip\LTpre        \LTpre=\bigskipamount
45 \newskip\LTpost       \LTpost=\bigskipamount
46 \newcount\LTchunksize \LTchunksize=20
47 \let\c@LTchunksize\LTchunksize
48 \newdimen\LTcapwidth  \LTcapwidth=4in
49 \newlength\LTextracouponspace
50 \newbox\LT@head
51 \newbox\LT@firsthead
52 \newbox\LT@foot
53 \newbox\LT@lastfoot
54 \newcount\LT@cols
55 \newcount\LT@rows
56 \newcounter{LT@tables}
57 \newcounter{LT@chunks}[LT@tables]
58 \ifx\c@table\undefined
59   \newcounter{table}
60   \def\fnum@table{\tablename~\thetable}
61 \fi
62 \ifx\tablename\undefined
63   \def\tablename{Table}
64 \fi
65 \newtoks\LT@p@ftn
66 \mathchardef\LT@end@pen=30000
67 \def\longtable{%
68   \par
69   \ifx\multicols\@undefined
70   \else
71      \ifnum\col@number>\@ne
72        \@twocolumntrue
73      \fi
74   \fi
75   \if@twocolumn
76     \LT@err{longtable not in 1-column mode}\@ehc
77   \fi
78   \begingroup
79   \@ifnextchar[\LT@array{\LT@array[x]}}
80 \def\LT@array[#1]#2{%
81   \refstepcounter{table}\stepcounter{LT@tables}%
82   \if l#1%
83     \LTleft\z@ \LTright\fill
84   \else\if r#1%
85     \LTleft\fill \LTright\z@
86   \else\if c#1%
87     \LTleft\fill \LTright\fill
88   \fi\fi\fi
89   \let\LT@mcol\multicolumn
90   \let\LT@@tabarray\@tabarray
91   \let\LT@@hl\hline
92   \def\@tabarray{%
93     \let\hline\LT@@hl
94     \LT@@tabarray}%
95   \let\\\LT@tabularcr\let\tabularnewline\\%
96   \def\newpage{\noalign{\break}}%
97   \def\pagebreak{\noalign{\ifnum`}=0\fi\@testopt{\LT@no@pgbk-}4}%
98   \def\nopagebreak{\noalign{\ifnum`}=0\fi\@testopt\LT@no@pgbk4}%
99   \let\hline\LT@hline \let\kill\LT@kill\let\caption\LT@caption
100   \@tempdima\ht\strutbox
101   \let\@endpbox\LT@endpbox
102   \ifx\extrarowheight\@undefined
103     \let\@acol\@tabacol
104     \let\@classz\@tabclassz \let\@classiv\@tabclassiv
105     \def\@startpbox{\vtop\LT@startpbox}%
106     \let\@@startpbox\@startpbox
107     \let\@@endpbox\@endpbox
108     \let\LT@LL@FM@cr\@tabularcr
109   \else
110     \advance\@tempdima\extrarowheight
111     \col@sep\tabcolsep
112     \let\@startpbox\LT@startpbox\let\LT@LL@FM@cr\@arraycr
113   \fi
114   \setbox\@arstrutbox\hbox{\vrule
115     \@height \arraystretch \@tempdima
116     \@depth \arraystretch \dp \strutbox
117     \@width \z@}%
118   \let\@sharp##\let\protect\relax
119    \begingroup
120     \@mkpream{#2}%
121     \xdef\LT@bchunk{%
122        \global\advance\c@LT@chunks\@ne
123        \global\LT@rows\z@\setbox\z@\vbox\bgroup
124        \LT@setprevdepth
125        \tabskip\LTleft \noexpand\halign to\hsize\bgroup
126       \tabskip\z@ \@arstrut \@preamble \tabskip\LTright \cr}%
127   \endgroup
128   \expandafter\LT@nofcols\LT@bchunk&\LT@nofcols
129   \LT@make@row
130   \m@th\let\par\@empty
131   \everycr{}\lineskip\z@\baselineskip\z@
132   \LT@bchunk}
133 \def\LT@no@pgbk#1[#2]{\penalty #1\@getpen{#2}\ifnum`{=0\fi}}
134 \def\LT@start{%
135   \let\LT@start\endgraf
136   \endgraf\penalty\z@\vskip\LTpre
137   \dimen@\pagetotal
138   \advance\dimen@ \ht\ifvoid\LT@firsthead\LT@head\else\LT@firsthead\fi
139   \advance\dimen@ \dp\ifvoid\LT@firsthead\LT@head\else\LT@firsthead\fi
140   \advance\dimen@ \ht\LT@foot
141   \dimen@ii\vfuzz
142   \vfuzz\maxdimen
143     \setbox\tw@\copy\z@
144     \setbox\tw@\vsplit\tw@ to \ht\@arstrutbox
145     \setbox\tw@\vbox{\unvbox\tw@}%
146   \vfuzz\dimen@ii
147   \advance\dimen@ \ht
148         \ifdim\ht\@arstrutbox>\ht\tw@\@arstrutbox\else\tw@\fi
149   \advance\dimen@\dp
150         \ifdim\dp\@arstrutbox>\dp\tw@\@arstrutbox\else\tw@\fi
151   \advance\dimen@ -\pagegoal
152   \ifdim \dimen@>\z@\vfil\break\fi
153       \global\@colroom\@colht
154   \ifnum\thepage=1
155     \advance\vsize-\LTextracouponspace
156     \dimen@\pagegoal\advance\dimen@-\LTextracouponspace\pagegoal\dimen@
157   \fi
158   \ifvoid\LT@foot\else
159     \advance\vsize-\ht\LT@foot
160     \global\advance\@colroom-\ht\LT@foot
161     \dimen@\pagegoal\advance\dimen@-\ht\LT@foot\pagegoal\dimen@
162     \maxdepth\z@
163   \fi
164   \ifvoid\LT@firsthead\copy\LT@head\else\box\LT@firsthead\fi\nobreak
165   \output{\LT@output}}
166 \def\endlongtable{%
167   \crcr
168   \noalign{%
169     \let\LT@entry\LT@entry@chop
170     \xdef\LT@save@row{\LT@save@row}}%
171   \LT@echunk
172   \LT@start
173   \unvbox\z@
174   \LT@get@widths
175   \if@filesw
176     {\let\LT@entry\LT@entry@write\immediate\write\@auxout{%
177       \gdef\expandafter\noexpand
178         \csname LT@\romannumeral\c@LT@tables\endcsname
179           {\LT@save@row}}}%
180   \fi
181   \ifx\LT@save@row\LT@@save@row
182   \else
183     \LT@warn{Column \@width s have changed\MessageBreak
184              in table \thetable}%
185     \LT@final@warn
186   \fi
187   \endgraf\penalty -\LT@end@pen
188   \endgroup
189   \global\@mparbottom\z@
190   \pagegoal\vsize
191   \endgraf\penalty\z@\addvspace\LTpost
192   \ifvoid\footins\else\insert\footins{}\fi}
193 \def\LT@nofcols#1&{%
194   \futurelet\@let@token\LT@n@fcols}
195 \def\LT@n@fcols{%
196   \advance\LT@cols\@ne
197   \ifx\@let@token\LT@nofcols
198     \expandafter\@gobble
199   \else
200     \expandafter\LT@nofcols
201   \fi}
202 \def\LT@tabularcr{%
203   \relax\iffalse{\fi\ifnum0=`}\fi
204   \@ifstar
205     {\def\crcr{\LT@crcr\noalign{\nobreak}}\let\cr\crcr
206      \LT@t@bularcr}%
207     {\LT@t@bularcr}}
208 \let\LT@crcr\crcr
209 \let\LT@setprevdepth\relax
210 \def\LT@t@bularcr{%
211   \global\advance\LT@rows\@ne
212   \ifnum\LT@rows=\LTchunksize
213     \gdef\LT@setprevdepth{%
214       \prevdepth\z@\global
215       \global\let\LT@setprevdepth\relax}%
216     \expandafter\LT@xtabularcr
217   \else
218     \ifnum0=`{}\fi
219     \expandafter\LT@LL@FM@cr
220   \fi}
221 \def\LT@xtabularcr{%
222   \@ifnextchar[\LT@argtabularcr\LT@ntabularcr}
223 \def\LT@ntabularcr{%
224   \ifnum0=`{}\fi
225   \LT@echunk
226   \LT@start
227   \unvbox\z@
228   \LT@get@widths
229   \LT@bchunk}
230 \def\LT@argtabularcr[#1]{%
231   \ifnum0=`{}\fi
232   \ifdim #1>\z@
233     \unskip\@xargarraycr{#1}%
234   \else
235     \@yargarraycr{#1}%
236   \fi
237   \LT@echunk
238   \LT@start
239   \unvbox\z@
240   \LT@get@widths
241   \LT@bchunk}
242 \def\LT@echunk{%
243   \crcr\LT@save@row\cr\egroup
244   \global\setbox\@ne\lastbox
245     \unskip
246   \egroup}
247 \def\LT@entry#1#2{%
248   \ifhmode\@firstofone{&}\fi\omit
249   \ifnum#1=\c@LT@chunks
250   \else
251     \kern#2\relax
252   \fi}
253 \def\LT@entry@chop#1#2{%
254   \noexpand\LT@entry
255     {\ifnum#1>\c@LT@chunks
256        1}{0pt%
257      \else
258        #1}{#2%
259      \fi}}
260 \def\LT@entry@write{%
261   \noexpand\LT@entry^^J%
262   \@spaces}
263 \def\LT@kill{%
264   \LT@echunk
265   \LT@get@widths
266   \expandafter\LT@rebox\LT@bchunk}
267 \def\LT@rebox#1\bgroup{%
268   #1\bgroup
269   \unvbox\z@
270   \unskip
271   \setbox\z@\lastbox}
272 \def\LT@blank@row{%
273   \xdef\LT@save@row{\expandafter\LT@build@blank
274     \romannumeral\number\LT@cols 001 }}
275 \def\LT@build@blank#1{%
276   \if#1m%
277     \noexpand\LT@entry{1}{0pt}%
278     \expandafter\LT@build@blank
279   \fi}
280 \def\LT@make@row{%
281   \global\expandafter\let\expandafter\LT@save@row
282     \csname LT@\romannumeral\c@LT@tables\endcsname
283   \ifx\LT@save@row\relax
284     \LT@blank@row
285   \else
286     {\let\LT@entry\or
287      \if!%
288          \ifcase\expandafter\expandafter\expandafter\LT@cols
289          \expandafter\@gobble\LT@save@row
290          \or
291          \else
292            \relax
293          \fi
294         !%
295      \else
296        \aftergroup\LT@blank@row
297      \fi}%
298   \fi}
299 \let\setlongtables\relax
300 \def\LT@get@widths{%
301   \setbox\tw@\hbox{%
302     \unhbox\@ne
303     \let\LT@old@row\LT@save@row
304     \global\let\LT@save@row\@empty
305     \count@\LT@cols
306     \loop
307       \unskip
308       \setbox\tw@\lastbox
309     \ifhbox\tw@
310       \LT@def@row
311       \advance\count@\m@ne
312     \repeat}%
313   \ifx\LT@@save@row\@undefined
314     \let\LT@@save@row\LT@save@row
315   \fi}
316 \def\LT@def@row{%
317   \let\LT@entry\or
318   \edef\@tempa{%
319     \ifcase\expandafter\count@\LT@old@row
320     \else
321       {1}{0pt}%
322     \fi}%
323   \let\LT@entry\relax
324   \xdef\LT@save@row{%
325     \LT@entry
326     \expandafter\LT@max@sel\@tempa
327     \LT@save@row}}
328 \def\LT@max@sel#1#2{%
329   {\ifdim#2=\wd\tw@
330      #1%
331    \else
332      \number\c@LT@chunks
333    \fi}%
334   {\the\wd\tw@}}
335 \def\LT@hline{%
336   \noalign{\ifnum0=`}\fi
337     \penalty\@M
338     \futurelet\@let@token\LT@@hline}
339 \def\LT@@hline{%
340   \ifx\@let@token\hline
341     \global\let\@gtempa\@gobble
342     \gdef\LT@sep{\penalty-\@medpenalty\vskip\doublerulesep}%
343   \else
344     \global\let\@gtempa\@empty
345     \gdef\LT@sep{\penalty-\@lowpenalty\vskip-\arrayrulewidth}%
346   \fi
347   \ifnum0=`{\fi}%
348   \multispan\LT@cols
349      \unskip\leaders\hrule\@height\arrayrulewidth\hfill\cr
350   \noalign{\LT@sep}%
351   \multispan\LT@cols
352      \unskip\leaders\hrule\@height\arrayrulewidth\hfill\cr
353   \noalign{\penalty\@M}%
354   \@gtempa}
355 \def\LT@caption{%
356   \noalign\bgroup
357     \@ifnextchar[{\egroup\LT@c@ption\@firstofone}\LT@capti@n}
358 \def\LT@c@ption#1[#2]#3{%
359   \LT@makecaption#1\fnum@table{#3}%
360   \def\@tempa{#2}%
361   \ifx\@tempa\@empty\else
362      {\let\\\space
363      \addcontentsline{lot}{table}{\protect\numberline{\thetable}{#2}}}%
364   \fi}
365 \def\LT@capti@n{%
366   \@ifstar
367     {\egroup\LT@c@ption\@gobble[]}%
368     {\egroup\@xdblarg{\LT@c@ption\@firstofone}}}
369 \def\LT@makecaption#1#2#3{%
370   \LT@mcol\LT@cols c{\hbox to\z@{\hss\parbox[t]\LTcapwidth{%
371     \sbox\@tempboxa{#1{#2: }#3}%
372     \ifdim\wd\@tempboxa>\hsize
373       #1{#2: }#3%
374     \else
375       \hbox to\hsize{\hfil\box\@tempboxa\hfil}%
376     \fi
377     \endgraf\vskip\baselineskip}%
378   \hss}}}
379 \def\LT@output{%
380   \ifnum\outputpenalty <-\@Mi
381     \ifnum\outputpenalty > -\LT@end@pen
382       \LT@err{floats and marginpars not allowed in a longtable}\@ehc
383     \else
384       \setbox\z@\vbox{\unvbox\@cclv}%
385       \ifdim \ht\LT@lastfoot>\ht\LT@foot
386         \dimen@\pagegoal
387         \advance\dimen@-\ht\LT@lastfoot
388         \ifdim\dimen@<\ht\z@
389           \setbox\@cclv\vbox{\unvbox\z@\copy\LT@foot\vss}%
390           \@makecol
391           \@outputpage
392           \setbox\z@\vbox{\box\LT@head}%
393         \fi
394       \fi
395       \global\@colroom\@colht
396       \global\vsize\@colht
397       \vbox
398         {\unvbox\z@\box\ifvoid\LT@lastfoot\LT@foot\else\LT@lastfoot\fi}%
399     \fi
400   \else
401     \setbox\@cclv\vbox{\unvbox\@cclv\copy\LT@foot\vss}%
402     \@makecol
403     \@outputpage
404       \global\vsize\@colroom
405     \copy\LT@head\nobreak
406   \fi}
407 \def\LT@end@hd@ft#1{%
408   \LT@echunk
409   \ifx\LT@start\endgraf
410     \LT@err
411      {Longtable head or foot not at start of table}%
412      {Increase LTchunksize}%
413   \fi
414   \setbox#1\box\z@
415   \LT@get@widths
416   \LT@bchunk}
417 \def\endfirsthead{\LT@end@hd@ft\LT@firsthead}
418 \def\endhead{\LT@end@hd@ft\LT@head}
419 \def\endfoot{\LT@end@hd@ft\LT@foot}
420 \def\endlastfoot{\LT@end@hd@ft\LT@lastfoot}
421 \def\LT@startpbox#1{%
422   \bgroup
423     \let\@footnotetext\LT@p@ftntext
424     \setlength\hsize{#1}%
425     \@arrayparboxrestore
426     \vrule \@height \ht\@arstrutbox \@width \z@}
427 \def\LT@endpbox{%
428   \@finalstrut\@arstrutbox
429   \egroup
430   \the\LT@p@ftn
431   \global\LT@p@ftn{}%
432   \hfil}
433 \def\LT@p@ftntext#1{%
434   \edef\@tempa{\the\LT@p@ftn\noexpand\footnotetext[\the\c@footnote]}%
435   \global\LT@p@ftn\expandafter{\@tempa{#1}}}%
436 \endinput
437 %%
438 %% End of file `longtable.sty'.