| 1 |
% \iffalse |
| 2 |
%% |
| 3 |
%% Source File: `colortbl.dtx'. |
| 4 |
%% Copyright 1996 1998 1999 2012 2018 2020 2022 2024 2026 David Carlisle |
| 5 |
%% |
| 6 |
%% This file may be distributed under the terms of the LPPL. |
| 7 |
%% See readme for details. |
| 8 |
%% |
| 9 |
% |
| 10 |
%<*dtx> |
| 11 |
\ProvidesFile{colortbl.dtx} |
| 12 |
%</dtx> |
| 13 |
%<package>\NeedsTeXFormat{LaTeX2e}[1995/06/01] |
| 14 |
%<package>\ProvidesPackage{colortbl} |
| 15 |
%<driver>\ProvidesFile{colortbl.drv} |
| 16 |
% \fi |
| 17 |
% \ProvidesFile{colortbl.dtx} |
| 18 |
[2026/05/01 v1.0l Color table columns (DPC)] |
| 19 |
% |
| 20 |
% \iffalse |
| 21 |
%<*driver> |
| 22 |
\documentclass{ltxdoc} |
| 23 |
\usepackage |
| 24 |
% [debugshow] |
| 25 |
{colortbl} |
| 26 |
\usepackage{dcolumn,longtable,hhline} |
| 27 |
\setlongtables% in case an old copy of longtable is being used. |
| 28 |
\NewCommandCopy\csorig\cs |
| 29 |
\RenewDocumentCommand\cs{m}{\csorig{\detokenize{#1}}} |
| 30 |
\begin{document} |
| 31 |
\DeleteShortVerb{\|} |
| 32 |
\MakeShortVerb{\"} |
| 33 |
\DocInput{colortbl.dtx} |
| 34 |
\end{document} |
| 35 |
%</driver> |
| 36 |
% \fi |
| 37 |
% |
| 38 |
% \GetFileInfo{colortbl.dtx} |
| 39 |
% \title{The \textsf{colortbl} package\thanks{This file |
| 40 |
% has version number \fileversion, last |
| 41 |
% revised \filedate.}} |
| 42 |
% \author{David Carlisle%\thanks |
| 43 |
% {Report issues to |
| 44 |
% \texttt{https://github.com/davidcarlisle/dpctex/issues}}} |
| 45 |
% \date{\filedate} |
| 46 |
% |
| 47 |
% \maketitle |
| 48 |
% |
| 49 |
% |
| 50 |
% \begin{abstract} |
| 51 |
% This package implements a flexible mechanism for giving colored |
| 52 |
% `panels' behind specified columns in a table. |
| 53 |
% This package requires the \textsf{array} and \textsf{color} packages. |
| 54 |
% \end{abstract} |
| 55 |
% |
| 56 |
% \changes{v0.1}{1996/09/20}{First draft} |
| 57 |
% \changes{v0.1a}{1996/09/21}{Started documentation in doc format} |
| 58 |
% \changes{v0.1b}{1996/09/22} |
| 59 |
% {New scheme: redefine \cs{@classz} rather than just |
| 60 |
% simple \cs{newcolumntype} definition.} |
| 61 |
% \changes{v0.1c}{1996/09/24} |
| 62 |
% {Make overhang arguments optional (suggestion of S. Rahtz).} |
| 63 |
% \changes{v0.1d}{1996/10/05} |
| 64 |
% {\cs{rowcolor} added to make S. Rahtz happy.} |
| 65 |
% \changes{v0.1d}{1996/10/05} |
| 66 |
% {Add \cs{hline} \cs{hhline} and \cs{longtable} support |
| 67 |
% to make S. Rahtz even happier.} |
| 68 |
% \changes{v0.1e}{1996/10/06} |
| 69 |
% {Minor cleanup.} |
| 70 |
% \changes{v0.1f}{1996/10/10} |
| 71 |
% {Better \cs{hhline} and support nested constructs} |
| 72 |
% \changes{v0.1f}{1996/10/12} |
| 73 |
% {0.1f, first public version, had a missing percent....} |
| 74 |
% \changes{v0.1i}{1999/03/24} |
| 75 |
% {LPPL} |
| 76 |
% \changes{v0.1j}{2001/02/13}{\cs{cellcolor} (Donald Arseneau)} |
| 77 |
% \changes{v1.0c}{2018/05/02}{Updates to match new array code} |
| 78 |
% \changes{v1.0d}{2018/12/22}{Updates to match even newer array code} |
| 79 |
% \changes{v1.0e}{2020/01/04}{Updates to match updated hhline} |
| 80 |
% \changes{v1.0f}{2022/06/20}{moved \cs{rowcolors} code from xcolor} |
| 81 |
% |
| 82 |
% \section{Introduction} |
| 83 |
% |
| 84 |
% This package is for coloring tables (i.e., giving colored panels |
| 85 |
% behind column entries). In that it has many similarities with |
| 86 |
% Timothy Van Zandt's \textsf{colortab} package. The internal |
| 87 |
% implementation is quite different though, also \textsf{colortab} |
| 88 |
% works with the table constructs of other formats besides \LaTeX. |
| 89 |
% This package requires \LaTeX\ (and its \textsf{color} and |
| 90 |
% \textsf{array} packages). |
| 91 |
% |
| 92 |
% First, a standard \textsf{tabular}, for comparison. |
| 93 |
% \begin{center} |
| 94 |
%\begin{minipage}{.75\textwidth} |
| 95 |
%\begin{verbatim} |
| 96 |
% \begin{tabular}{|l|c|} |
| 97 |
% one&two\\ |
| 98 |
% three&four |
| 99 |
% \end{tabular} |
| 100 |
%\end{verbatim} |
| 101 |
%\end{minipage} |
| 102 |
% {\bfseries |
| 103 |
% \begin{tabular}{|l|c|} |
| 104 |
% one&two\\ |
| 105 |
% three&four |
| 106 |
% \end{tabular}} |
| 107 |
% \end{center} |
| 108 |
% |
| 109 |
% \section{ The \cs{columncolor} command} |
| 110 |
% |
| 111 |
% The examples below demonstrate various possibilities of the |
| 112 |
% "\columncolor" command introduced by this package. The vertical rules |
| 113 |
% specified by "|" are kept in all the examples, to make the column |
| 114 |
% positioning clearer, although possibly you would not want colored |
| 115 |
% panels \emph{and} vertical rules in practice. |
| 116 |
% |
| 117 |
% The package supplies a "\columncolor" command, that should (only) be |
| 118 |
% used in the argument of a ">" column specifier, to add a colored |
| 119 |
% panel behind the specified column. It can be used in the main |
| 120 |
% `preamble' argument of \textsf{array} or \textsf{tabular}, and also in |
| 121 |
% "\multicolumn" specifiers. |
| 122 |
% |
| 123 |
% The basic format is:\\ |
| 124 |
% "\columncolor"\oarg{color model}\marg{color} |
| 125 |
% \oarg{left overhang}\oarg{right overhang} |
| 126 |
% |
| 127 |
% The first argument (or first two if the optional argument is used) |
| 128 |
% are standard \textsf{color} package arguments, as used by "\color". |
| 129 |
% |
| 130 |
% The last two arguments control how far the panel overlaps past the |
| 131 |
% widest entry in the column. |
| 132 |
% If the \emph{right overhang} argument is omitted then it defaults to |
| 133 |
% \emph{left overhang}. If they are both omitted they default to |
| 134 |
% "\tabcolsep" (in \textsf{tabular}) or "\arraycolsep" |
| 135 |
% (in \textsf{array}). |
| 136 |
% |
| 137 |
% If the overhangs are both set to "0pt" then the effect is: |
| 138 |
% \begin{center} |
| 139 |
%\begin{minipage}{.75\textwidth} |
| 140 |
%\begin{verbatim} |
| 141 |
%|>{\columncolor[gray]{.8}[0pt]}l| |
| 142 |
%>{\color{white}% |
| 143 |
% \columncolor[gray]{.2}[0pt]}l| |
| 144 |
%\end{verbatim} |
| 145 |
%\end{minipage} |
| 146 |
% {\bfseries |
| 147 |
% \begin{tabular}{% |
| 148 |
% |>{\columncolor[gray]{.8}[0pt]}l| |
| 149 |
% >{\color{white}% |
| 150 |
% \columncolor[gray]{.2}[0pt]}l| |
| 151 |
% } |
| 152 |
% one&two\\ |
| 153 |
% three&four |
| 154 |
% \end{tabular}} |
| 155 |
% \end{center} |
| 156 |
% The default overhang of "\tabcolsep" produces: |
| 157 |
%\begin{center} |
| 158 |
%\begin{minipage}{.75\textwidth} |
| 159 |
%\begin{verbatim} |
| 160 |
%|>{\columncolor[gray]{.8}}l| |
| 161 |
%>{\color{white}% |
| 162 |
% \columncolor[gray]{.2}}l| |
| 163 |
%\end{verbatim} |
| 164 |
%\end{minipage} |
| 165 |
% {\bfseries |
| 166 |
% \begin{tabular}{% |
| 167 |
% |>{\columncolor[gray]{.8}}l| |
| 168 |
% >{\color{white}% |
| 169 |
% \columncolor[gray]{.2}}l| |
| 170 |
% } |
| 171 |
% one&two\\ |
| 172 |
% three&four |
| 173 |
% \end{tabular}} |
| 174 |
% \end{center} |
| 175 |
% You might want something between these two extremes. |
| 176 |
% A value of ".5\tabcolsep" produces the following effect |
| 177 |
% \begin{center} |
| 178 |
%\begin{minipage}{.75\textwidth} |
| 179 |
%\begin{verbatim} |
| 180 |
%|>{\columncolor[gray]{.8}[.5\tabcolsep]}l| |
| 181 |
% >{\color{white}% |
| 182 |
% \columncolor[gray]{.2}[.5\tabcolsep]}l| |
| 183 |
%\end{verbatim} |
| 184 |
%\end{minipage} |
| 185 |
% {\bfseries |
| 186 |
% \begin{tabular}{% |
| 187 |
% |>{\columncolor[gray]{.8}[.5\tabcolsep]}l| |
| 188 |
% >{\color{white}\columncolor[gray]{.2}[.5\tabcolsep]}l| |
| 189 |
% } |
| 190 |
% one&two\\ |
| 191 |
% three&four |
| 192 |
% \end{tabular}} |
| 193 |
% \end{center} |
| 194 |
% |
| 195 |
% |
| 196 |
% This package should work with most other packages that are |
| 197 |
% compatible with the \textsf{array} package syntax. In particular it |
| 198 |
% works with \textsf{longtable} and \textsf{dcolumn} |
| 199 |
% as the following example shows. |
| 200 |
%\errorcontextlines10 |
| 201 |
% \newcolumntype{A}{%^^A |
| 202 |
% >{\color{white}\columncolor{red}[.5\tabcolsep]%^^A |
| 203 |
% \raggedright}% |
| 204 |
% p{2cm}} |
| 205 |
% \newcolumntype{B}{%^^A |
| 206 |
% >{\columncolor{blue}[.5\tabcolsep]%^^A |
| 207 |
% \color{yellow}\raggedright} |
| 208 |
% p{3cm}} |
| 209 |
% \newcolumntype{E}{%^^A |
| 210 |
% >{\large\bfseries |
| 211 |
% \columncolor{cyan}[.5\tabcolsep]}c} |
| 212 |
% \newcolumntype{F}{%^^A |
| 213 |
% >{\color{white} |
| 214 |
% \columncolor{magenta}[.5\tabcolsep]}c} |
| 215 |
% \newcolumntype{G}{%^^A |
| 216 |
% >{\columncolor[gray]{0.8}[.5\tabcolsep][\tabcolsep]}l} |
| 217 |
% \newcolumntype{H}{>{\columncolor[gray]{0.8}}l} |
| 218 |
% |
| 219 |
% |
| 220 |
%^^A 3.3 (as used in the verbatim text below) is best but |
| 221 |
%^^A needs a June 96 version of dcolumn, so use -1 here. |
| 222 |
% \newcolumntype{C}{% |
| 223 |
% >{\columncolor{yellow}[.5\tabcolsep]}% |
| 224 |
% D{.}{\cdot}{-1}} |
| 225 |
% \newcolumntype{I}{%^^A |
| 226 |
% >{\columncolor[gray]{0.8}[\tabcolsep][.5\tabcolsep]}%^^A |
| 227 |
% D{.}{\cdot}{-1}} |
| 228 |
% |
| 229 |
% \setlength\minrowclearance{2pt} |
| 230 |
% Before starting give a little space: "\setlength\minrowclearance{2pt}" |
| 231 |
% |
| 232 |
% \begin{longtable}{ABC} |
| 233 |
% \multicolumn{3}{E}{A long table example}\\ |
| 234 |
% \multicolumn{2}{F}{First two columns}& |
| 235 |
% \multicolumn{1}{F}{Third column}\\ |
| 236 |
% \multicolumn{2}{F}{p-type}& |
| 237 |
% \multicolumn{1}{F}{D-type (\textsf{dcolumn})}\endfirsthead |
| 238 |
% \multicolumn{3}{E}{A long table example (continued)}\\ |
| 239 |
% \multicolumn{2}{F}{First two columns}& |
| 240 |
% \multicolumn{1}{F}{Third column}\\ |
| 241 |
% \multicolumn{2}{F}{p-type}& |
| 242 |
% \multicolumn{1}{F}{D-type (\textsf{dcolumn})}\endhead |
| 243 |
% \multicolumn{3}{E}{Continued\ldots}\endfoot |
| 244 |
% \multicolumn{3}{E}{The End}\endlastfoot |
| 245 |
% P-column&and another one&12.34\\ |
| 246 |
% \multicolumn{1}{G}{Total}& |
| 247 |
% \multicolumn{1}{H}{(wrong)}& |
| 248 |
% \multicolumn{1}{I}{100.6}\\ |
| 249 |
% Some long text in the first column&bbb&1.2\\ |
| 250 |
% aaa&and some long text in the second column&1.345\\ |
| 251 |
% \multicolumn{1}{G}{Total}& |
| 252 |
% \multicolumn{1}{H}{(wrong)}& |
| 253 |
% \multicolumn{1}{I}{100.6}\\ |
| 254 |
% aaa&bbb&1.345\\ |
| 255 |
% Note that the colored rules in all columns stretch to accomodate |
| 256 |
% large entries in one column. &bbb&1.345\\ |
| 257 |
% aaa&bbb&100\\ |
| 258 |
% aaa&Depending on your driver you may get unsightly gaps or lines |
| 259 |
% where the `screens' used to produce different shapes interact |
| 260 |
% badly. You may want to cause adjacent panels of the same color by |
| 261 |
% specifying a larger overhang |
| 262 |
% or by adding some negative space (in a "\noalign" between rows.&12.4\\ |
| 263 |
% aaa&bbb&45.3\\ |
| 264 |
% \end{longtable} |
| 265 |
% |
| 266 |
% This |
| 267 |
% example shows rather poor taste but is quite colorful! |
| 268 |
% Inspect the source file, "colortbl.dtx", to see the full code for |
| 269 |
% the example, but it uses the following column types. |
| 270 |
%\begin{verbatim} |
| 271 |
% \newcolumntype{A}{% |
| 272 |
% >{\color{white}\columncolor{red}[.5\tabcolsep]% |
| 273 |
% \raggedright}% |
| 274 |
% p{2cm}} |
| 275 |
% \newcolumntype{B}{% |
| 276 |
% >{\columncolor{blue}[.5\tabcolsep]% |
| 277 |
% \color{yellow}\raggedright} |
| 278 |
% p{3cm}} |
| 279 |
% \newcolumntype{C}{% |
| 280 |
% >{\columncolor{yellow}[.5\tabcolsep]}% |
| 281 |
% D{.}{\cdot}{3.3}} |
| 282 |
% \newcolumntype{E}{% |
| 283 |
% >{\large\bfseries |
| 284 |
% \columncolor{cyan}[.5\tabcolsep]}c} |
| 285 |
% \newcolumntype{F}{% |
| 286 |
% >{\color{white} |
| 287 |
% \columncolor{magenta}[.5\tabcolsep]}c} |
| 288 |
% \newcolumntype{G}{% |
| 289 |
% >{\columncolor[gray]{0.8}[.5\tabcolsep][\tabcolsep]}l} |
| 290 |
% \newcolumntype{H}{>{\columncolor[gray]{0.8}}l} |
| 291 |
% \newcolumntype{I}{% |
| 292 |
% >{\columncolor[gray]{0.8}[\tabcolsep][.5\tabcolsep]}% |
| 293 |
% D{.}{\cdot}{3.3}} |
| 294 |
%\end{verbatim} |
| 295 |
% |
| 296 |
% \section{Using the `overhang' arguments for \textsf{tabular*}} |
| 297 |
% |
| 298 |
% The above is all very well for \textsf{tabular}, but what about |
| 299 |
% \textsf{tabular*}? |
| 300 |
% |
| 301 |
% Here the problem is rather harder. Although \TeX's "\leader" mechanism |
| 302 |
% which is used by this package to insert the `stretchy' colored panels |
| 303 |
% is rather like \emph{glue}, the "\tabskip" glue that is inserted |
| 304 |
% between columns of \textsf{tabular*} (and \textsf{longtable} for that |
| 305 |
% matter) has to be `real glue' and not `leaders'. |
| 306 |
% |
| 307 |
% Within limits the overhang options may be used here. Consider the |
| 308 |
% first table example above. If we use \textsf{tabular*} set to 3\,cm |
| 309 |
% with a preamble setting of |
| 310 |
% \begin{center} |
| 311 |
%\begin{minipage}{.6\textwidth} |
| 312 |
%\begin{verbatim} |
| 313 |
%\begin{tabular*}{3cm}{% |
| 314 |
%@{\extracolsep{\fill}} |
| 315 |
%>{\columncolor[gray]{.8}[0pt][20mm]}l |
| 316 |
%>{\columncolor[gray]{.8}[5mm][0pt]}l |
| 317 |
%@{}} |
| 318 |
%\end{verbatim} |
| 319 |
%\end{minipage} |
| 320 |
% {\bfseries |
| 321 |
% \begin{tabular*}{3cm}{% |
| 322 |
% @{\extracolsep{\fill}} |
| 323 |
% >{\columncolor[gray]{.8}[0pt][20mm]}l |
| 324 |
% >{\columncolor[gray]{.8}[5mm][0pt]}l |
| 325 |
% @{}% |
| 326 |
% } |
| 327 |
% one&two\\ |
| 328 |
% three&four |
| 329 |
% \end{tabular*}} |
| 330 |
% \end{center} |
| 331 |
% |
| 332 |
% Changing the specified width to 4\,cm works, but don't push your |
| 333 |
% luck to 5\,cm\ldots |
| 334 |
% \begin{center} |
| 335 |
% \bfseries |
| 336 |
% \begin{tabular*}{4cm}{% |
| 337 |
% @{\extracolsep{\fill}} |
| 338 |
% >{\columncolor[gray]{.8}[0pt][20mm]}l |
| 339 |
% >{\columncolor[gray]{.8}[5mm][0pt]}l |
| 340 |
% @{}% |
| 341 |
% } |
| 342 |
% one&two\\ |
| 343 |
% three&four |
| 344 |
% \end{tabular*}\hfill |
| 345 |
% \begin{tabular*}{5cm}{% |
| 346 |
% @{\extracolsep{\fill}} |
| 347 |
% >{\columncolor[gray]{.8}[0pt][20mm]}l |
| 348 |
% >{\columncolor[gray]{.8}[5mm][0pt]}l |
| 349 |
% @{}% |
| 350 |
% } |
| 351 |
% one&two\\ |
| 352 |
% three&four |
| 353 |
% \end{tabular*} |
| 354 |
% \end{center} |
| 355 |
% |
| 356 |
% \section{The \cs{rowcolor} command} |
| 357 |
% |
| 358 |
% As demonstrated above, one may change the color of specified rows |
| 359 |
% of a table by the use of "\multicolumn" commands in each entry of |
| 360 |
% the row. However if your table is to be marked principally by |
| 361 |
% \emph{rows}, you may find this rather inconvenient. For this reason |
| 362 |
% a new mechanism, "\rowcolor", has been introduced\footnote{At some |
| 363 |
% cost to the internal complexity of this package}. |
| 364 |
% |
| 365 |
% "\rowcolor" takes the same argument forms as "\columncolor". It must |
| 366 |
% be used at the \emph{start} of a row. If the optional overhang |
| 367 |
% arguments are not used the overhangs will default to the overhangs |
| 368 |
% specified in any "\columncolor" comands for that column, or |
| 369 |
% "\tabcolsep" ("\arraycolsep" in \textsf{array}). |
| 370 |
% |
| 371 |
% If a table entry is in the scope of a "\columncolor" specified in the |
| 372 |
% table preamble, and also a "\rowcolor" at the start of the current |
| 373 |
% row, the color specified by "\rowcolor" will take effect. A |
| 374 |
% "\multicolumn" command may contain ">{\rowcolor"\ldots\ which will |
| 375 |
% override the default colors for both the current row and column. |
| 376 |
% \begin{center} |
| 377 |
%\begin{minipage}{.75\textwidth} |
| 378 |
%\begin{verbatim} |
| 379 |
% \begin{tabular}{|l|c|} |
| 380 |
% \rowcolor[gray]{.9} |
| 381 |
% one&two\\ |
| 382 |
% \rowcolor[gray]{.5} |
| 383 |
% three&four |
| 384 |
% \end{tabular} |
| 385 |
%\end{verbatim} |
| 386 |
%\end{minipage} |
| 387 |
% {\bfseries |
| 388 |
% \begin{tabular}{|l|c|} |
| 389 |
% \rowcolor[gray]{.9} |
| 390 |
% one&two\\ |
| 391 |
% \rowcolor[gray]{.5} |
| 392 |
% three&four |
| 393 |
% \end{tabular}} |
| 394 |
% \end{center} |
| 395 |
% |
| 396 |
% \section{The \cs{rowcolors} command} |
| 397 |
% The \cs{rowcolors} command and its documentation originate in the \textsf{xcolor} package |
| 398 |
% by Dr.\ Uwe Kern. |
| 399 |
% |
| 400 |
% \DescribeMacro\rowcolors |
| 401 |
% \oarg{commands}\marg{row}\marg{odd-row color}\marg{even-row color}\\ |
| 402 |
% \DescribeMacro{\rowcolors*} |
| 403 |
% \oarg{commands}\marg{row}\marg{odd-row color}\marg{even-row color}\\ |
| 404 |
% One of these commands has to be executed \emph{before} a table starts. |
| 405 |
% \meta{row} tells the number of the first row which should be colored according to the \meta{odd-row color} and \meta{even-row color} scheme. |
| 406 |
% Each of the color arguments may also be left empty (= no color). |
| 407 |
% In the starred version, \meta{commands} are ignored in rows with inactive \emph{rowcolors status} (see below), whereas in the non-starred version, \meta{commands} are applied to every row of the table. |
| 408 |
% Such optional commands may be "\hline" or "\noalign"\marg{stuff}. |
| 409 |
% |
| 410 |
% \DescribeMacro\showrowcolors |
| 411 |
% \DescribeMacro\hiderowcolors |
| 412 |
% The \emph{rowcolors status} is activated (i.e., use coloring scheme) by default and/or "\showrowcolors", it is inactivated (i.e., ignore coloring scheme) by the command "\hiderowcolors". |
| 413 |
% \DescribeMacro\rownum |
| 414 |
% The counter "\rownum" (or \LaTeX\ counter "rownum") |
| 415 |
% may be used within such a table to access the current row number. |
| 416 |
% |
| 417 |
% At the present time, the "rownum" counter is only incremented in tables using "\rowcolors". |
| 418 |
% |
| 419 |
% \begin{center} |
| 420 |
% \begin{minipage}{\textwidth} |
| 421 |
% \begin{verbatim} |
| 422 |
% \rowcolors[\hline]{3}{green}{yellow} \arrayrulecolor{red} |
| 423 |
% \begin{tabular}{ll} |
| 424 |
% test & row \therownum\\ |
| 425 |
% test & row \therownum\\ |
| 426 |
% test & row \therownum\\ |
| 427 |
% test & row \therownum\\ |
| 428 |
% \arrayrulecolor{black} |
| 429 |
% test & row \therownum\\ |
| 430 |
% test & row \therownum\\ |
| 431 |
% \rowcolor{blue} |
| 432 |
% test & row \therownum\\ |
| 433 |
% test & row \therownum\\ |
| 434 |
% \hiderowcolors |
| 435 |
% test & row \therownum\\ |
| 436 |
% test & row \therownum\\ |
| 437 |
% \showrowcolors |
| 438 |
% test & row \therownum\\ |
| 439 |
% test & row \therownum\\ |
| 440 |
% \multicolumn{1}% |
| 441 |
% {>{\columncolor{red}}l}{test} & row \therownum\\ |
| 442 |
% \end{tabular} |
| 443 |
% \end{verbatim} |
| 444 |
% \end{minipage} |
| 445 |
% \hskip-.5\textwidth |
| 446 |
% \rowcolors[\hline]{3}{green}{yellow} \arrayrulecolor{red} |
| 447 |
% \begin{tabular}{ll} |
| 448 |
% test & row \therownum\\ |
| 449 |
% test & row \therownum\\ |
| 450 |
% test & row \therownum\\ |
| 451 |
% test & row \therownum\\ |
| 452 |
% \arrayrulecolor{black} |
| 453 |
% test & row \therownum\\ |
| 454 |
% test & row \therownum\\ |
| 455 |
% \rowcolor{cyan} |
| 456 |
% test & row \therownum\\ |
| 457 |
% test & row \therownum\\ |
| 458 |
% \hiderowcolors |
| 459 |
% test & row \therownum\\ |
| 460 |
% test & row \therownum\\ |
| 461 |
% \showrowcolors |
| 462 |
% test & row \therownum\\ |
| 463 |
% test & row \therownum\\ |
| 464 |
% \multicolumn{1}% |
| 465 |
% {>{\columncolor{magenta}}l}{test} & row \therownum\\ |
| 466 |
% \end{tabular} |
| 467 |
% \qquad |
| 468 |
% \rowcolors*[\hline]{3}{green}{yellow}\arrayrulecolor{red} |
| 469 |
% \begin{tabular}{ll} |
| 470 |
% test & row \therownum\\ |
| 471 |
% test & row \therownum\\ |
| 472 |
% test & row \therownum\\ |
| 473 |
% test & row \therownum\\ |
| 474 |
% \arrayrulecolor{black} |
| 475 |
% test & row \therownum\\ |
| 476 |
% test & row \therownum\\ |
| 477 |
% \rowcolor{blue} |
| 478 |
% test & row \therownum\\ |
| 479 |
% test & row \therownum\\ |
| 480 |
% \hiderowcolors |
| 481 |
% test & row \therownum\\ |
| 482 |
% test & row \therownum\\ |
| 483 |
% \showrowcolors |
| 484 |
% test & row \therownum\\ |
| 485 |
% test & row \therownum\\ |
| 486 |
% \multicolumn{1}% |
| 487 |
% {>{\columncolor{red}}l}{test} & row \therownum\\ |
| 488 |
% \end{tabular} |
| 489 |
% \arrayrulecolor{black} |
| 490 |
% \end{center} |
| 491 |
% |
| 492 |
% \section{The \cs{cellcolor} command} |
| 493 |
% |
| 494 |
% A background color can be applied to a single cell of a table by |
| 495 |
% beginning it with |
| 496 |
% "\multicolumn"\nolinebreak[3]"{1}"\nolinebreak[3]"{>{\rowcolor"\ldots, |
| 497 |
% (or "\columncolor" if no row-color is in effect) but this has some |
| 498 |
% deficiencies: |
| 499 |
% 1)~It prevents data within the cell from triggering the coloration; \ |
| 500 |
% 2)~The alignment specification must be copied from the top of the tabular, |
| 501 |
% which is prone to errors, especially for "p{}" columns; \ |
| 502 |
% 3)~"\multicolumn{1}" is just silly. \ |
| 503 |
% Therefore, there is the \cs{cellcolor} command, which works like |
| 504 |
% \cs{columncolor} and \cs{rowcolor}, but over-rides both of them; |
| 505 |
% \cs{cellcolor} can be placed anywhere in the tabular cell to which |
| 506 |
% it applies. |
| 507 |
% |
| 508 |
% \section{Coloring rules.} |
| 509 |
% |
| 510 |
% So you want colored rules as well? |
| 511 |
% |
| 512 |
% One could do vertical rules without any special commands, just use |
| 513 |
% something like "!{\color{green}\vline}" where you'd |
| 514 |
% normally use "|". The space between "||" will normally be left white. |
| 515 |
% If you want to color that as well, either increase the overhang of |
| 516 |
% the previous column (to |
| 517 |
% "\tabcolsep" + "\arrayrulewidth" + "\doublerulesep") |
| 518 |
% Or remove the inter rule glue, and replace by a colored rule of the |
| 519 |
% required thickness. So |
| 520 |
%\begin{verbatim} |
| 521 |
%!{\color{green}\vline} |
| 522 |
%@{\color{yellow}\vrule width \doublerulesep} |
| 523 |
%!{\color{green}\vline} |
| 524 |
%\end{verbatim} |
| 525 |
% Should give the same spacing as "||" but more color. |
| 526 |
% |
| 527 |
% However coloring "\hline" and "\cline" is a bit more tricky, so |
| 528 |
% extra commands are provided (which then apply to vertical rules as |
| 529 |
% well). |
| 530 |
% |
| 531 |
% \section{\cs{arrayrulecolor}} |
| 532 |
% "\arrayrulecolor" takes the same arguments as "\color", and is a |
| 533 |
% global declaration which affects all following horizontal and |
| 534 |
% vertical rules in tables. It may be given outside any table, or at |
| 535 |
% the start of a row, or in a ">" specification in a table preamble. |
| 536 |
% You should note however that if given mid-table it only affects |
| 537 |
% rules that are specified after this point, any vertical rules |
| 538 |
% specified in the preamble will keep their original colors. |
| 539 |
% |
| 540 |
% \section{\cs{doublerulesepcolor}} |
| 541 |
% Having colored your rules, you'll probably want something other |
| 542 |
% than white to go in the gaps made by "||" or "\hline\hline". |
| 543 |
% "\doublerulesepcolor" works just the same way as "\arrayrulecolor". |
| 544 |
% The main thing to note that if this command is used, then |
| 545 |
% \textsf{longtable} will not `discard' the space between |
| 546 |
% "\hline\hline" at a page break. (\TeX\ has a built-in ability to |
| 547 |
% discard space, but the colored `space' which is used once |
| 548 |
% "\doublerulesep" is in effect is really a third rule of a different |
| 549 |
% color to the two outer rules, and rules are rather harder to |
| 550 |
% discard.) |
| 551 |
% |
| 552 |
% \begin{center} |
| 553 |
% \setlength\arrayrulewidth{2pt}\arrayrulecolor{blue} |
| 554 |
% \setlength\doublerulesep{2pt}\doublerulesepcolor{yellow} |
| 555 |
% |
| 556 |
%\begin{minipage}{.75\textwidth} |
| 557 |
%\begin{verbatim} |
| 558 |
%\setlength\arrayrulewidth{2pt}\arrayrulecolor{blue} |
| 559 |
%\setlength\doublerulesep{2pt}\doublerulesepcolor{yellow} |
| 560 |
% \begin{tabular}{||l||c||} |
| 561 |
% \hline\hline |
| 562 |
% one&two\\ |
| 563 |
% three&four\\ |
| 564 |
% \hline\hline |
| 565 |
% \end{tabular} |
| 566 |
%\end{verbatim} |
| 567 |
%\end{minipage} |
| 568 |
% {\bfseries |
| 569 |
% \begin{tabular}{|l||c||} |
| 570 |
% \hline\hline |
| 571 |
% one&two\\ |
| 572 |
% three&four\\ |
| 573 |
% \hline\hline |
| 574 |
% \end{tabular}} |
| 575 |
% \end{center} |
| 576 |
% |
| 577 |
% \section{More fun with \cs{hhline}} |
| 578 |
% The above commands work with "\hhline" from the \textsf{hhline} |
| 579 |
% package, however if \textsf{hhline} is loaded in addition to this |
| 580 |
% package, a new possibility is added. You may use ">{"\ldots"}" to add |
| 581 |
% declarations that apply to the following "-" or "=" column rule. |
| 582 |
% In particular you may give "\arrayrulecolor" and |
| 583 |
% "\doublerulesepcolor" declarations in this argument. |
| 584 |
% |
| 585 |
% Most manuals of style warn against over use of rules in tables. |
| 586 |
% I hate to think what they would make of the following rainbow |
| 587 |
% example: |
| 588 |
% \begin{center} |
| 589 |
% \setlength\arrayrulewidth{5pt} |
| 590 |
% \setlength\doublerulesep{5pt} |
| 591 |
% \renewcommand{\arraystretch}{2} |
| 592 |
% \definecolor{orange}{cmyk}{0,0.61,0.87,0} |
| 593 |
% \definecolor{indigo}{cmyk}{0.8,0.9,0,0} |
| 594 |
% \definecolor{violet}{cmyk}{0.6,0.9,0,0} |
| 595 |
% \newcommand\rainbowline[1]{%^^A |
| 596 |
% \hhline{%^^A |
| 597 |
% >{\arrayrulecolor {red}\doublerulesepcolor[rgb]{.3,.3,1}}%^^A |
| 598 |
% |#1:=%^^A |
| 599 |
% >{\arrayrulecolor{orange}\doublerulesepcolor[rgb]{.4,.4,1}}%^^A |
| 600 |
% =%^^A |
| 601 |
% >{\arrayrulecolor{yellow}\doublerulesepcolor[rgb]{.5,.5,1}}%^^A |
| 602 |
% =%^^A |
| 603 |
% >{\arrayrulecolor {green}\doublerulesepcolor[rgb]{.6,.6,1}}%^^A |
| 604 |
% =%^^A |
| 605 |
% >{\arrayrulecolor {blue}\doublerulesepcolor[rgb]{.7,.7,1}}%^^A |
| 606 |
% =%^^A |
| 607 |
% >{\arrayrulecolor{indigo}\doublerulesepcolor[rgb]{.8,.8,1}}%^^A |
| 608 |
% =%^^A |
| 609 |
% >{\arrayrulecolor{violet}\doublerulesepcolor[rgb]{.9,.9,1}}%^^A |
| 610 |
% =:#1|%^^A |
| 611 |
% }} |
| 612 |
% \arrayrulecolor{red} |
| 613 |
% \doublerulesepcolor[rgb]{.3,.3,1} |
| 614 |
% \begin{tabular}{||*7{>{\columncolor[gray]{.9}}c}||} |
| 615 |
% \rainbowline{t}%^^A |
| 616 |
% \arrayrulecolor{violet}\doublerulesepcolor[rgb]{.9,.9,1} |
| 617 |
% Richard&of&York&gave&battle&in& |
| 618 |
% \multicolumn{1}{>{\columncolor[gray]{.9}}c||}{vain}\\ |
| 619 |
% \rainbowline{}%^^A |
| 620 |
% 1&2&3&4&5&6& |
| 621 |
% \multicolumn{1}{>{\columncolor[gray]{.9}}c||}{7}\\ |
| 622 |
% \rainbowline{b}%^^A |
| 623 |
% \end{tabular} |
| 624 |
% \end{center} |
| 625 |
%\begin{verbatim} |
| 626 |
% \newcommand\rainbowline[1]{% |
| 627 |
% \hhline{% |
| 628 |
% >{\arrayrulecolor {red}\doublerulesepcolor[rgb]{.3,.3,1}}% |
| 629 |
% |#1:=% |
| 630 |
% >{\arrayrulecolor{orange}\doublerulesepcolor[rgb]{.4,.4,1}}% |
| 631 |
% =% |
| 632 |
% >{\arrayrulecolor{yellow}\doublerulesepcolor[rgb]{.5,.5,1}}% |
| 633 |
% =% |
| 634 |
% >{\arrayrulecolor {green}\doublerulesepcolor[rgb]{.6,.6,1}}% |
| 635 |
% =% |
| 636 |
% >{\arrayrulecolor {blue}\doublerulesepcolor[rgb]{.7,.7,1}}% |
| 637 |
% =% |
| 638 |
% >{\arrayrulecolor{indigo}\doublerulesepcolor[rgb]{.8,.8,1}}% |
| 639 |
% =% |
| 640 |
% >{\arrayrulecolor{violet}\doublerulesepcolor[rgb]{.9,.9,1}}% |
| 641 |
% =:#1|% |
| 642 |
% }} |
| 643 |
% \arrayrulecolor{red} |
| 644 |
% \doublerulesepcolor[rgb]{.3,.3,1}% |
| 645 |
% \begin{tabular}{||*7{>{\columncolor[gray]{.9}}c}||} |
| 646 |
% \rainbowline{t}% |
| 647 |
% \arrayrulecolor{violet}\doublerulesepcolor[rgb]{.9,.9,1} |
| 648 |
% Richard&of&York&gave&battle&in& |
| 649 |
% \multicolumn{1}{>{\columncolor[gray]{.9}}c||}{vain}\\ |
| 650 |
% \rainbowline{}% |
| 651 |
% 1&2&3&4&5&6& |
| 652 |
% \multicolumn{1}{>{\columncolor[gray]{.9}}c||}{7}\\ |
| 653 |
% \rainbowline{b}% |
| 654 |
% \end{tabular} |
| 655 |
%\end{verbatim} |
| 656 |
% |
| 657 |
% \section{Less fun with \cs{cline}} |
| 658 |
% Lines produced by "\cline" are colored if you use |
| 659 |
% "\arrayrulecolor" but you may not notice as they are covered up by |
| 660 |
% any color pannels in the following row. This is a `feature' of |
| 661 |
% "\cline". If using this package you would probably better using the |
| 662 |
% "-" rule type in a "\hhline" argument, rather than "\cline". |
| 663 |
% |
| 664 |
% \section{The \cs{minrowclearance} command} |
| 665 |
% |
| 666 |
% As this package has to box and measure every entry to figure out |
| 667 |
% how wide to make the rules, I thought I may as well add the |
| 668 |
% following feature. `Large' entries in tables may touch a preceding |
| 669 |
% "\hline" or the top of a color panel defined by this style. |
| 670 |
% It is best to increase "\extrarowsep" or "\arraystretch" |
| 671 |
% sufficiently to ensure this doesn't happen, as that will keep the |
| 672 |
% line spacing in the table regular. Sometimes however, you just want |
| 673 |
% to \LaTeX\ to insert a bit of extra space above a large entry. |
| 674 |
% You can set the length "\minrowclearance" to a small value. |
| 675 |
% (The height of a capital letter plus this value should not be |
| 676 |
% greater than the normal height of table rows, else a very uneven |
| 677 |
% table spacing will result.) |
| 678 |
% |
| 679 |
% Donald Arseneau's \textsf{tabls} packages provides a similar |
| 680 |
% "\tablinesep". I was going to give this the same name for |
| 681 |
% compatibility with \textsf{tabls}, but that is implemented quite |
| 682 |
% differently and probably has different behaviour. So I'll keep a new |
| 683 |
% name for now. |
| 684 |
% |
| 685 |
% \StopEventually{} |
| 686 |
% |
| 687 |
% \section{The Code} |
| 688 |
% \begin{macrocode} |
| 689 |
%<*package> |
| 690 |
% \end{macrocode} |
| 691 |
% |
| 692 |
% Nasty hacky way used by all the graphics packages to include debugging |
| 693 |
% code. |
| 694 |
% \begin{macrocode} |
| 695 |
\edef\@tempa{% |
| 696 |
\noexpand\AtEndOfPackage{% |
| 697 |
\catcode`\noexpand\^^A\the\catcode`\^^A\relax}} |
| 698 |
\@tempa |
| 699 |
\catcode`\^^A=\catcode`\% |
| 700 |
\DeclareOption{debugshow}{\catcode`\^^A=9 } |
| 701 |
% \end{macrocode} |
| 702 |
% |
| 703 |
% All the other options are handled by the \textsf{color} package. |
| 704 |
% \begin{macrocode} |
| 705 |
\DeclareOption*{\PassOptionsToPackage\CurrentOption{color}} |
| 706 |
\ProcessOptions |
| 707 |
% \end{macrocode} |
| 708 |
% |
| 709 |
% I need these so load them now. Actually Mark Wooding's |
| 710 |
% \textsf{mdwtab} package could probably work instead of \textsf{array}, |
| 711 |
% but currently I assume \textsf{array} package internals so\ldots |
| 712 |
% \begin{macrocode} |
| 713 |
\RequirePackage{array,color} |
| 714 |
% \end{macrocode} |
| 715 |
% |
| 716 |
% |
| 717 |
% \begin{macro}{\@classz} |
| 718 |
% First define stub for new \textsf{array} package code. |
| 719 |
% \begin{macrocode} |
| 720 |
\ifx\do@row@strut\@undefined\let\do@row@strut\relax\fi |
| 721 |
% \end{macrocode} |
| 722 |
% |
| 723 |
% "\@classz" is the main function in the \textsf{array} package handling |
| 724 |
% of primitive column types: It inserts the code for each of the column |
| 725 |
% specifiers, `"clrpmb"'. The other classes deal with the other preamble |
| 726 |
% tokens such as `"@" 'or `">"'. |
| 727 |
% \begin{macrocode} |
| 728 |
\def\@classz{\@classx |
| 729 |
\@tempcnta \count@ |
| 730 |
\prepnext@tok |
| 731 |
% \end{macrocode} |
| 732 |
% At this point the color specification for the background panel will |
| 733 |
% be in the code for the `">"' specification of this column. This is |
| 734 |
% saved in "\toks\@temptokena" but \textsf{array} will insert it too |
| 735 |
% late (well it would work for "c", but not for "p") so fish the color |
| 736 |
% stuff out of that token register by hand, and then insert it around |
| 737 |
% the entry. |
| 738 |
% |
| 739 |
% Of course this is a terrible hack. What is really needed is a new |
| 740 |
% column type that inserts stuff in the right place (rather like "!" |
| 741 |
% but without the spacing that that does). The "\newcolumntype" |
| 742 |
% command of \textsf{array} only adds `second class' column types. |
| 743 |
% The re-implementations of "\newcolumntype" in my \textsf{blkarray} or |
| 744 |
% Mark Wooding's \textsf{mdwtab} allow new `first class' column types |
| 745 |
% to be declared, but stick with \textsf{array} for now. This means we |
| 746 |
% have to lift the stuff out of the register before the register gets |
| 747 |
% emptied in the wrong place. |
| 748 |
% \begin{macrocode} |
| 749 |
\expandafter\CT@extract\the\toks\@tempcnta\columncolor!\@nil |
| 750 |
% \end{macrocode} |
| 751 |
% Save the entry into a box (using a double group for color safety as |
| 752 |
% usual). |
| 753 |
% \begin{macrocode} |
| 754 |
\@addtopreamble{% |
| 755 |
\setbox\z@\hbox\bgroup\bgroup |
| 756 |
% \end{macrocode} |
| 757 |
% \changes{v1.0a}{2012/02/13}{reset \cs{everycr} for nested uses (see test ct2)} |
| 758 |
% \begin{macrocode} |
| 759 |
\CT@everycr{}% |
| 760 |
\ifcase \@chnum |
| 761 |
% \end{macrocode} |
| 762 |
% "c" code: This used to use twice as much glue as "l" and "r" (1fil |
| 763 |
% on each side). Now modify it to use 1fill total. Also increase the |
| 764 |
% order from 1fil to 1fill to dissuade people from putting stretch glue |
| 765 |
% in table entries. |
| 766 |
% \begin{macrocode} |
| 767 |
\hskip\stretch{.5}\kern\z@ |
| 768 |
\d@llarbegin |
| 769 |
\insert@column |
| 770 |
\d@llarend\do@row@strut\hskip\stretch{.5}\or |
| 771 |
% \end{macrocode} |
| 772 |
% "l" and "r" as before, but using fill glue. |
| 773 |
% \begin{macrocode} |
| 774 |
\d@llarbegin \insert@column \d@llarend\do@row@strut \hfill |
| 775 |
\or |
| 776 |
\hfill\kern\z@ \d@llarbegin \insert@column \d@llarend\do@row@strut |
| 777 |
\or |
| 778 |
% \end{macrocode} |
| 779 |
% "m", "p" and "b" as before, but need to take account of array package update. |
| 780 |
% \changes{v1.0k}{2024/10/29}{use \cs{insert@pcolumn} for tagging support} |
| 781 |
% \begin{macrocode} |
| 782 |
\ifx\ar@align@mcell\@undefined |
| 783 |
$\vcenter |
| 784 |
\@startpbox{\@nextchar}\insert@pcolumn \@endpbox $ |
| 785 |
\else |
| 786 |
\setbox\ar@mcellbox\vbox |
| 787 |
\@startpbox{\@nextchar}\insert@pcolumn \@endpbox |
| 788 |
\ar@align@mcell |
| 789 |
\do@row@strut |
| 790 |
\fi |
| 791 |
\or |
| 792 |
\vtop \@startpbox{\@nextchar}\insert@pcolumn \@endpbox\do@row@strut |
| 793 |
\or |
| 794 |
\vbox \@startpbox{\@nextchar}\insert@pcolumn \@endpbox\do@row@strut |
| 795 |
\fi |
| 796 |
% \end{macrocode} |
| 797 |
% Close the box register assignment. |
| 798 |
% \begin{macrocode} |
| 799 |
\egroup\egroup |
| 800 |
% \end{macrocode} |
| 801 |
% \changes{v0.1d}{1996/10/05} |
| 802 |
% {add \cs{CT@row@color} to support \cs{rowcolor}} |
| 803 |
% The main new stuff. |
| 804 |
% \begin{macrocode} |
| 805 |
\begingroup |
| 806 |
% \end{macrocode} |
| 807 |
% Initalise color command and overhands. |
| 808 |
% \begin{macrocode} |
| 809 |
\CT@setup |
| 810 |
% \end{macrocode} |
| 811 |
% Run any code resulting from "\columncolor" commands. |
| 812 |
% \begin{macrocode} |
| 813 |
\CT@column@color |
| 814 |
% \end{macrocode} |
| 815 |
% Run code from "\rowcolor" (so this takes precedence over |
| 816 |
% "\columncolor"). |
| 817 |
% \begin{macrocode} |
| 818 |
\CT@row@color |
| 819 |
% \end{macrocode} |
| 820 |
% Run code from "\cellcolor" (so this takes precedence over |
| 821 |
% both "\columncolor" and "\rowcolor"). |
| 822 |
% \begin{macrocode} |
| 823 |
\CT@cell@color |
| 824 |
% \end{macrocode} |
| 825 |
% This is "\relax" unless one of the three previous commands has requested |
| 826 |
% a color, in which case it will be "\CT@@do@color" which will insert |
| 827 |
% "\leaders" of appropriate color. |
| 828 |
% \begin{macrocode} |
| 829 |
\CT@do@color |
| 830 |
\endgroup |
| 831 |
% \end{macrocode} |
| 832 |
% Nothing to do with color this bit, since we are boxing and measuring |
| 833 |
% the entry anyway may as well check the height, so that large entries |
| 834 |
% don't bump into horizontal rules (or the top of the color panels). |
| 835 |
% \begin{macrocode} |
| 836 |
\@tempdima\ht\z@ |
| 837 |
\advance\@tempdima\minrowclearance |
| 838 |
\vrule\@height\@tempdima\@width\z@ |
| 839 |
% \end{macrocode} |
| 840 |
% It would be safer to leave this boxed, but unboxing allows some |
| 841 |
% flexibilty. However the total glue stretch should either be finite |
| 842 |
% or fil (which will be ignored). There may be fill glue (which will not |
| 843 |
% be ignored) but it should \emph{total 0fill}. If this box contributes |
| 844 |
% fill glue, then the leaders will not reach the full width of the |
| 845 |
% entry. In the case of "\multicolumn" entries it is actually possible |
| 846 |
% for this box to contribute \emph{shrink} glue, in which case the |
| 847 |
% colored panel for that entry will be too wide. Tough luck. |
| 848 |
% \begin{macrocode} |
| 849 |
\unhbox\z@}% |
| 850 |
% \end{macrocode} |
| 851 |
% |
| 852 |
% \begin{macrocode} |
| 853 |
\prepnext@tok} |
| 854 |
% \end{macrocode} |
| 855 |
% \end{macro} |
| 856 |
% |
| 857 |
% \begin{macro}{\CT@setup} |
| 858 |
% Initialise the overhang lengths and the color command. |
| 859 |
% \begin{macrocode} |
| 860 |
\def\CT@setup{% |
| 861 |
\@tempdimb\col@sep |
| 862 |
\@tempdimc\col@sep |
| 863 |
\def\CT@color{% |
| 864 |
\global\let\CT@do@color\CT@@do@color |
| 865 |
\color}} |
| 866 |
% \end{macrocode} |
| 867 |
% \end{macro} |
| 868 |
% |
| 869 |
% \begin{macro}{\CT@@do@color} |
| 870 |
% The main point of the package: Add the color panels. |
| 871 |
% |
| 872 |
% Add a leader of the specified color, with natural width the |
| 873 |
% width of the entry plus the specified overhangs and 1fill stretch. |
| 874 |
% Surround by negative kerns so total natural width is not affected by |
| 875 |
% overhang. |
| 876 |
% \begin{macrocode} |
| 877 |
\def\CT@@do@color{% |
| 878 |
\global\let\CT@do@color\relax |
| 879 |
\@tempdima\wd\z@ |
| 880 |
\advance\@tempdima\@tempdimb |
| 881 |
\advance\@tempdima\@tempdimc |
| 882 |
\kern-\@tempdimb |
| 883 |
\leaders\vrule |
| 884 |
% \end{macrocode} |
| 885 |
% For quick debugging with xdvi (which can't do colors). Limit the size |
| 886 |
% of the rule, so I can see the text as well. |
| 887 |
% \begin{macrocode} |
| 888 |
^^A \@height\p@\@depth\p@ |
| 889 |
% \end{macrocode} |
| 890 |
% |
| 891 |
% \begin{macrocode} |
| 892 |
\hskip\@tempdima\@plus 1fill |
| 893 |
\kern-\@tempdimc |
| 894 |
% \end{macrocode} |
| 895 |
% Now glue to exactly compensate for the leaders. |
| 896 |
% \begin{macrocode} |
| 897 |
\hskip-\wd\z@ \@plus -1fill } |
| 898 |
% \end{macrocode} |
| 899 |
% \end{macro} |
| 900 |
% |
| 901 |
% \begin{macro}{\CT@extract} |
| 902 |
% \changes{v1.0f}{2022/06/20}{protect against active characters} |
| 903 |
% Now the code to extract the "\columncolor" commands. |
| 904 |
% \begin{macrocode} |
| 905 |
\def\CT@extract#1\columncolor#2#3\@nil{% |
| 906 |
\if!\noexpand#2% |
| 907 |
% \end{macrocode} |
| 908 |
% "!" is a fake token inserted at the end. |
| 909 |
% \begin{macrocode} |
| 910 |
\let\CT@column@color\@empty |
| 911 |
\else |
| 912 |
% \end{macrocode} |
| 913 |
% If there was an optional argument |
| 914 |
% \begin{macrocode} |
| 915 |
\if[\noexpand#2% |
| 916 |
\CT@extractb{#1}#3\@nil |
| 917 |
\else |
| 918 |
% \end{macrocode} |
| 919 |
% No optional argument |
| 920 |
% \begin{macrocode} |
| 921 |
\def\CT@column@color{% |
| 922 |
\CT@color{#2}}% |
| 923 |
\CT@extractd{#1}#3\@nil |
| 924 |
\fi |
| 925 |
\fi} |
| 926 |
% \end{macrocode} |
| 927 |
% \end{macro} |
| 928 |
% |
| 929 |
% \begin{macro}{\CT@extractb} |
| 930 |
% Define "\CT@column@color" to add the right color, and save the |
| 931 |
% overhang lengths. Finally reconstitute the saved `">"' tokens, |
| 932 |
% without the color specification. |
| 933 |
% First grab the color spec, with optional arg. |
| 934 |
% \begin{macrocode} |
| 935 |
\def\CT@extractb#1#2]#3{% |
| 936 |
\def\CT@column@color{% |
| 937 |
\CT@color[#2]{#3}}% |
| 938 |
\CT@extractd{#1}}% |
| 939 |
% \end{macrocode} |
| 940 |
% \end{macro} |
| 941 |
% |
| 942 |
% \begin{macro}{\CT@extractd} |
| 943 |
% Now look for left-overhang (default to "\col@sep"). |
| 944 |
% \begin{macrocode} |
| 945 |
\def\CT@extractd#1{\@testopt{\CT@extracte{#1}}\col@sep} |
| 946 |
% \end{macrocode} |
| 947 |
% \end{macro} |
| 948 |
% |
| 949 |
% \begin{macro}{\CT@extracte} |
| 950 |
% Same for right-overhang (default to left-overhang). |
| 951 |
% \begin{macrocode} |
| 952 |
\def\CT@extracte#1[#2]{\@testopt{\CT@extractf{#1}[#2]}{#2}} |
| 953 |
% \end{macrocode} |
| 954 |
% \end{macro} |
| 955 |
% |
| 956 |
% \begin{macro}{\CT@extractf} |
| 957 |
% Add the overhang info to "\CT@do@color", for excuting later. |
| 958 |
% \begin{macrocode} |
| 959 |
{\catcode`\!\active |
| 960 |
\gdef\CT@extractf#1[#2][#3]#4\columncolor#5\@nil{% |
| 961 |
\@tempdimb#2\relax |
| 962 |
\@tempdimc#3\relax |
| 963 |
\edef!{\string!}% |
| 964 |
\edef\CT@column@color{% |
| 965 |
\CT@column@color |
| 966 |
\@tempdimb\the\@tempdimb\@tempdimc\the\@tempdimc\relax}% |
| 967 |
\toks\@tempcnta{#1#4}}}% |
| 968 |
% \end{macrocode} |
| 969 |
% \end{macro} |
| 970 |
% |
| 971 |
% |
| 972 |
% \begin{macro}{\CT@everycr} |
| 973 |
% Steal "\everypar" to initialise row colors |
| 974 |
% \changes{v1.0l}{2026-05-01}{Use new array hooks if available, for tagging-project issue 379} |
| 975 |
% \begin{macrocode} |
| 976 |
\let\CT@everycr\everycr |
| 977 |
\IfPackageAtLeastTF{array}{2026/02/24} |
| 978 |
{ |
| 979 |
\typeout{new hooks used!!} |
| 980 |
\AddToHook{tbl/row/end}{\global\let\CT@row@color\relax} |
| 981 |
\AddToHook{tbl/row/init}{\@rowc@lors} |
| 982 |
} |
| 983 |
{ |
| 984 |
\newtoks\everycr |
| 985 |
\CT@everycr{\noalign{\global\let\CT@row@color\relax}\the\everycr} |
| 986 |
} |
| 987 |
% \end{macrocode} |
| 988 |
% \end{macro} |
| 989 |
% |
| 990 |
% \begin{macro}{\CT@start} |
| 991 |
% \changes{v0.1f}{1996/10/10} |
| 992 |
% {Nested support for \cs{rowcolor} (prompted by Denis Girou)} |
| 993 |
% |
| 994 |
% \begin{macrocode} |
| 995 |
\def\CT@start{% |
| 996 |
\let\CT@arc@save\CT@arc@ |
| 997 |
\let\CT@drsc@save\CT@drsc@ |
| 998 |
\let\CT@row@color@save\CT@row@color |
| 999 |
\let\CT@cell@color@save\CT@cell@color |
| 1000 |
\global\let\CT@cell@color\relax} |
| 1001 |
% \end{macrocode} |
| 1002 |
% \end{macro} |
| 1003 |
% |
| 1004 |
% \begin{macro}{\CT@end} |
| 1005 |
% \begin{macrocode} |
| 1006 |
\def\CT@end{% |
| 1007 |
\global\let\CT@arc@\CT@arc@save |
| 1008 |
\global\let\CT@drsc@\CT@drsc@save |
| 1009 |
\global\let\CT@row@color\CT@row@color@save |
| 1010 |
\global\let\CT@cell@color\CT@cell@color@save} |
| 1011 |
% \end{macrocode} |
| 1012 |
% \end{macro} |
| 1013 |
% |
| 1014 |
% \begin{macro}{\shortstack} |
| 1015 |
% "\shortstack" |
| 1016 |
% \begin{macrocode} |
| 1017 |
\gdef\@ishortstack#1{% |
| 1018 |
\CT@start\ialign{\mb@l {##}\unskip\mb@r\cr #1\crcr}\CT@end\egroup} |
| 1019 |
% \end{macrocode} |
| 1020 |
% \end{macro} |
| 1021 |
% |
| 1022 |
% \begin{macro}{\@tabarray} |
| 1023 |
% \textsf{array} and \textsf{tabular} (delayed for \textsf{delarray}) |
| 1024 |
% \begin{macrocode} |
| 1025 |
\AtBeginDocument{% |
| 1026 |
\expandafter\def\expandafter\@tabarray\expandafter{% |
| 1027 |
\expandafter\CT@start\@tabarray}} |
| 1028 |
% \end{macrocode} |
| 1029 |
% \end{macro} |
| 1030 |
% |
| 1031 |
% \begin{macro}{\endarray} |
| 1032 |
% \changes{v1.0b}{2012/21/06}{re-insert \cs{@arrayright} to match \textsf{array} definition, for \textsf{delarray}} |
| 1033 |
% \changes{v1.0h}{2024/05/26}{Don't assume existing \cs{endarray} definition, to work with tagging code} |
| 1034 |
% \begin{macrocode} |
| 1035 |
\expandafter\def\expandafter\endarray\expandafter{\endarray\CT@end} |
| 1036 |
% \end{macrocode} |
| 1037 |
% \end{macro} |
| 1038 |
% |
| 1039 |
% \begin{macro}{\multicolumn} |
| 1040 |
% "\multicolumn" |
| 1041 |
% \changes{v1.0a}{2012/02/13}{make \cs{multicolumn} long (see test ct1)} |
| 1042 |
% \changes{v1.0g}{2024/02/20}{Add to existing definition to for dpctex 47} |
| 1043 |
% Patch "\multicolumn" to restore color settings. Done this way to work wth |
| 1044 |
% different versions depending on the age of the \textsf{array} package. |
| 1045 |
% \begin{macrocode} |
| 1046 |
\def\@tempa#1\@arstrut#2\relax{ |
| 1047 |
\long\def\multicolumn##1##2##3{% |
| 1048 |
#1% |
| 1049 |
% \end{macrocode} |
| 1050 |
% \changes{v1.0a}{2012/02/13}{don't reset \cs{CT@row@color} (see test ct3)} |
| 1051 |
% \let\CT@row@color\relax |
| 1052 |
% \begin{macrocode} |
| 1053 |
\let\CT@cell@color\relax |
| 1054 |
\let\CT@column@color\relax |
| 1055 |
\let\CT@do@color\relax |
| 1056 |
\@arstrut |
| 1057 |
#2}} |
| 1058 |
\expandafter\@tempa\multicolumn{#1}{#2}{#3}\relax |
| 1059 |
\let\@temp\relax |
| 1060 |
% \end{macrocode} |
| 1061 |
% \end{macro} |
| 1062 |
% |
| 1063 |
% |
| 1064 |
% \begin{macro}{\@classvi} |
| 1065 |
% Colored rules and rule separations. |
| 1066 |
% \begin{macrocode} |
| 1067 |
\def\@classvi{\ifcase \@lastchclass |
| 1068 |
\@acol \or |
| 1069 |
\ifx\CT@drsc@\relax |
| 1070 |
\@addtopreamble{\hskip\doublerulesep}% |
| 1071 |
\else |
| 1072 |
\@addtopreamble{{\CT@drsc@\vrule\@width\doublerulesep}}% |
| 1073 |
\fi\or |
| 1074 |
\@acol \or |
| 1075 |
\@classvii |
| 1076 |
\fi} |
| 1077 |
% \end{macrocode} |
| 1078 |
% \end{macro} |
| 1079 |
% |
| 1080 |
% \begin{macro}{\doublerulesepcolor} |
| 1081 |
% \begin{macrocode} |
| 1082 |
\def\doublerulesepcolor#1#{\CT@drs{#1}} |
| 1083 |
% \end{macrocode} |
| 1084 |
% \end{macro} |
| 1085 |
% |
| 1086 |
% \begin{macro}{\CT@drs} |
| 1087 |
% \begin{macrocode} |
| 1088 |
\def\CT@drs#1#2{% |
| 1089 |
\ifdim\baselineskip=\z@\noalign\fi |
| 1090 |
{\gdef\CT@drsc@{\color#1{#2}}}} |
| 1091 |
% \end{macrocode} |
| 1092 |
% \end{macro} |
| 1093 |
% |
| 1094 |
% \begin{macro}{\CT@drsc@} |
| 1095 |
% \begin{macrocode} |
| 1096 |
\let\CT@drsc@\relax |
| 1097 |
% \end{macrocode} |
| 1098 |
% \end{macro} |
| 1099 |
% |
| 1100 |
% \begin{macro}{\arrayrulecolor} |
| 1101 |
% \begin{macrocode} |
| 1102 |
\def\arrayrulecolor#1#{\CT@arc{#1}} |
| 1103 |
% \end{macrocode} |
| 1104 |
% \end{macro} |
| 1105 |
% |
| 1106 |
% \begin{macro}{\CT@arc} |
| 1107 |
% \begin{macrocode} |
| 1108 |
\def\CT@arc#1#2{% |
| 1109 |
\ifdim\baselineskip=\z@\noalign\fi |
| 1110 |
{\gdef\CT@arc@{\color#1{#2}}}} |
| 1111 |
% \end{macrocode} |
| 1112 |
% \end{macro} |
| 1113 |
% |
| 1114 |
% \begin{macro}{\CT@arc@} |
| 1115 |
% \begin{macrocode} |
| 1116 |
\let\CT@arc@\relax |
| 1117 |
% \end{macrocode} |
| 1118 |
% \end{macro} |
| 1119 |
% |
| 1120 |
% hline |
| 1121 |
% |
| 1122 |
% \begin{macro}{\@arrayrule} |
| 1123 |
% \begin{macrocode} |
| 1124 |
\def\@arrayrule{\@addtopreamble {{\CT@arc@\vline}}} |
| 1125 |
% \end{macrocode} |
| 1126 |
% \end{macro} |
| 1127 |
% |
| 1128 |
% \begin{macro}{\hline} |
| 1129 |
% \begin{macrocode} |
| 1130 |
\def\hline{% |
| 1131 |
\noalign{\ifnum0=`}\fi |
| 1132 |
\let\hskip\vskip |
| 1133 |
\let\vrule\hrule |
| 1134 |
\let\@width\@height |
| 1135 |
{\CT@arc@\vline}% |
| 1136 |
\futurelet |
| 1137 |
\reserved@a\@xhline} |
| 1138 |
% \end{macrocode} |
| 1139 |
% \end{macro} |
| 1140 |
% |
| 1141 |
% \begin{macro}{\@xhline} |
| 1142 |
% \begin{macrocode} |
| 1143 |
\def\@xhline{\ifx\reserved@a\hline |
| 1144 |
{\ifx\CT@drsc@\relax |
| 1145 |
\vskip |
| 1146 |
\else |
| 1147 |
\CT@drsc@\hrule\@height |
| 1148 |
\fi |
| 1149 |
\doublerulesep}% |
| 1150 |
\fi |
| 1151 |
\ifnum0=`{\fi}} |
| 1152 |
% \end{macrocode} |
| 1153 |
% \end{macro} |
| 1154 |
% |
| 1155 |
% \begin{macro}{\cline} |
| 1156 |
% "\cline" doesn't really work, as it comes behind the colored panels, |
| 1157 |
% but at least make it the right color (the bits you can see, anyway). |
| 1158 |
% \changes{v1.0l}{2026-05-01}{Add tagging sockets and row command, for tagging-project issue 1331} |
| 1159 |
% \begin{macrocode} |
| 1160 |
\def\@cline#1-#2\@nil{% |
| 1161 |
\omit |
| 1162 |
\@multicnt#1% |
| 1163 |
\advance\@multispan\m@ne |
| 1164 |
\ifnum\@multicnt=\@ne\@firstofone{&\omit}\fi |
| 1165 |
\@multicnt#2% |
| 1166 |
\advance\@multicnt-#1% |
| 1167 |
\advance\@multispan\@ne |
| 1168 |
\UseTaggingSocket{tbl/leaders/begin}% |
| 1169 |
{\CT@arc@\leaders\hrule\@height\arrayrulewidth\hfill}% |
| 1170 |
\UseTaggingSocket{tbl/leaders/end}% |
| 1171 |
\CT@tbl@gdecr@row@count |
| 1172 |
\cr |
| 1173 |
\noalign{\vskip-\arrayrulewidth}} |
| 1174 |
% \end{macrocode} |
| 1175 |
% \end{macro} |
| 1176 |
% |
| 1177 |
% \begin{macro}{\minrowclearance} |
| 1178 |
% The row height fudge length. |
| 1179 |
% \begin{macrocode} |
| 1180 |
\newlength\minrowclearance |
| 1181 |
\minrowclearance=0pt |
| 1182 |
% \end{macrocode} |
| 1183 |
% \end{macro} |
| 1184 |
% |
| 1185 |
% \begin{macro}{\@mkpream} |
| 1186 |
% \begin{macro}{\@mkpreamarray} |
| 1187 |
% While expanding the preamble \textsf{array} passes tokens through an |
| 1188 |
% "\edef". It doesn't use "\protect"ion as it thinks it has full control |
| 1189 |
% at that point. As the redefinition above adds "\color", I need to add |
| 1190 |
% that to the list of commands made safe. |
| 1191 |
% \begin{macrocode} |
| 1192 |
\let\@mkpreamarray\@mkpream |
| 1193 |
\def\@mkpream{% |
| 1194 |
\let\CT@setup\relax |
| 1195 |
\let\CT@color\relax |
| 1196 |
\let\CT@do@color\relax |
| 1197 |
\let\color\relax |
| 1198 |
\let\CT@column@color\relax |
| 1199 |
\let\CT@row@color\relax |
| 1200 |
\let\CT@cell@color\relax |
| 1201 |
\@mkpreamarray} |
| 1202 |
% \end{macrocode} |
| 1203 |
% \end{macro} |
| 1204 |
% \end{macro} |
| 1205 |
% |
| 1206 |
% \begin{macro}{\CT@do@color} |
| 1207 |
% For similar reasons, need to make this non-expandable |
| 1208 |
% \begin{macrocode} |
| 1209 |
\let\CT@do@color\relax |
| 1210 |
% \end{macrocode} |
| 1211 |
% \end{macro} |
| 1212 |
% |
| 1213 |
% \begin{macro}{\rowcolor} |
| 1214 |
% \changes{v0.1f}{1996/10/10} |
| 1215 |
% {Add \cs{noalign} (Denis Girou)} |
| 1216 |
% \begin{macrocode} |
| 1217 |
\def\rowcolor{% |
| 1218 |
\noalign{\ifnum0=`}\fi |
| 1219 |
\global\let\CT@do@color\CT@@do@color |
| 1220 |
\@ifnextchar[\CT@rowa\CT@rowb} |
| 1221 |
% \end{macrocode} |
| 1222 |
% \end{macro} |
| 1223 |
% |
| 1224 |
% \begin{macro}{\CT@rowa} |
| 1225 |
% \begin{macrocode} |
| 1226 |
\def\CT@rowa[#1]#2{% |
| 1227 |
\gdef\CT@row@color{\CT@color[#1]{#2}}% |
| 1228 |
\CT@rowc} |
| 1229 |
% \end{macrocode} |
| 1230 |
% \end{macro} |
| 1231 |
% |
| 1232 |
% \begin{macro}{\CT@rowb} |
| 1233 |
% \begin{macrocode} |
| 1234 |
\def\CT@rowb#1{% |
| 1235 |
\gdef\CT@row@color{\CT@color{#1}}% |
| 1236 |
\CT@rowc} |
| 1237 |
% \end{macrocode} |
| 1238 |
% \end{macro} |
| 1239 |
% |
| 1240 |
% \begin{macro}{\CT@rowc} |
| 1241 |
% \begin{macrocode} |
| 1242 |
\def\CT@rowc{% |
| 1243 |
\@ifnextchar[\CT@rowd{\ifnum`{=0\fi}}} |
| 1244 |
% \end{macrocode} |
| 1245 |
% \end{macro} |
| 1246 |
% |
| 1247 |
% \begin{macro}{\CT@rowd} |
| 1248 |
% \begin{macrocode} |
| 1249 |
\def\CT@rowd[#1]{\@testopt{\CT@rowe[#1]}{#1}} |
| 1250 |
% \end{macrocode} |
| 1251 |
% \end{macro} |
| 1252 |
% |
| 1253 |
% \begin{macro}{\CT@rowe} |
| 1254 |
% \changes{v0.1h}{1998/05/06} |
| 1255 |
% {Fix typo in \cs{ifnum} (Robin F.)} |
| 1256 |
% \begin{macrocode} |
| 1257 |
\def\CT@rowe[#1][#2]{% |
| 1258 |
\@tempdimb#1% |
| 1259 |
\@tempdimc#2% |
| 1260 |
\xdef\CT@row@color{% |
| 1261 |
\expandafter\noexpand\CT@row@color |
| 1262 |
\@tempdimb\the\@tempdimb |
| 1263 |
\@tempdimc\the\@tempdimc |
| 1264 |
\relax}% |
| 1265 |
\ifnum0=`{\fi}} |
| 1266 |
% \end{macrocode} |
| 1267 |
% \end{macro} |
| 1268 |
% |
| 1269 |
% \begin{macro}{\@ifxempty} |
| 1270 |
% \marg{arg}\marg{empty}\marg{non-empty}\\ |
| 1271 |
% Tests without expanding, whether the argument \marg{arg} is empty and executes the following code accordingly; \marg{arg} must not start with the token "\XC@@". |
| 1272 |
% Can also be used within "\edef". |
| 1273 |
% \begin{macrocode} |
| 1274 |
\def\@ifxempty#1{\@@ifxempty#1\@@ifxempty\XC@@} |
| 1275 |
\def\@@ifxempty#1#2\XC@@ |
| 1276 |
{\ifx#1\@@ifxempty |
| 1277 |
\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi} |
| 1278 |
% \end{macrocode} |
| 1279 |
% \end{macro} |
| 1280 |
% |
| 1281 |
% \begin{macro}{\rowcolors} |
| 1282 |
% \begin{macro}{\rowcolors*} |
| 1283 |
% \oarg{commands}\marg{row}\marg{odd-row color}\marg{even-row color}\\ |
| 1284 |
% Defines alternating colors for the next tabular environment. |
| 1285 |
% Starting with row \meta{row}, odd and even rows get their respective colors. |
| 1286 |
% The color arguments may also be left empty (= no color). |
| 1287 |
% Optional commands may be "hline" or "noalign"\marg{stuff}. |
| 1288 |
% |
| 1289 |
% In the starred version, \meta{commands} are ignored in rows with |
| 1290 |
% inactive rowcolors status (see below), whereas in the non-starred |
| 1291 |
% version, \meta{commands} are applied to every row of the |
| 1292 |
% table. |
| 1293 |
% \begin{macrocode} |
| 1294 |
\def\rowcolors |
| 1295 |
{\@ifstar{\@rowcmdfalse\rowc@lors}{\@rowcmdtrue\rowc@lors}} |
| 1296 |
% \end{macrocode} |
| 1297 |
% |
| 1298 |
% \begin{macrocode} |
| 1299 |
\def\rowc@lors{\@testopt{\rowc@l@rs}{}} |
| 1300 |
% \end{macrocode} |
| 1301 |
% |
| 1302 |
% \begin{macrocode} |
| 1303 |
\def\rowc@l@rs[#1]#2#3#4% |
| 1304 |
{\global\rownum=\z@ |
| 1305 |
\global\@rowcolorstrue |
| 1306 |
\@ifxempty{#3}% |
| 1307 |
{\def\@oddrowcolor{\@norowcolor}}% |
| 1308 |
{\def\@oddrowcolor{\gdef\CT@row@color{\CT@color{#3}}}}% |
| 1309 |
\@ifxempty{#4}% |
| 1310 |
{\def\@evenrowcolor{\@norowcolor}}% |
| 1311 |
{\def\@evenrowcolor{\gdef\CT@row@color{\CT@color{#4}}}}% |
| 1312 |
\if@rowcmd |
| 1313 |
\def\@rowcolors |
| 1314 |
{#1\if@rowcolors |
| 1315 |
\noalign{\relax\ifnum\rownum<#2\@norowcolor\else |
| 1316 |
\ifodd\rownum\@oddrowcolor\else\@evenrowcolor\fi\fi}% |
| 1317 |
\fi}% |
| 1318 |
\else |
| 1319 |
\def\@rowcolors |
| 1320 |
{\if@rowcolors |
| 1321 |
\ifnum\rownum<#2\noalign{\@norowcolor}\else |
| 1322 |
#1\noalign{\ifodd\rownum\@oddrowcolor\else\@evenrowcolor\fi}\fi |
| 1323 |
\fi}% |
| 1324 |
\fi |
| 1325 |
\CT@everycr{\@rowc@lors\the\everycr}% |
| 1326 |
\ignorespaces} |
| 1327 |
% \end{macrocode} |
| 1328 |
% |
| 1329 |
% \begin{macrocode} |
| 1330 |
\def\@rowc@lors{\noalign{\global\advance\rownum\@ne}\@rowcolors} |
| 1331 |
\let\@rowcolors\@empty |
| 1332 |
% \end{macrocode} |
| 1333 |
% \end{macro} |
| 1334 |
% \end{macro} |
| 1335 |
% |
| 1336 |
% \begin{macro}{\showrowcolors} |
| 1337 |
% \begin{macro}{\hiderowcolors} |
| 1338 |
% Switch coloring mode on/off. |
| 1339 |
% \begin{macrocode} |
| 1340 |
\def\showrowcolors{\noalign{\global\@rowcolorstrue}\@rowcolors} |
| 1341 |
\def\hiderowcolors{\noalign{\global\@rowcolorsfalse\@norowcolor}} |
| 1342 |
\def\@norowcolor{\global\let\CT@row@color\relax} |
| 1343 |
\@norowcolor |
| 1344 |
% \end{macrocode} |
| 1345 |
% \end{macro} |
| 1346 |
% \end{macro} |
| 1347 |
% |
| 1348 |
% \begin{macro}{\if@rowcolors} |
| 1349 |
% \begin{macro}{\if@rowcmd} |
| 1350 |
% \begin{macrocode} |
| 1351 |
\newif\if@rowcolors |
| 1352 |
\newif\if@rowcmd |
| 1353 |
% \end{macrocode} |
| 1354 |
% \end{macro} |
| 1355 |
% \end{macro} |
| 1356 |
% |
| 1357 |
% \begin{macro}{\rownum} |
| 1358 |
% \begin{macro}{\c@rownum} |
| 1359 |
% Reserve a counter register. Also alias as a \LaTeX\ counter |
| 1360 |
% (but not via "\newcounter" as should not be in the reset list.) |
| 1361 |
% \begin{macrocode} |
| 1362 |
\@ifundefined{rownum}{% |
| 1363 |
\@ifundefined{c@rownum}% |
| 1364 |
{\newcount\rownum\let\c@rownum\rownum}% |
| 1365 |
{\let\rownum\c@rownum}% |
| 1366 |
}% |
| 1367 |
{\let\c@rownum\rownum} |
| 1368 |
\providecommand\therownum{\arabic{rownum}} |
| 1369 |
% \end{macrocode} |
| 1370 |
% \end{macro} |
| 1371 |
% \end{macro} |
| 1372 |
% |
| 1373 |
% |
| 1374 |
% \begin{macro}{\cellcolor} |
| 1375 |
% "\cellcolor" applies the specified color to just its own tabular cell. |
| 1376 |
% It is defined robust, but without using "\DeclareRobustCommand" or |
| 1377 |
% "\newcommand{}[][]" because those forms are not used elsewhere, and |
| 1378 |
% would not work in \emph{very} old \LaTeX. |
| 1379 |
% \begin{macrocode} |
| 1380 |
\edef\cellcolor{\noexpand\protect |
| 1381 |
\expandafter\noexpand\csname cellcolor \endcsname} |
| 1382 |
\@namedef{cellcolor }{% |
| 1383 |
\@ifnextchar[{\CT@cellc\@firstofone}{\CT@cellc\@gobble[]}% |
| 1384 |
} |
| 1385 |
\def\CT@cellc#1[#2]#3{% |
| 1386 |
\expandafter\gdef\expandafter\CT@cell@color\expandafter{% |
| 1387 |
\expandafter\CT@color#1{[#2]}{#3}% |
| 1388 |
\global\let\CT@cell@color\relax |
| 1389 |
}} |
| 1390 |
\global\let\CT@cell@color\relax |
| 1391 |
% \end{macrocode} |
| 1392 |
% \end{macro} |
| 1393 |
% |
| 1394 |
% \begin{macro}{\DC@endright} |
| 1395 |
% \textsf{dcolumn} support. the "D" column sometimes internally converts |
| 1396 |
% a "c" column to an "r" one by squashing the supplied glue. This is bad |
| 1397 |
% news for this package, so redefine it to add negative glue to one |
| 1398 |
% side and positive to the other to keep the total added zero. |
| 1399 |
% \begin{macrocode} |
| 1400 |
\AtBeginDocument{% |
| 1401 |
\def\@tempa{$\hfil\egroup\box\z@\box\tw@}% |
| 1402 |
\ifx\@tempa\DC@endright |
| 1403 |
% \end{macrocode} |
| 1404 |
% |
| 1405 |
% New version of \textsf{dcolumn}, only want to fudge it |
| 1406 |
% in the "D{.}{.}{3}" case, not the new "D{.}{.}{3.3}" possibility. |
| 1407 |
% "\hfill" has already been inserted, so need to remove 1fill's worth |
| 1408 |
% of stretch. |
| 1409 |
% \begin{macrocode} |
| 1410 |
\def\DC@endright{% |
| 1411 |
$\hfil\egroup |
| 1412 |
\ifx\DC@rl\bgroup |
| 1413 |
\hskip\stretch{-.5}\box\z@\box\tw@\hskip\stretch{-.5}% |
| 1414 |
\else |
| 1415 |
\box\z@\box\tw@ |
| 1416 |
\fi}% |
| 1417 |
\else |
| 1418 |
\def\@tempa{$\hfil\egroup\hfill\box\z@\box\tw@}% |
| 1419 |
\ifx\@tempa\DC@endright |
| 1420 |
% \end{macrocode} |
| 1421 |
% |
| 1422 |
% Old \textsf{dcolumn} code. |
| 1423 |
% \begin{macrocode} |
| 1424 |
\def\DC@endright{% |
| 1425 |
$\hfil\egroup% |
| 1426 |
\hskip\stretch{.5}\box\z@\box\tw@\hskip\stretch{-.5}}% |
| 1427 |
\fi |
| 1428 |
\fi} |
| 1429 |
% \end{macrocode} |
| 1430 |
% \end{macro} |
| 1431 |
% |
| 1432 |
% hhline support (almost the whole package, repeated, sigh). |
| 1433 |
% \changes{v1.0a}{2012/02/13}{Several improvements (see test ct4)} |
| 1434 |
% \begin{macrocode} |
| 1435 |
\AtBeginDocument{% |
| 1436 |
\ifx\hhline\@undefined\else |
| 1437 |
\def\HH@box#1#2{\vbox{{% |
| 1438 |
\ifx\CT@drsc@\relax\else |
| 1439 |
\global\dimen\thr@@\tw@\arrayrulewidth |
| 1440 |
\global\advance\dimen\thr@@\doublerulesep |
| 1441 |
{\CT@drsc@ |
| 1442 |
\hrule \@height\dimen\thr@@ |
| 1443 |
\vskip-\dimen\thr@@}% |
| 1444 |
\fi |
| 1445 |
\CT@arc@ |
| 1446 |
\hrule \@height \arrayrulewidth \@width #1 |
| 1447 |
\vskip\doublerulesep |
| 1448 |
\hrule \@height \arrayrulewidth \@width #2}}} |
| 1449 |
% \end{macrocode} |
| 1450 |
%\changes{v1.0l}{2026-05-01}{Decrease row count, for tagging-project issue 66} |
| 1451 |
% \begin{macrocode} |
| 1452 |
\def\HH@loop{% |
| 1453 |
\ifx\@tempb`\def\next##1{% |
| 1454 |
\the\toks@\CT@tbl@gdecr@row@count\cr}\else\let\next\HH@let |
| 1455 |
\ifx\@tempb|\if@tempswa |
| 1456 |
\ifx\CT@drsc@\relax |
| 1457 |
\HH@add{\hskip\doublerulesep}% |
| 1458 |
\else |
| 1459 |
\HH@add{{\CT@drsc@\vrule\@width\doublerulesep}}% |
| 1460 |
\fi |
| 1461 |
\fi\@tempswatrue |
| 1462 |
\HH@add{{\CT@arc@\vline}}\else |
| 1463 |
\ifx\@tempb:\if@tempswa |
| 1464 |
\ifx\CT@drsc@\relax |
| 1465 |
\HH@add{\hskip\doublerulesep}% |
| 1466 |
\else |
| 1467 |
\HH@add{{\CT@drsc@\vrule\@width\doublerulesep}}% |
| 1468 |
\fi |
| 1469 |
\fi\@tempswatrue |
| 1470 |
\HH@add{\@tempc\HH@box\arrayrulewidth\arrayrulewidth\@tempc}\else |
| 1471 |
\ifx\@tempb##\if@tempswa\HH@add{\hskip\doublerulesep}\fi\@tempswatrue |
| 1472 |
\HH@add{{\CT@arc@\vline\copy\@ne\@tempc\vline}}\else |
| 1473 |
\ifx\@tempb~\@tempswafalse |
| 1474 |
\if@firstamp\@firstampfalse\else\HH@add{&\omit}\fi |
| 1475 |
\ifx\CT@drsc@\relax |
| 1476 |
\HH@add{\hfil}\else |
| 1477 |
\HH@add{{% |
| 1478 |
\CT@drsc@\leaders\hrule\@height\HH@height\hfil}}% |
| 1479 |
\fi |
| 1480 |
\else |
| 1481 |
\ifx\@tempb-\@tempswafalse |
| 1482 |
\gdef\HH@height{\arrayrulewidth}% |
| 1483 |
\if@firstamp\@firstampfalse\else\HH@add{&\omit}\fi |
| 1484 |
\HH@add{{% |
| 1485 |
\CT@arc@\leaders\hrule\@height\arrayrulewidth\hfil}}% |
| 1486 |
\else |
| 1487 |
\ifx\@tempb=\@tempswafalse |
| 1488 |
\gdef\HH@height{\dimen\thr@@}% |
| 1489 |
\if@firstamp\@firstampfalse\else\HH@add{&\omit}\fi |
| 1490 |
\HH@add |
| 1491 |
{\rlap{\copy\@ne}\leaders\copy\@ne\hfil\llap{\copy\@ne}}\else |
| 1492 |
% \end{macrocode} |
| 1493 |
% \changes{v0.1f}{1996/10/10} |
| 1494 |
% {Remove backspacing for t and b in \cs{hhline}} |
| 1495 |
% Stop the backspacing for "t" and "b", it messes up the underlying |
| 1496 |
% color. |
| 1497 |
% \begin{macrocode} |
| 1498 |
\ifx\@tempb t\HH@add{% |
| 1499 |
\def\HH@height{\dimen\thr@@}% |
| 1500 |
\HH@box\doublerulesep\z@}\@tempswafalse\else |
| 1501 |
\ifx\@tempb b\HH@add{% |
| 1502 |
\def\HH@height{\dimen\thr@@}% |
| 1503 |
\HH@box\z@\doublerulesep}\@tempswafalse\else |
| 1504 |
\ifx\@tempb>\def\next##1##2{% |
| 1505 |
\HH@add{% |
| 1506 |
{\baselineskip\p@\relax |
| 1507 |
##2% |
| 1508 |
\global\setbox\@ne\HH@box\doublerulesep\doublerulesep}}% |
| 1509 |
\HH@let!}\else |
| 1510 |
\ifx\@tempb\@sptoken\let\next\HH@spacelet\else |
| 1511 |
\PackageWarning{hhline}% |
| 1512 |
{\meaning\@tempb\space ignored in \noexpand\hhline argument% |
| 1513 |
\MessageBreak}% |
| 1514 |
\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi |
| 1515 |
\next} |
| 1516 |
\lowercase{\def\HH@spacelet} {\futurelet\@tempb \HH@loop} |
| 1517 |
% \end{macrocode} |
| 1518 |
% |
| 1519 |
% \begin{macrocode} |
| 1520 |
\fi} |
| 1521 |
% \end{macrocode} |
| 1522 |
% |
| 1523 |
% |
| 1524 |
% longtable support. |
| 1525 |
% \changes{v1.0i}{2024/07/06}{tagging code adjusments for longtable hline} |
| 1526 |
% \begin{macrocode} |
| 1527 |
\ExplSyntaxOn |
| 1528 |
% \end{macrocode} |
| 1529 |
% |
| 1530 |
% A copy of \cs{tbl_gdecr_row_count:} |
| 1531 |
% \begin{macrocode} |
| 1532 |
\let\CT@tbl@gdecr@row@count\tbl_gdecr_row_count: |
| 1533 |
% \end{macrocode} |
| 1534 |
% Stub tag support if tagging has not been enabled. |
| 1535 |
% \begin{macrocode} |
| 1536 |
\cs_if_exist:NF\tag_mc_begin:n{ |
| 1537 |
\cs_new:Npn\tag_mc_begin:n#1{} |
| 1538 |
\cs_new:Npn\tag_mc_end:{} |
| 1539 |
} |
| 1540 |
% \end{macrocode} |
| 1541 |
% |
| 1542 |
% \changes{v1.0j}{2024/07/08} |
| 1543 |
% {avoid use of internal variable \cs{g__tbl_row_int}} |
| 1544 |
% \begin{macrocode} |
| 1545 |
\AtBeginDocument{ |
| 1546 |
\def\LT@@hline{% |
| 1547 |
\ifx\LT@next\hline |
| 1548 |
\global\let\LT@next\@gobble |
| 1549 |
\ifx\CT@drsc@\relax |
| 1550 |
\gdef\CT@LT@sep{% |
| 1551 |
\noalign{\penalty-\@medpenalty\vskip\doublerulesep}}% |
| 1552 |
\else |
| 1553 |
\gdef\CT@LT@sep{% |
| 1554 |
\multispan\LT@cols{% |
| 1555 |
\tag_mc_begin:n{artifact} |
| 1556 |
\CT@drsc@\leaders\hrule\@height\doublerulesep\hfill |
| 1557 |
\tag_mc_end: \tbl_gdecr_row_count: |
| 1558 |
}\cr}% |
| 1559 |
\fi |
| 1560 |
\else |
| 1561 |
\global\let\LT@next\empty |
| 1562 |
\gdef\CT@LT@sep{% |
| 1563 |
\noalign{\penalty-\@lowpenalty\vskip-\arrayrulewidth}}% |
| 1564 |
\fi |
| 1565 |
\ifnum0=`{\fi}% |
| 1566 |
\multispan\LT@cols |
| 1567 |
{\tag_mc_begin:n{artifact} |
| 1568 |
\CT@arc@\leaders\hrule\@height\arrayrulewidth\hfill |
| 1569 |
\tag_mc_end: \tbl_gdecr_row_count: |
| 1570 |
}\cr |
| 1571 |
\CT@LT@sep |
| 1572 |
\multispan\LT@cols |
| 1573 |
{\tag_mc_begin:n{artifact} |
| 1574 |
\CT@arc@\leaders\hrule\@height\arrayrulewidth\hfill |
| 1575 |
\tag_mc_end: \tbl_gdecr_row_count: |
| 1576 |
}\cr |
| 1577 |
\noalign{\penalty\@M}% |
| 1578 |
\LT@next} |
| 1579 |
} |
| 1580 |
\ExplSyntaxOff |
| 1581 |
% \end{macrocode} |
| 1582 |
% |
| 1583 |
% |
| 1584 |
% \begin{macrocode} |
| 1585 |
%</package> |
| 1586 |
% \end{macrocode} |
| 1587 |
% |
| 1588 |
% \Finale |
| 1589 |
% |