Debian Codegraph @

texmf-dist/tex/latex/tools/array.sty

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