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