Debian Codegraph @

texmf-dist/tex/latex-dev/tools/array-2024-06-01.sty

raw
1 %%
2 %% This is an old release of `array.sty' used during rollback operations.
3 %% Do not use this file directly.
4 %% ==============================
5 %%
6 %%
7 %% This is file `array.sty',
8 %% generated with the docstrip utility.
9 %%
10 %% The original source files were:
11 %%
12 %% array.dtx (with options: `package,ncols')
13 %%
14 %% This is a generated file.
15 %%
16 %% The source is maintained by the LaTeX Project team and bug
17 %% reports for it can be opened at https://latex-project.org/bugs/
18 %% (but please observe conditions on bug reports sent to that address!)
19 %%
20 %%
21 %% Copyright (C) 1993-2025
22 %% The LaTeX Project and any individual authors listed elsewhere
23 %% in this file.
24 %%
25 %% This file was generated from file(s) of the Standard LaTeX `Tools Bundle'.
26 %% --------------------------------------------------------------------------
27 %%
28 %% It may be distributed and/or modified under the
29 %% conditions of the LaTeX Project Public License, either version 1.3c
30 %% of this license or (at your option) any later version.
31 %% The latest version of this license is in
32 %% https://www.latex-project.org/lppl.txt
33 %% and version 1.3c or later is part of all distributions of LaTeX
34 %% version 2005/12/01 or later.
35 %%
36 %% This file may only be distributed together with a copy of the LaTeX
37 %% `Tools Bundle'. You may however distribute the LaTeX `Tools Bundle'
38 %% without such generated files.
39 %%
40 %% The list of all files belonging to the LaTeX `Tools Bundle' is
41 %% given in the file `manifest.txt'.
42 %%
43 %% Package `array' to use with LaTeX 2e
44 %% Copyright (C) 1989-1998 Frank Mittelbach, all rights reserved.
45
46 \NeedsTeXFormat{LaTeX2e}[2024/06/01]
47 \ProvidesPackage{array}
48 [2025/09/25 v2.6n Tabular extension package (FMi)]
49 %%
50
51 \ExplSyntaxOn
52 \def\@addtopreamble#1{\xdef\@preamble{\@preamble #1}}
53 \ExplSyntaxOff
54 \def\@testpach{\@chclass
55 \ifnum \@lastchclass=6 \@ne \@chnum \@ne \else
56 \ifnum \@lastchclass=7 5 \else
57 \ifnum \@lastchclass=8 \tw@ \else
58 \ifnum \@lastchclass=9 \thr@@
59 \else \z@
60 \ifnum \@lastchclass = 10 \else
61 \edef\@nextchar{\expandafter\string\@nextchar}%
62 \@chnum
63 \if \@nextchar c\z@ \else
64 \if \@nextchar l\@ne \else
65 \if \@nextchar r\tw@ \else
66 \z@ \@chclass
67 \if\@nextchar |\@ne \else
68 \if \@nextchar !6 \else
69 \if \@nextchar @7 \else
70 \if \@nextchar <8 \else
71 \if \@nextchar >9 \else
72 10
73 \@chnum
74 \if \@nextchar m\thr@@ \else
75 \if \@nextchar p4 \else
76 \if \@nextchar b5 \else
77 \z@ \@chclass \z@ \@preamerr \z@ \fi \fi \fi \fi
78 \fi \fi \fi \fi \fi \fi \fi \fi \fi \fi \fi \fi}
79 \ExplSyntaxOn
80 \def\@xexpast#1*#2#3#4\@@{%
81 \@tempcnta #2
82 \toks@={#1}\@temptokena={#3}%
83 \let\the@toksz\relax \let\the@toks\relax
84 \def\@tempa{\the@toksz}%
85 \ifnum\@tempcnta >0 \@whilenum\@tempcnta >0\do
86 {\edef\@tempa{\@tempa\the@toks}\advance \@tempcnta \m@ne}%
87 \let \@tempb \@xexpast \else
88 \let \@tempb \@xexnoop \fi
89 \def\the@toksz{\the\toks@}\def\the@toks{\the\@temptokena}%
90 \edef\@tempa{\@tempa}%
91 \expandafter \@tempb \@tempa #4\@@}
92 \def\prepnext@tok{\advance \count@ \@ne
93 \toks\count@{}}
94 \def\save@decl{\toks\count@ \expandafter{\@nextchar}}
95 \def\insert@column{%
96 \UseTaggingSocket{tbl/cell/begin}%
97 \@protected@firstofone { \the@toks \the \@tempcnta \ignorespaces }
98 \@sharp \textonly@unskip
99 \the@toks \the \count@ \relax
100 \UseTaggingSocket{tbl/cell/end}%
101 }
102 \protected\def\textonly@unskip{\ifhmode\unskip\fi}
103 \protected\long\def\@protected@firstofone#1{#1}
104 \def\insert@pcolumn{%
105 \UseTaggingSocket{tbl/pcell/begin}%
106 \the@toks \the \@tempcnta \relax
107 \ignorespaces \@sharp \unskip
108 \the@toks \the \count@ \relax
109 \UseTaggingSocket{tbl/pcell/end}%
110 }
111 \def\@addamp {
112 \if@firstamp
113 \@firstampfalse
114 \else
115 \edef\@preamble{\@preamble &
116 \noexpand\tbl_update_cell_data: }
117 \fi
118 }
119 \newdimen\col@sep
120 \def\@acol{\@addtopreamble{\hskip\col@sep}}
121 \def\@classx{%
122 \ifcase \@lastchclass
123 \@acolampacol \or
124 \@addamp \@acol \or
125 \@acolampacol \or
126 \or
127 \@acol \@firstampfalse \or
128 \@addamp
129 \fi}
130 \str_if_exist:cF { l__socket_tagsupport/math/luamml/array/save_plug_str }
131 {
132 \NewSocket{tagsupport/math/luamml/array/save}{0}
133 \NewSocket{tagsupport/math/luamml/array/finalize}{0}
134 \NewSocket{tagsupport/math/luamml/array/initcol}{0}
135 \NewSocket{tagsupport/math/luamml/array/finalizecol}{1}
136 \AssignSocketPlug{tagsupport/math/luamml/array/finalizecol}{noop}
137 }
138 \def\@classz{\@classx
139 \@tempcnta \count@
140 \prepnext@tok
141 \@addtopreamble{\ifcase \@chnum
142 \hfil
143 \hskip1sp%
144 \d@llarbegin
145 \insert@column
146 \d@llarend
147 \do@row@strut \hfil \or
148 \hskip1sp\d@llarbegin\insert@column\d@llarend
149 \do@row@strut \hfil \or
150 \hfil\hskip1sp\d@llarbegin\insert@column\d@llarend
151 \do@row@strut \or
152 \setbox\ar@mcellbox\vbox
153 \@startpbox{\@nextchar}\insert@pcolumn \@endpbox
154 \ar@align@mcell
155 \do@row@strut \or
156 \vtop \@startpbox{\@nextchar}\insert@pcolumn \@endpbox\do@row@strut \or
157 \vbox \@startpbox{\@nextchar}\insert@pcolumn \@endpbox\do@row@strut
158 \fi}\prepnext@tok}
159
160 \newbox\ar@mcellbox
161 \def\ar@align@mcell{%
162 \ifdim \ht\ar@mcellbox > \ht\strutbox
163 \begingroup
164 \dimen@\ht\ar@mcellbox
165 \advance\dimen@-\ht\@arstrutbox
166 \advance\dimen@\baselineskip
167 \lower.5\dimen@\box\ar@mcellbox
168 \endgroup
169 \else % assume one line and align at baseline
170 \box\ar@mcellbox
171 \fi}
172
173 \def\@arrayrule{\@addtopreamble \vline}
174 \def\@classvii{\ifnum \@lastchclass = \thr@@
175 \@preamerr \thr@@ \fi}
176 \def\@classvi{\ifcase \@lastchclass
177 \@acol \or
178 \@addtopreamble{\hskip \doublerulesep}\or
179 \@acol \or
180 \@classvii
181 \fi}
182 \def\@classii{\advance \count@ \m@ne
183 \save@decl\prepnext@tok}
184 \def\@classi{\@classvi
185 \ifcase \@chnum \@arrayrule \or
186 \@classv \fi}
187 \def\@startpbox#1{\bgroup
188 \color@begingroup
189 \setlength\hsize{#1}\@arrayparboxrestore
190 \everypar{%
191 \vrule \@height \ht\@arstrutbox \@width \z@
192 \everypar{}}%
193 }
194 \let\@startpbox@action\@startpbox
195 \def\@endpbox{\@finalstrut\@arstrutbox \par \color@endgroup \egroup\hfil}
196 \def\@finalstrut#1{%
197 \unskip
198 \ifhmode \nobreak
199 \else
200 \ifnum\lastnodetype>\m@ne
201 \vskip-\baselineskip
202 \fi
203 \fi
204 \vrule\@width\z@\@height\z@\@depth\dp#1}
205 \def\@array[#1]#2{
206 \@tempdima \ht \strutbox
207 \advance \@tempdima by\extrarowheight
208 \setbox \@arstrutbox \hbox{\vrule
209 \@height \arraystretch \@tempdima
210 \@depth \arraystretch \dp \strutbox
211 \@width \z@}%
212 \tbl_init_cell_data_for_table:
213 \begingroup
214 \@mkpream{#2}%
215 \tbl_count_table_cols:
216 \xdef\@preamble{
217 \noexpand \ar@ialign
218 \@halignto
219 \bgroup \@arstrut
220 \UseTaggingSocket{tbl/row/begin}
221 \tbl_init_cell_data_for_row:
222 \@preamble
223 \tabskip \z@ \cr}
224 \endgroup
225 \@arrayleft
226 \if #1t\vtop \else \if#1b\vbox \else \vcenter \fi \fi
227 \bgroup
228 \let \@sharp ##\let \protect \relax
229 \lineskip \z@
230 \baselineskip \z@
231 \mathsurround \z@
232 \let\\\@arraycr \let\tabularnewline\\%
233 \def\par{\ifnum\currentgrouptype=6~ \else\@@par\fi}%
234 \UseTaggingSocket{tbl/init}
235 \@preamble
236 }
237 \def\ar@ialign{%
238 \everycr{%
239 \noalign{%
240 \tbl_if_row_was_started:T { \UseTaggingSocket{tbl/row/end} }
241 \tbl_update_cell_data_for_next_row:
242 }%
243 }%
244 \tabskip\z@skip\halign}
245 \def\arraybackslash{\let\\\tabularnewline}
246 \newdimen \extrarowheight
247 \extrarowheight=0pt
248 \def\@arstrut{\unhcopy\@arstrutbox}
249 \protected\def\@arraycr {
250 \tbl_count_missing_cells:n {@arraycr}
251 \iffalse{\fi\ifnum 0=`}\fi
252 \@ifstar \@xarraycr \@xarraycr}
253
254 \def\@xarraycr{\@ifnextchar [%
255 \@argarraycr {\ifnum 0=`{}\fi\cr}}
256 \def\@argarraycr[#1]{\ifnum0=`{}\fi\ifdim #1>\z@
257 \expandafter\@xargarraycr\else
258 \expandafter\@yargarraycr\fi{#1}}
259 \def\@xargarraycr#1{\unskip\gdef\do@row@strut
260 {\@tempdima #1\advance\@tempdima \dp\@arstrutbox
261 \vrule \@depth\@tempdima \@width\z@\global\let\do@row@strut\relax}%
262 \ifnum\@multicnt >\z@ \do@row@strut \fi
263 \cr}
264 \let\do@row@strut\relax
265 \long\def\multicolumn#1#2#3{%
266 \multispan{#1}\begingroup
267 \tbl_update_multicolumn_cell_data:n {#1}
268 \def\@addamp{\if@firstamp \@firstampfalse \else
269 \@preamerr 5\fi}%
270 \@mkpream{#2}\@addtopreamble\@empty
271 \endgroup
272 \UseTaggingSocket{tbl/colspan}{#1}%
273 \def\@sharp{#3}%
274 \@arstrut \@preamble
275 \null
276 \ignorespaces}
277 \let\d@llarbegin\begingroup
278 \let\d@llarend\endgroup
279 \def\array{\col@sep\arraycolsep
280 \def\d@llarbegin{$\tag_socket_use:n { math/luamml/array/initcol }}
281 \def\d@llarend
282 {
283 \tag_socket_use:nn { math/luamml/save/nn }{{}{mtd}}
284 $
285 \tag_socket_use:nn { math/luamml/array/finalizecol}{\the\@chnum}
286 }
287 \def\@halignto{}%
288 \@tabarray}
289 \def\tabular{\def\@halignto{}\@tabular}
290 \expandafter\def\csname tabular*\endcsname#1{%
291 \setlength\dimen@{#1}%
292 \edef\@halignto{to\the\dimen@}\@tabular}
293 \providecommand\UseMathForPositioningText{}
294 \providecommand\@kernel@tabular@init{}
295 \def\@tabular{%
296 \leavevmode
297 \UseTaggingSocket{tbl/hmode/begin}%
298 \hbox \bgroup
299 \UseMathForPositioningText $%
300 \col@sep\tabcolsep
301 \let\d@llarbegin\begingroup
302 \let\d@llarend\endgroup
303 \@kernel@tabular@init
304 \@tabarray}
305 \def\endarray {
306 \tbl_crcr:n{endarray}
307 \tag_socket_use_expandable:n { math/luamml/array/save }
308 \egroup
309 \tag_socket_use:n { tbl/finalize }
310 \tbl_restore_outer_cell_data:
311 \egroup
312 \tag_socket_use:n { math/luamml/array/finalize }
313 \@arrayright \gdef\@preamble{}%
314 }
315 \def\endtabular{\endarray\m@th $\egroup
316 \UseTaggingSocket{tbl/hmode/end}%
317 }
318 \expandafter\let\csname endtabular*\endcsname=\endtabular
319 \let\@ampacol=\relax \let\@expast=\relax
320 \let\@arrayclassiv=\relax \let\@arrayclassz=\relax
321 \let\@tabclassiv=\relax \let\@tabclassz=\relax
322 \let\@arrayacol=\relax \let\@tabacol=\relax
323 \let\@tabularcr=\relax \let\@@endpbox=\relax
324 \let\@argtabularcr=\relax \let\@xtabularcr=\relax
325 \ExplSyntaxOff
326 \def\@preamerr#1{\def\@tempd{{..} at wrong position: }%
327 \PackageError{array}{%
328 \ifcase #1 Illegal pream-token (\@nextchar): `c' used\or %0
329 Missing arg: token ignored\or %1
330 Empty preamble: `l' used\or %2
331 >\@tempd token ignored\or %3
332 <\@tempd changed to !{..}\or %4
333 Only one column-spec. allowed.\fi}\@ehc} %5
334 \def\newcolumntype#1{%
335 \edef\NC@char{\string#1}%
336 \@ifundefined{NC@find@\NC@char}%
337 {\@tfor\next:=<>clrmbp@!|\do
338 {%
339 \if\expandafter\noexpand\next\NC@char
340 \PackageWarning{array}%
341 {Redefining primitive column \NC@char}\fi}%
342 \NC@list\expandafter{\the\NC@list\NC@do#1}}%
343 {\PackageWarning{array}{Column \NC@char\space is already defined}}%
344 \@namedef{NC@find@\NC@char}##1#1{\NC@{##1}}%
345 \@ifnextchar[{\newcol@{\NC@char}}{\newcol@{\NC@char}[0]}}
346 \ExplSyntaxOn
347 \def\newcol@#1[#2]#3{\expandafter\@reargdef
348 \csname NC@rewrite@#1\endcsname[#2]{\NC@find#3}}
349 \def\NC@#1{%
350 \@temptokena\expandafter{\the\@temptokena#1}\futurelet\next\NC@ifend}
351 \def\NC@ifend{%
352 \ifx\next\relax
353 \else\@tempswatrue\expandafter\NC@rewrite\fi}
354 \def\NC@do#1{%
355 \expandafter\let\expandafter\NC@rewrite
356 \csname NC@rewrite@\string#1\endcsname
357 \expandafter\let\expandafter\NC@find
358 \csname NC@find@\string#1\endcsname
359 \expandafter\@temptokena\expandafter{\expandafter}%
360 \expandafter\NC@find\the\@temptokena#1\relax}
361 \def\showcols{{\def\NC@do##1{\let\NC@do\NC@show}\the\NC@list}}
362 \def\NC@show#1{%
363 \typeout{Column~ #1\expandafter\expandafter\expandafter\NC@strip
364 \expandafter\meaning\csname NC@rewrite@#1\endcsname\@@}}
365 \ExplSyntaxOff
366 \def\NC@strip#1:#2->#3 #4\@@{#2 -> #4}
367 \ExplSyntaxOn
368 \newtoks\NC@list
369 \newcolumntype{*}[2]{}
370 \long\@namedef{NC@rewrite@*}#1#2{%
371 \count@#1\relax
372 \loop
373 \ifnum\count@>\z@
374 \advance\count@\m@ne
375 \@temptokena\expandafter{\the\@temptokena#2}%
376 \repeat
377 \NC@find}
378 \let\@xexpast\relax
379 \let\@xexnoop\relax
380 \def\save@decl{\toks \count@ = \expandafter\expandafter\expandafter
381 {\expandafter\@nextchar\the\toks\count@}}
382 \ExplSyntaxOff % really oldstyle using \@tfor :=
383 \def\@mkpream#1{\gdef\@preamble{}\@lastchclass 4 \@firstamptrue
384 \let\@sharp\relax
385 \def\@startpbox##1{\unexpanded\expandafter{\expandafter
386 \@startpbox@action\expandafter{##1}}}%
387 \def\@startpbox@action##1{\unexpanded{\@startpbox@action{##1}}}%
388 \let\@endpbox\relax
389 \let\do@row@strut\relax
390 \let\ar@align@mcell\relax
391 \@temptokena{#1}\@tempswatrue
392 \@whilesw\if@tempswa\fi{\@tempswafalse\the\NC@list}%
393 \count@\m@ne
394 \let\the@toks\relax
395 \prepnext@tok
396 \expandafter \@tfor \expandafter \@nextchar
397 \expandafter :\expandafter =\the\@temptokena \do
398 {\@testpach
399 \ifcase \@chclass \@classz \or \@classi \or \@classii
400 \or \save@decl \or \or \@classv \or \@classvi
401 \or \@classvii \or \@classviii
402 \or \@classx
403 \or \@classx \fi
404 \@lastchclass\@chclass}%
405 \ifcase\@lastchclass
406 \@acol \or
407 \or
408 \@acol \or
409 \@preamerr \thr@@ \or
410 \@preamerr \tw@ \@addtopreamble\@sharp \or
411 \or
412 \else \@preamerr \@ne \fi
413 \def\the@toks{\the\toks}}
414 \ExplSyntaxOn
415 \let\@classix\relax
416 \def\@classviii{\ifnum \@lastchclass >\z@\ifnum\@lastchclass=\tw@\else
417 \@preamerr 4\@chclass 6 \@classvi \fi\fi}
418 \def\@classv{\save@decl
419 \expandafter\NC@ecs\@nextchar\extracolsep{}\extracolsep\@@__tbl
420 \@addtopreamble{\d@llarbegin\the@toks\the\count@\relax\d@llarend}%
421 \prepnext@tok}
422 \def\NC@ecs#1\extracolsep#2#3\extracolsep#4\@@__tbl{\def\@tempa{#2}%
423 \ifx\@tempa\@empty\else\toks\count@={#1\tabskip#2\relax#3}\fi}
424 \def\@tabarray{\@ifnextchar[{\@@array}{\@@array[c]}}
425 \let\@@array\@array
426 \let\@arrayleft\@empty
427 \let\@arrayright\@empty
428 \newlength{\extratabsurround}
429 \setlength{\extratabsurround}{2pt}
430 \newlength{\backup@length}
431 \newcommand{\firsthline}{%
432 \multicolumn1{@{}c@{}}{%
433 \global\backup@length\ht\@arstrutbox
434 \global\advance\backup@length\dp\@arstrutbox
435 \global\advance\backup@length\arrayrulewidth
436 \raise\extratabsurround\copy\@arstrutbox
437 \kern-1sp%
438 }\\[-\backup@length]\hline
439 }
440 \newcommand{\lasthline}{\hline\multicolumn1{@{}c@{}}{%
441 \global\backup@length2\ht\@arstrutbox
442 \global\advance\backup@length2\dp\@arstrutbox
443 \global\advance\backup@length\arrayrulewidth
444 }\\[-\backup@length]%
445 \multicolumn1{@{}c@{}}{%
446 \lower\extratabsurround\copy\@arstrutbox
447 \kern-1sp%
448 }%
449 }
450 \CheckCommand*\@xhline{\ifx\reserved@a\hline
451 \vskip\doublerulesep
452 \vskip-\arrayrulewidth
453 \fi
454 \ifnum0=`{\fi}}
455 \renewcommand*\@xhline{\ifx\reserved@a\hline
456 \vskip\doublerulesep
457 \fi
458 \ifnum0=`{\fi}}
459
460 \newsavebox\ar@cellbox
461 \newcolumntype{w}[2]{%
462 >{\begin{lrbox}\ar@cellbox\d@llarbegin}%
463 c%
464 <{\d@llarend \end{lrbox}%
465 \makebox[#2][#1]{\unhbox\ar@cellbox}}}
466
467 \newcolumntype{W}[2]
468 {>{\begin{lrbox}\ar@cellbox\d@llarbegin}%
469 c%
470 <{\d@llarend\end{lrbox}%
471 \let\hss\hfil
472 \makebox[#2][#1]{\unhbox\ar@cellbox}}}
473 \ExplSyntaxOn
474 \def\@cline#1-#2\@nil{
475 \omit
476 \@multicnt#1
477 \advance\@multispan\m@ne
478 \ifnum\@multicnt=\@ne\@firstofone{&\omit}\fi
479 \@multicnt#2
480 \advance\@multicnt-#1
481 \advance\@multispan\@ne
482 \UseTaggingSocket{tbl/leaders/begin}
483 \leaders\hrule\@height\arrayrulewidth\hfill
484 \UseTaggingSocket{tbl/leaders/end}
485 \tbl_gdecr_row_count:
486 \cr
487 \noalign{\vskip-\arrayrulewidth}
488 }
489 \ExplSyntaxOff
490 \endinput
491 %%
492 %% End of file `array.sty'.