Debian Codegraph @

texmf-dist/tex/latex/colortbl/colortbl.sty

raw
1 %%
2 %% This is file `colortbl.sty',
3 %% generated with the docstrip utility.
4 %%
5 %% The original source files were:
6 %%
7 %% colortbl.dtx (with options: `package')
8 %%
9 %%
10 %% Source File: `colortbl.dtx'.
11 %% Copyright 1996 1998 1999 2012 2018 2020 2022 2024 2026 David Carlisle
12 %%
13 %% This file may be distributed under the terms of the LPPL.
14 %% See readme for details.
15 %%
16 \NeedsTeXFormat{LaTeX2e}[1995/06/01]
17 \ProvidesPackage{colortbl}
18 [2026/05/01 v1.0l Color table columns (DPC)]
19 \edef\@tempa{%
20 \noexpand\AtEndOfPackage{%
21 \catcode`\noexpand\^^A\the\catcode`\^^A\relax}}
22 \@tempa
23 \catcode`\^^A=\catcode`\%
24 \DeclareOption{debugshow}{\catcode`\^^A=9 }
25 \DeclareOption*{\PassOptionsToPackage\CurrentOption{color}}
26 \ProcessOptions
27 \RequirePackage{array,color}
28 \ifx\do@row@strut\@undefined\let\do@row@strut\relax\fi
29 \def\@classz{\@classx
30 \@tempcnta \count@
31 \prepnext@tok
32 \expandafter\CT@extract\the\toks\@tempcnta\columncolor!\@nil
33 \@addtopreamble{%
34 \setbox\z@\hbox\bgroup\bgroup
35 \CT@everycr{}%
36 \ifcase \@chnum
37 \hskip\stretch{.5}\kern\z@
38 \d@llarbegin
39 \insert@column
40 \d@llarend\do@row@strut\hskip\stretch{.5}\or
41 \d@llarbegin \insert@column \d@llarend\do@row@strut \hfill
42 \or
43 \hfill\kern\z@ \d@llarbegin \insert@column \d@llarend\do@row@strut
44 \or
45 \ifx\ar@align@mcell\@undefined
46 $\vcenter
47 \@startpbox{\@nextchar}\insert@pcolumn \@endpbox $
48 \else
49 \setbox\ar@mcellbox\vbox
50 \@startpbox{\@nextchar}\insert@pcolumn \@endpbox
51 \ar@align@mcell
52 \do@row@strut
53 \fi
54 \or
55 \vtop \@startpbox{\@nextchar}\insert@pcolumn \@endpbox\do@row@strut
56 \or
57 \vbox \@startpbox{\@nextchar}\insert@pcolumn \@endpbox\do@row@strut
58 \fi
59 \egroup\egroup
60 \begingroup
61 \CT@setup
62 \CT@column@color
63 \CT@row@color
64 \CT@cell@color
65 \CT@do@color
66 \endgroup
67 \@tempdima\ht\z@
68 \advance\@tempdima\minrowclearance
69 \vrule\@height\@tempdima\@width\z@
70 \unhbox\z@}%
71 \prepnext@tok}
72 \def\CT@setup{%
73 \@tempdimb\col@sep
74 \@tempdimc\col@sep
75 \def\CT@color{%
76 \global\let\CT@do@color\CT@@do@color
77 \color}}
78 \def\CT@@do@color{%
79 \global\let\CT@do@color\relax
80 \@tempdima\wd\z@
81 \advance\@tempdima\@tempdimb
82 \advance\@tempdima\@tempdimc
83 \kern-\@tempdimb
84 \leaders\vrule
85 ^^A \@height\p@\@depth\p@
86 \hskip\@tempdima\@plus 1fill
87 \kern-\@tempdimc
88 \hskip-\wd\z@ \@plus -1fill }
89 \def\CT@extract#1\columncolor#2#3\@nil{%
90 \if!\noexpand#2%
91 \let\CT@column@color\@empty
92 \else
93 \if[\noexpand#2%
94 \CT@extractb{#1}#3\@nil
95 \else
96 \def\CT@column@color{%
97 \CT@color{#2}}%
98 \CT@extractd{#1}#3\@nil
99 \fi
100 \fi}
101 \def\CT@extractb#1#2]#3{%
102 \def\CT@column@color{%
103 \CT@color[#2]{#3}}%
104 \CT@extractd{#1}}%
105 \def\CT@extractd#1{\@testopt{\CT@extracte{#1}}\col@sep}
106 \def\CT@extracte#1[#2]{\@testopt{\CT@extractf{#1}[#2]}{#2}}
107 {\catcode`\!\active
108 \gdef\CT@extractf#1[#2][#3]#4\columncolor#5\@nil{%
109 \@tempdimb#2\relax
110 \@tempdimc#3\relax
111 \edef!{\string!}%
112 \edef\CT@column@color{%
113 \CT@column@color
114 \@tempdimb\the\@tempdimb\@tempdimc\the\@tempdimc\relax}%
115 \toks\@tempcnta{#1#4}}}%
116 \let\CT@everycr\everycr
117 \IfPackageAtLeastTF{array}{2026/02/24}
118 {
119 \typeout{new hooks used!!}
120 \AddToHook{tbl/row/end}{\global\let\CT@row@color\relax}
121 \AddToHook{tbl/row/init}{\@rowc@lors}
122 }
123 {
124 \newtoks\everycr
125 \CT@everycr{\noalign{\global\let\CT@row@color\relax}\the\everycr}
126 }
127 \def\CT@start{%
128 \let\CT@arc@save\CT@arc@
129 \let\CT@drsc@save\CT@drsc@
130 \let\CT@row@color@save\CT@row@color
131 \let\CT@cell@color@save\CT@cell@color
132 \global\let\CT@cell@color\relax}
133 \def\CT@end{%
134 \global\let\CT@arc@\CT@arc@save
135 \global\let\CT@drsc@\CT@drsc@save
136 \global\let\CT@row@color\CT@row@color@save
137 \global\let\CT@cell@color\CT@cell@color@save}
138 \gdef\@ishortstack#1{%
139 \CT@start\ialign{\mb@l {##}\unskip\mb@r\cr #1\crcr}\CT@end\egroup}
140 \AtBeginDocument{%
141 \expandafter\def\expandafter\@tabarray\expandafter{%
142 \expandafter\CT@start\@tabarray}}
143 \expandafter\def\expandafter\endarray\expandafter{\endarray\CT@end}
144 \def\@tempa#1\@arstrut#2\relax{
145 \long\def\multicolumn##1##2##3{%
146 #1%
147 \let\CT@cell@color\relax
148 \let\CT@column@color\relax
149 \let\CT@do@color\relax
150 \@arstrut
151 #2}}
152 \expandafter\@tempa\multicolumn{#1}{#2}{#3}\relax
153 \let\@temp\relax
154 \def\@classvi{\ifcase \@lastchclass
155 \@acol \or
156 \ifx\CT@drsc@\relax
157 \@addtopreamble{\hskip\doublerulesep}%
158 \else
159 \@addtopreamble{{\CT@drsc@\vrule\@width\doublerulesep}}%
160 \fi\or
161 \@acol \or
162 \@classvii
163 \fi}
164 \def\doublerulesepcolor#1#{\CT@drs{#1}}
165 \def\CT@drs#1#2{%
166 \ifdim\baselineskip=\z@\noalign\fi
167 {\gdef\CT@drsc@{\color#1{#2}}}}
168 \let\CT@drsc@\relax
169 \def\arrayrulecolor#1#{\CT@arc{#1}}
170 \def\CT@arc#1#2{%
171 \ifdim\baselineskip=\z@\noalign\fi
172 {\gdef\CT@arc@{\color#1{#2}}}}
173 \let\CT@arc@\relax
174 \def\@arrayrule{\@addtopreamble {{\CT@arc@\vline}}}
175 \def\hline{%
176 \noalign{\ifnum0=`}\fi
177 \let\hskip\vskip
178 \let\vrule\hrule
179 \let\@width\@height
180 {\CT@arc@\vline}%
181 \futurelet
182 \reserved@a\@xhline}
183 \def\@xhline{\ifx\reserved@a\hline
184 {\ifx\CT@drsc@\relax
185 \vskip
186 \else
187 \CT@drsc@\hrule\@height
188 \fi
189 \doublerulesep}%
190 \fi
191 \ifnum0=`{\fi}}
192 \def\@cline#1-#2\@nil{%
193 \omit
194 \@multicnt#1%
195 \advance\@multispan\m@ne
196 \ifnum\@multicnt=\@ne\@firstofone{&\omit}\fi
197 \@multicnt#2%
198 \advance\@multicnt-#1%
199 \advance\@multispan\@ne
200 \UseTaggingSocket{tbl/leaders/begin}%
201 {\CT@arc@\leaders\hrule\@height\arrayrulewidth\hfill}%
202 \UseTaggingSocket{tbl/leaders/end}%
203 \CT@tbl@gdecr@row@count
204 \cr
205 \noalign{\vskip-\arrayrulewidth}}
206 \newlength\minrowclearance
207 \minrowclearance=0pt
208 \let\@mkpreamarray\@mkpream
209 \def\@mkpream{%
210 \let\CT@setup\relax
211 \let\CT@color\relax
212 \let\CT@do@color\relax
213 \let\color\relax
214 \let\CT@column@color\relax
215 \let\CT@row@color\relax
216 \let\CT@cell@color\relax
217 \@mkpreamarray}
218 \let\CT@do@color\relax
219 \def\rowcolor{%
220 \noalign{\ifnum0=`}\fi
221 \global\let\CT@do@color\CT@@do@color
222 \@ifnextchar[\CT@rowa\CT@rowb}
223 \def\CT@rowa[#1]#2{%
224 \gdef\CT@row@color{\CT@color[#1]{#2}}%
225 \CT@rowc}
226 \def\CT@rowb#1{%
227 \gdef\CT@row@color{\CT@color{#1}}%
228 \CT@rowc}
229 \def\CT@rowc{%
230 \@ifnextchar[\CT@rowd{\ifnum`{=0\fi}}}
231 \def\CT@rowd[#1]{\@testopt{\CT@rowe[#1]}{#1}}
232 \def\CT@rowe[#1][#2]{%
233 \@tempdimb#1%
234 \@tempdimc#2%
235 \xdef\CT@row@color{%
236 \expandafter\noexpand\CT@row@color
237 \@tempdimb\the\@tempdimb
238 \@tempdimc\the\@tempdimc
239 \relax}%
240 \ifnum0=`{\fi}}
241 \def\@ifxempty#1{\@@ifxempty#1\@@ifxempty\XC@@}
242 \def\@@ifxempty#1#2\XC@@
243 {\ifx#1\@@ifxempty
244 \expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi}
245 \def\rowcolors
246 {\@ifstar{\@rowcmdfalse\rowc@lors}{\@rowcmdtrue\rowc@lors}}
247 \def\rowc@lors{\@testopt{\rowc@l@rs}{}}
248 \def\rowc@l@rs[#1]#2#3#4%
249 {\global\rownum=\z@
250 \global\@rowcolorstrue
251 \@ifxempty{#3}%
252 {\def\@oddrowcolor{\@norowcolor}}%
253 {\def\@oddrowcolor{\gdef\CT@row@color{\CT@color{#3}}}}%
254 \@ifxempty{#4}%
255 {\def\@evenrowcolor{\@norowcolor}}%
256 {\def\@evenrowcolor{\gdef\CT@row@color{\CT@color{#4}}}}%
257 \if@rowcmd
258 \def\@rowcolors
259 {#1\if@rowcolors
260 \noalign{\relax\ifnum\rownum<#2\@norowcolor\else
261 \ifodd\rownum\@oddrowcolor\else\@evenrowcolor\fi\fi}%
262 \fi}%
263 \else
264 \def\@rowcolors
265 {\if@rowcolors
266 \ifnum\rownum<#2\noalign{\@norowcolor}\else
267 #1\noalign{\ifodd\rownum\@oddrowcolor\else\@evenrowcolor\fi}\fi
268 \fi}%
269 \fi
270 \CT@everycr{\@rowc@lors\the\everycr}%
271 \ignorespaces}
272 \def\@rowc@lors{\noalign{\global\advance\rownum\@ne}\@rowcolors}
273 \let\@rowcolors\@empty
274 \def\showrowcolors{\noalign{\global\@rowcolorstrue}\@rowcolors}
275 \def\hiderowcolors{\noalign{\global\@rowcolorsfalse\@norowcolor}}
276 \def\@norowcolor{\global\let\CT@row@color\relax}
277 \@norowcolor
278 \newif\if@rowcolors
279 \newif\if@rowcmd
280 \@ifundefined{rownum}{%
281 \@ifundefined{c@rownum}%
282 {\newcount\rownum\let\c@rownum\rownum}%
283 {\let\rownum\c@rownum}%
284 }%
285 {\let\c@rownum\rownum}
286 \providecommand\therownum{\arabic{rownum}}
287 \edef\cellcolor{\noexpand\protect
288 \expandafter\noexpand\csname cellcolor \endcsname}
289 \@namedef{cellcolor }{%
290 \@ifnextchar[{\CT@cellc\@firstofone}{\CT@cellc\@gobble[]}%
291 }
292 \def\CT@cellc#1[#2]#3{%
293 \expandafter\gdef\expandafter\CT@cell@color\expandafter{%
294 \expandafter\CT@color#1{[#2]}{#3}%
295 \global\let\CT@cell@color\relax
296 }}
297 \global\let\CT@cell@color\relax
298 \AtBeginDocument{%
299 \def\@tempa{$\hfil\egroup\box\z@\box\tw@}%
300 \ifx\@tempa\DC@endright
301 \def\DC@endright{%
302 $\hfil\egroup
303 \ifx\DC@rl\bgroup
304 \hskip\stretch{-.5}\box\z@\box\tw@\hskip\stretch{-.5}%
305 \else
306 \box\z@\box\tw@
307 \fi}%
308 \else
309 \def\@tempa{$\hfil\egroup\hfill\box\z@\box\tw@}%
310 \ifx\@tempa\DC@endright
311 \def\DC@endright{%
312 $\hfil\egroup%
313 \hskip\stretch{.5}\box\z@\box\tw@\hskip\stretch{-.5}}%
314 \fi
315 \fi}
316 \AtBeginDocument{%
317 \ifx\hhline\@undefined\else
318 \def\HH@box#1#2{\vbox{{%
319 \ifx\CT@drsc@\relax\else
320 \global\dimen\thr@@\tw@\arrayrulewidth
321 \global\advance\dimen\thr@@\doublerulesep
322 {\CT@drsc@
323 \hrule \@height\dimen\thr@@
324 \vskip-\dimen\thr@@}%
325 \fi
326 \CT@arc@
327 \hrule \@height \arrayrulewidth \@width #1
328 \vskip\doublerulesep
329 \hrule \@height \arrayrulewidth \@width #2}}}
330 \def\HH@loop{%
331 \ifx\@tempb`\def\next##1{%
332 \the\toks@\CT@tbl@gdecr@row@count\cr}\else\let\next\HH@let
333 \ifx\@tempb|\if@tempswa
334 \ifx\CT@drsc@\relax
335 \HH@add{\hskip\doublerulesep}%
336 \else
337 \HH@add{{\CT@drsc@\vrule\@width\doublerulesep}}%
338 \fi
339 \fi\@tempswatrue
340 \HH@add{{\CT@arc@\vline}}\else
341 \ifx\@tempb:\if@tempswa
342 \ifx\CT@drsc@\relax
343 \HH@add{\hskip\doublerulesep}%
344 \else
345 \HH@add{{\CT@drsc@\vrule\@width\doublerulesep}}%
346 \fi
347 \fi\@tempswatrue
348 \HH@add{\@tempc\HH@box\arrayrulewidth\arrayrulewidth\@tempc}\else
349 \ifx\@tempb##\if@tempswa\HH@add{\hskip\doublerulesep}\fi\@tempswatrue
350 \HH@add{{\CT@arc@\vline\copy\@ne\@tempc\vline}}\else
351 \ifx\@tempb~\@tempswafalse
352 \if@firstamp\@firstampfalse\else\HH@add{&\omit}\fi
353 \ifx\CT@drsc@\relax
354 \HH@add{\hfil}\else
355 \HH@add{{%
356 \CT@drsc@\leaders\hrule\@height\HH@height\hfil}}%
357 \fi
358 \else
359 \ifx\@tempb-\@tempswafalse
360 \gdef\HH@height{\arrayrulewidth}%
361 \if@firstamp\@firstampfalse\else\HH@add{&\omit}\fi
362 \HH@add{{%
363 \CT@arc@\leaders\hrule\@height\arrayrulewidth\hfil}}%
364 \else
365 \ifx\@tempb=\@tempswafalse
366 \gdef\HH@height{\dimen\thr@@}%
367 \if@firstamp\@firstampfalse\else\HH@add{&\omit}\fi
368 \HH@add
369 {\rlap{\copy\@ne}\leaders\copy\@ne\hfil\llap{\copy\@ne}}\else
370 \ifx\@tempb t\HH@add{%
371 \def\HH@height{\dimen\thr@@}%
372 \HH@box\doublerulesep\z@}\@tempswafalse\else
373 \ifx\@tempb b\HH@add{%
374 \def\HH@height{\dimen\thr@@}%
375 \HH@box\z@\doublerulesep}\@tempswafalse\else
376 \ifx\@tempb>\def\next##1##2{%
377 \HH@add{%
378 {\baselineskip\p@\relax
379 ##2%
380 \global\setbox\@ne\HH@box\doublerulesep\doublerulesep}}%
381 \HH@let!}\else
382 \ifx\@tempb\@sptoken\let\next\HH@spacelet\else
383 \PackageWarning{hhline}%
384 {\meaning\@tempb\space ignored in \noexpand\hhline argument%
385 \MessageBreak}%
386 \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
387 \next}
388 \lowercase{\def\HH@spacelet} {\futurelet\@tempb \HH@loop}
389 \fi}
390 \ExplSyntaxOn
391 \let\CT@tbl@gdecr@row@count\tbl_gdecr_row_count:
392 \cs_if_exist:NF\tag_mc_begin:n{
393 \cs_new:Npn\tag_mc_begin:n#1{}
394 \cs_new:Npn\tag_mc_end:{}
395 }
396 \AtBeginDocument{
397 \def\LT@@hline{%
398 \ifx\LT@next\hline
399 \global\let\LT@next\@gobble
400 \ifx\CT@drsc@\relax
401 \gdef\CT@LT@sep{%
402 \noalign{\penalty-\@medpenalty\vskip\doublerulesep}}%
403 \else
404 \gdef\CT@LT@sep{%
405 \multispan\LT@cols{%
406 \tag_mc_begin:n{artifact}
407 \CT@drsc@\leaders\hrule\@height\doublerulesep\hfill
408 \tag_mc_end: \tbl_gdecr_row_count:
409 }\cr}%
410 \fi
411 \else
412 \global\let\LT@next\empty
413 \gdef\CT@LT@sep{%
414 \noalign{\penalty-\@lowpenalty\vskip-\arrayrulewidth}}%
415 \fi
416 \ifnum0=`{\fi}%
417 \multispan\LT@cols
418 {\tag_mc_begin:n{artifact}
419 \CT@arc@\leaders\hrule\@height\arrayrulewidth\hfill
420 \tag_mc_end: \tbl_gdecr_row_count:
421 }\cr
422 \CT@LT@sep
423 \multispan\LT@cols
424 {\tag_mc_begin:n{artifact}
425 \CT@arc@\leaders\hrule\@height\arrayrulewidth\hfill
426 \tag_mc_end: \tbl_gdecr_row_count:
427 }\cr
428 \noalign{\penalty\@M}%
429 \LT@next}
430 }
431 \ExplSyntaxOff
432 \endinput
433 %%
434 %% End of file `colortbl.sty'.