| 1 |
% \iffalse |
| 2 |
%% |
| 3 |
%% File `tabulary.dtx'. |
| 4 |
%% Copyright (C) 1995 1996 2003 2008 2024 David Carlisle |
| 5 |
%% This file may be distributed under the terms of the LPPL. |
| 6 |
%% See README.txt for details. |
| 7 |
%% |
| 8 |
% |
| 9 |
%<*dtx> |
| 10 |
\ProvidesFile{tabulary.dtx} |
| 11 |
%</dtx> |
| 12 |
%<package>\NeedsTeXFormat{LaTeX2e} |
| 13 |
%<package>\ProvidesPackage{tabulary} |
| 14 |
% \fi |
| 15 |
% \ProvidesFile{tabulary.dtx} |
| 16 |
[2024/06/04 v0.11 tabulary package (DPC)] |
| 17 |
% |
| 18 |
% \iffalse |
| 19 |
%<*driver> |
| 20 |
\documentclass{ltxdoc} |
| 21 |
\usepackage{tabulary} |
| 22 |
\EnableCrossrefs |
| 23 |
\CodelineIndex |
| 24 |
\GetFileInfo{tabulary.dtx} |
| 25 |
\title{The \textsf{tabulary} package\thanks{This file |
| 26 |
has version number \fileversion, last |
| 27 |
revised \filedate.}} |
| 28 |
\author{David Carlisle} |
| 29 |
\date{\filedate} |
| 30 |
\RecordChanges |
| 31 |
\begin{document} |
| 32 |
\maketitle |
| 33 |
\DocInput{tabulary.dtx} |
| 34 |
\PrintChanges |
| 35 |
\end{document} |
| 36 |
%</driver> |
| 37 |
% \fi |
| 38 |
% |
| 39 |
% \changes{v0.1}{1995/10/08} |
| 40 |
% {Initial version} |
| 41 |
% \changes{v0.2}{1995/11/05} |
| 42 |
% {Changed everything except the name} |
| 43 |
% \changes{v0.3}{1995/12/21} |
| 44 |
% {Changed everything except the name: s and CLRS added} |
| 45 |
% \changes{v0.5}{1998/12/08} |
| 46 |
% {Further SPQR modifications to multi pass table env} |
| 47 |
% \changes{v0.6}{2003/02/26} |
| 48 |
% {Remove multi pass table env and unboxed star form} |
| 49 |
% \changes{v0.8}{2003/09/14} |
| 50 |
% {Rename S to J and `hide' s (until it works)} |
| 51 |
% \changes{v0.10}{2014/06/21} |
| 52 |
% {support \cs{cellcolor} see http://tex.stackexchange.com/a/185851/1090} |
| 53 |
% \changes{v0.11}{2024/06/04} |
| 54 |
% {Update to match latest array package (rollback to v0.10 for older releases)} |
| 55 |
% \changes{v0.11}{2024/06/04} |
| 56 |
% {Restore LaTeX counters after trial typesetting gh/12} |
| 57 |
% \changes{v0.11}{2024/06/04} |
| 58 |
% {Handle p and b columns like m gh/38} |
| 59 |
% \changes{v0.11}{2024/06/04} |
| 60 |
% {use \cs{hskip}1sp to match array 2.3i from 1996} |
| 61 |
% |
| 62 |
% \section{User Documentation} |
| 63 |
% |
| 64 |
% |
| 65 |
% |\begin{tabulary}|^^A |
| 66 |
% \marg{length}\marg{pream}| |\ \ldots\ |\end{tabulary}| |
| 67 |
% |
| 68 |
% The rather daft name may change in a later release but it is a pun |
| 69 |
% on |tabularx|, which itself was a pun on |tabular*|\ldots |
| 70 |
% |
| 71 |
% These environments work pretty much like the standard tabular |
| 72 |
% environment (or more correctly, the enhanced version from the array |
| 73 |
% package) except that there are more possibilities for the column |
| 74 |
% types. |
| 75 |
% \begin{description} |
| 76 |
% \iffalse |
| 77 |
% \item[s] An `|s|' column relates to a `|c|' column the way the |[s]| |
| 78 |
% |\makebox| option relates to |[c]|. The entries are set to the |
| 79 |
% widest width in the column, but no centering is done, any `glue' in |
| 80 |
% the entry will be used to `stretch' the text across the column. This |
| 81 |
% package adds the |s| column type to \emph{all} array and tabular |
| 82 |
% environments. |
| 83 |
% \fi |
| 84 |
% \item[LCRJ] These new `uppercase' column types are only activated in |
| 85 |
% the |tabulary| environment. |
| 86 |
% In order to make the total table width equal to \meta{length} the |
| 87 |
% |LCRJ| columns are converted to |p| columns (with |\raggedright|, |
| 88 |
% |\centering|, or |\raggedleft| or normal justification respectively |
| 89 |
% applied). The width of these converted columns is proportional to |
| 90 |
% the natural width of the longest entry in each column. |
| 91 |
% \end{description} |
| 92 |
% |
| 93 |
% To stop very narrow columns being too `squeezed' by this process any |
| 94 |
% columns that are narrower than |\tymin| are set to their natural |
| 95 |
% width. This length may be set with |\setlength| and is |
| 96 |
% arbitrarily initialised to 10\,pt. (If you know that a column will |
| 97 |
% be narrow, it may be preferable to use, say, |c| rather than |C| so |
| 98 |
% that the \textsf{tabulary} mechanism is never invoked on that column.) |
| 99 |
% |
| 100 |
% Similarly one very large entry can force its column to be too wide. |
| 101 |
% So to prevent this, all columns with natural length greater than |
| 102 |
% |\tymax| are set to the same width (with the proportion being taken |
| 103 |
% as if the natuaral length was \emph{equal} to |\tymax|). This is |
| 104 |
% initially set to twice the text width.. |
| 105 |
% |
| 106 |
% Narrow |p| columns are sometimes quite hard to set, and so |
| 107 |
% you may redefine the command |\tyformat| to be any declarations |
| 108 |
% to make just after the |\centering| or |\ragged|\ldots\ declaration. |
| 109 |
% By default it redefines |\everypar| to insert a zero space at the |
| 110 |
% start of every paragraph, so the first word may be hyphenated. (See |
| 111 |
% DogBook). |
| 112 |
% |
| 113 |
% |
| 114 |
% As the environment makes a standard \LaTeX\ box, it will be indented |
| 115 |
% by the paragraph indent at the start of a paragraph, and so will not |
| 116 |
% fit on a line if given argument |\textwidth| unless it is preceded by |
| 117 |
% |\noindent| or is in a |center| environment or some other |
| 118 |
% environment with zero paragraph indent. |
| 119 |
% |
| 120 |
% \section{Features} |
| 121 |
% |
| 122 |
% |
| 123 |
% You can use |\multicolumn| but if the multicolumn text turns out to |
| 124 |
% be longer than the final calculated widths of the columns that it |
| 125 |
% spans, then the final table will be too wide. |
| 126 |
% |
| 127 |
% |\verb| doesnt work. (except in restricted version as in tabularx) |
| 128 |
% |
| 129 |
% The whole table is evaluated twice, so take care with some |
| 130 |
% \TeX\ constructions that may have side effects like writing to files. |
| 131 |
% |
| 132 |
% |
| 133 |
% \section{Options} |
| 134 |
% The following package option is defined: |
| 135 |
% \begin{description} |
| 136 |
% \item[debugshow] Causes a lot of stuff to appear on the terminal. |
| 137 |
% I find this invaluable, you may find it less so. |
| 138 |
% \end{description} |
| 139 |
% |
| 140 |
% \clearpage |
| 141 |
% \section{Examples} |
| 142 |
% |
| 143 |
% \begin{center} |
| 144 |
% |
| 145 |
% With C columns\\ |
| 146 |
%\begin{tabulary}{\linewidth}{C|C@{ (an @ expr.) }C} |
| 147 |
% 1&the rain in spain falls mainly on the plain& |
| 148 |
% the rain in spain falls mainly on the plain |
| 149 |
% the rain in spain falls mainly on the plain\\ |
| 150 |
% a&b&c\\ |
| 151 |
% a a&b b&c c |
| 152 |
% \end{tabulary} |
| 153 |
% |
| 154 |
% \bigskip |
| 155 |
% |
| 156 |
% With J columns\\ |
| 157 |
%\begin{tabulary}{\linewidth}{J|J@{ (an @ expr.) }J} |
| 158 |
% 1&the rain in spain falls mainly on the plain& |
| 159 |
% the rain in spain falls mainly on the plain |
| 160 |
% the rain in spain falls mainly on the plain\\ |
| 161 |
% a&b&c\\ |
| 162 |
% a a&b b&c c |
| 163 |
% \end{tabulary} |
| 164 |
% |
| 165 |
% \bigskip |
| 166 |
% |
| 167 |
% With L, R and C columns, and a |\multicolumn|\\ |
| 168 |
% \begin{tabulary}{\linewidth}{LR|LC} |
| 169 |
% 1&the rain in spain falls mainly on the plain& |
| 170 |
% the rain in spain falls mainly on the plain |
| 171 |
% the rain in spain falls mainly on the plain& |
| 172 |
% and now for something completely different\\ |
| 173 |
% x&\multicolumn{3}{c} |
| 174 |
% {some multicolumn text across columns 2--4}\\ |
| 175 |
% a&b&c&d\\ |
| 176 |
% a a&b b&c c&d d |
| 177 |
% \end{tabulary} |
| 178 |
% \end{center} |
| 179 |
% |
| 180 |
% \newcommand\test[3]{^^A |
| 181 |
% \begin{center} |
| 182 |
% \setlength\tymin{#1}^^A |
| 183 |
% \setlength\tymax{#2}^^A |
| 184 |
% \parbox{200pt} |
| 185 |
% {\texttt{\string\tymin=#1\\ \string\tymax=\string#2}\\#3}\par |
| 186 |
% \fbox{\tiny\begin{tabulary}{200pt}{|C|C|C|C|} |
| 187 |
% a&b b b b& |
| 188 |
% c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c& |
| 189 |
% d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d |
| 190 |
% d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d |
| 191 |
% d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d |
| 192 |
% d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d |
| 193 |
% \end{tabulary}} |
| 194 |
% \end{center}} |
| 195 |
% |
| 196 |
% \clearpage |
| 197 |
% |
| 198 |
% The following examples attempt to show the effect of the |\tymin| and |
| 199 |
% |\tymax| parameters. One should also perhaps note that |\tymax| |
| 200 |
% refers to the total column width (inluding any inter-column space, |
| 201 |
% rules etc) but |\tymin| just refers to the width of the column entry |
| 202 |
% (like the argument to the standard |p| column). |
| 203 |
% |
| 204 |
% \test{0pt}{\maxdimen}{Note how the first column is `squeezed'. |
| 205 |
% In fact it is in such a narrow column that even `a' produces an |
| 206 |
% overfull box warning!} |
| 207 |
% |
| 208 |
% \test{20pt}{\maxdimen}{Here increase \texttt{\string\tymin} so that |
| 209 |
% columns b and a are not so narrow. `a' is set to its natural width, |
| 210 |
% and `b' is set to \texttt{\string\tymin}.} |
| 211 |
% |
| 212 |
% \test{20pt}{200pt}{In the previous example, the large d column |
| 213 |
% dominated the table, being a lot wider than the c column. By |
| 214 |
% reducing \texttt{\string\tymax} can limit the width of column d |
| 215 |
% producing more even column widths, but now producing an entry for d |
| 216 |
% that is longer than that for c.} |
| 217 |
% |
| 218 |
% |
| 219 |
% \StopEventually{} |
| 220 |
% |
| 221 |
% \clearpage |
| 222 |
% \section{The Code} |
| 223 |
% |
| 224 |
% \begin{macrocode} |
| 225 |
%<*package> |
| 226 |
% \end{macrocode} |
| 227 |
% |
| 228 |
% Rollback. |
| 229 |
% \begin{macrocode} |
| 230 |
\DeclareRelease{v0.10}{1995/10/08}{tabulary-v010.sty} |
| 231 |
\DeclareCurrentRelease{}{2024-06-01} |
| 232 |
% \end{macrocode} |
| 233 |
% |
| 234 |
% This version needs a current array package |
| 235 |
% \begin{macrocode} |
| 236 |
\RequirePackage{array}[2024/05/23] |
| 237 |
% \end{macrocode} |
| 238 |
% |
| 239 |
% \begin{macrocode} |
| 240 |
\catcode`\Z=14 |
| 241 |
% \end{macrocode} |
| 242 |
% |
| 243 |
% \begin{macrocode} |
| 244 |
\DeclareOption{debugshow}{\catcode`\Z=9\relax} |
| 245 |
% \end{macrocode} |
| 246 |
% |
| 247 |
% \begin{macrocode} |
| 248 |
\ProcessOptions |
| 249 |
% \end{macrocode} |
| 250 |
% \begin{macro}{\arraybackslash} |
| 251 |
% Borrowed from tabularx. |
| 252 |
% \begin{macrocode} |
| 253 |
\def\arraybackslash{\let\\=\@arraycr} |
| 254 |
% \end{macrocode} |
| 255 |
% \end{macro} |
| 256 |
% |
| 257 |
% \begin{macro}{\@finalstrut} |
| 258 |
% Bug fixed version from December 1995 \LaTeX\ release. |
| 259 |
% Old bug going back to \LaTeX2.09\ldots |
| 260 |
% \begin{macrocode} |
| 261 |
\def\@finalstrut#1{% |
| 262 |
\unskip\ifhmode\nobreak\fi\vrule\@width\z@\@height\z@\@depth\dp#1} |
| 263 |
% \end{macrocode} |
| 264 |
% \end{macro} |
| 265 |
% |
| 266 |
% \begin{macro}{\TY@count} |
| 267 |
% Counter so that we know what column we are hacking around in. |
| 268 |
% \begin{macrocode} |
| 269 |
\newcount\TY@count |
| 270 |
% \end{macrocode} |
| 271 |
% \end{macro} |
| 272 |
% |
| 273 |
% \begin{macro}{\tabulary} |
| 274 |
% Top level macro for standard form. |
| 275 |
% \begin{macrocode} |
| 276 |
\def\tabulary{% |
| 277 |
\let\TY@final\tabular |
| 278 |
\let\endTY@final\endtabular |
| 279 |
\TY@tabular} |
| 280 |
% \end{macrocode} |
| 281 |
% \end{macro} |
| 282 |
% |
| 283 |
%^^A% \begin{macro}{\tabulary*} |
| 284 |
%^^A% Top level macro for star form, unboxes everything so it will break |
| 285 |
%^^A% over a page. |
| 286 |
%^^A% \begin{macrocode} |
| 287 |
%^^A\@namedef{tabulary*}{% |
| 288 |
%^^A \def\TY@final{\def\@arrayleft{\let\@arrayleft\relax |
| 289 |
%^^A \global\setbox\@ne}\tabular[t]}% |
| 290 |
%^^A \def\endTY@final{\endtabular\endgraf\unvbox\@ne}% |
| 291 |
%^^A \TY@tabular} |
| 292 |
%^^A\@namedef{endtabulary*}{\endtabulary} |
| 293 |
%^^A% \end{macrocode} |
| 294 |
%^^A% \end{macro} |
| 295 |
% |
| 296 |
% \begin{macro}{\TY@tabular} |
| 297 |
% Looks a lot like tabularx at this stage. Grab everything into a |
| 298 |
% token register. |
| 299 |
% \begin{macrocode} |
| 300 |
\def\TY@tabular#1{% |
| 301 |
\edef\TY@{\@currenvir}% |
| 302 |
{\ifnum0=`}\fi |
| 303 |
% \end{macrocode} |
| 304 |
% At this point need to save locally things that \textsf{tabulary} |
| 305 |
% will globally mess up. These are restored at the end of the |
| 306 |
% environment. |
| 307 |
% \changes{v0.4}{1996/03/29} |
| 308 |
% {Locally preserve global commands} |
| 309 |
% \begin{macrocode} |
| 310 |
\@ovxx\TY@linewidth |
| 311 |
\@ovyy\TY@tablewidth |
| 312 |
\count@\z@ |
| 313 |
\@tempswatrue |
| 314 |
\@whilesw\if@tempswa\fi{% |
| 315 |
\advance\count@\@ne |
| 316 |
\expandafter\ifx\csname TY@F\the\count@\endcsname\relax |
| 317 |
\@tempswafalse |
| 318 |
\else |
| 319 |
\expandafter\let\csname TY@SF\the\count@\expandafter\endcsname |
| 320 |
\csname TY@F\the\count@\endcsname |
| 321 |
\global\expandafter\let\csname TY@F\the\count@\endcsname\relax |
| 322 |
\expandafter\let\csname TY@S\the\count@\expandafter\endcsname |
| 323 |
\csname TY@\the\count@\endcsname |
| 324 |
\fi}% |
| 325 |
% \end{macrocode} |
| 326 |
% |
| 327 |
% \begin{macrocode} |
| 328 |
\global\TY@count\@ne |
| 329 |
\TY@width\xdef{0pt}% |
| 330 |
\global\TY@tablewidth\z@ |
| 331 |
\global\TY@linewidth#1\relax |
| 332 |
Z\message{^^J^^JTable^^J% |
| 333 |
Z Target Width: \the\TY@linewidth^^J% |
| 334 |
Z \string\tabcolsep: \the\tabcolsep\space |
| 335 |
Z \string\arrayrulewidth: \the\arrayrulewidth\space |
| 336 |
Z \string\doublerulesep: \the\doublerulesep^^J% |
| 337 |
Z \string\tymin: \the\tymin\space |
| 338 |
Z \string\tymax: \the\tymax^^J}% |
| 339 |
% \end{macrocode} |
| 340 |
% Placing this here means that nested tabulars will get this |
| 341 |
% definition but that's probably OK, the extra code for LCR etc |
| 342 |
% shouldn't do any harm |
| 343 |
% \begin{macrocode} |
| 344 |
\let\@classz\TY@classz |
| 345 |
% \end{macrocode} |
| 346 |
% |
| 347 |
% \begin{macrocode} |
| 348 |
\let\verb\TX@verb |
| 349 |
% \end{macrocode} |
| 350 |
% |
| 351 |
% \begin{macrocode} |
| 352 |
\toks@{}\TY@get@body} |
| 353 |
% \end{macrocode} |
| 354 |
% \end{macro} |
| 355 |
% |
| 356 |
% \begin{macro}{\TY@@mkpream} |
| 357 |
% Saved version. |
| 358 |
% \begin{macrocode} |
| 359 |
\let\TY@@mkpream\@mkpream |
| 360 |
% \end{macrocode} |
| 361 |
% \end{macro} |
| 362 |
% |
| 363 |
% \begin{macro}{\TY@mkpream} |
| 364 |
% TY version. |
| 365 |
% \begin{macrocode} |
| 366 |
\ExplSyntaxOn |
| 367 |
\def\TY@mkpream{% |
| 368 |
\def\@addamp{% |
| 369 |
\if@firstamp \@firstampfalse \else |
| 370 |
\global\advance\TY@count\@ne |
| 371 |
\edef\@preamble{\@preamble & \noexpand\tbl_update_cell_data:}\fi |
| 372 |
\TY@width\xdef{0pt}}% |
| 373 |
% \end{macrocode} |
| 374 |
% |
| 375 |
% \begin{macrocode} |
| 376 |
\def\@acol{% |
| 377 |
\TY@subwidth\col@sep |
| 378 |
\@addtopreamble{\hskip\col@sep}}% |
| 379 |
% \end{macrocode} |
| 380 |
% |
| 381 |
% \begin{macrocode} |
| 382 |
\let\@arrayrule\TY@arrayrule |
| 383 |
% \end{macrocode} |
| 384 |
% |
| 385 |
% \begin{macrocode} |
| 386 |
\let\@classvi\TY@classvi |
| 387 |
% \end{macrocode} |
| 388 |
% |
| 389 |
% \begin{macrocode} |
| 390 |
\def\@classv{\save@decl |
| 391 |
\expandafter\NC@ecs\@nextchar\extracolsep{}\extracolsep\@@__tbl |
| 392 |
\sbox\z@{\d@llarbegin\@nextchar\d@llarend}% |
| 393 |
\TY@subwidth{\wd\z@}% |
| 394 |
\@addtopreamble{\d@llarbegin\the@toks\the\count@\relax\d@llarend}% |
| 395 |
\prepnext@tok}% |
| 396 |
% \end{macrocode} |
| 397 |
% |
| 398 |
% \begin{macrocode} |
| 399 |
\global\let\@mkpream\TY@@mkpream |
| 400 |
% \end{macrocode} |
| 401 |
% |
| 402 |
% \begin{macrocode} |
| 403 |
\TY@@mkpream} |
| 404 |
\ExplSyntaxOff |
| 405 |
% \end{macrocode} |
| 406 |
% \end{macro} |
| 407 |
% |
| 408 |
% \begin{macro}{\TY@arrayrule} |
| 409 |
% \changes{v0.6}{2003/02/26}{macro added} |
| 410 |
% Pull this out so the colortbl support below can redefine |
| 411 |
% \begin{macrocode} |
| 412 |
\def\TY@arrayrule{% |
| 413 |
\TY@subwidth\arrayrulewidth |
| 414 |
\@addtopreamble \vline} |
| 415 |
% \end{macrocode} |
| 416 |
% \end{macro} |
| 417 |
% |
| 418 |
% \begin{macro}{\TY@classvi} |
| 419 |
% \changes{v0.6}{2003/02/26}{macro added} |
| 420 |
% Pull this out so the colortbl support below can redefine |
| 421 |
% \begin{macrocode} |
| 422 |
\def\TY@classvi{\ifcase \@lastchclass |
| 423 |
\@acol \or |
| 424 |
\TY@subwidth\doublerulesep |
| 425 |
\@addtopreamble{\hskip \doublerulesep}\or |
| 426 |
\@acol \or |
| 427 |
\@classvii |
| 428 |
\fi} |
| 429 |
% \end{macrocode} |
| 430 |
% \end{macro} |
| 431 |
% |
| 432 |
% \begin{macro}{\TY@tab} |
| 433 |
% First run a tabular with all the column types fudged |
| 434 |
% so that the widths of any rules or @-expresions are noted. |
| 435 |
% \begin{macrocode} |
| 436 |
\def\TY@tab{% |
| 437 |
\setbox\z@\hbox\bgroup |
| 438 |
% \end{macrocode} |
| 439 |
% Support displaymath by making it non-display in the first pass. |
| 440 |
% (Other display environments defined in terms of |$$| would need |
| 441 |
% to be added here by packages that define them.) |
| 442 |
% \begin{macrocode} |
| 443 |
\let\[$\let\]$% |
| 444 |
\let\equation$\let\endequation$% |
| 445 |
% \end{macrocode} |
| 446 |
% |
| 447 |
% \begin{macrocode} |
| 448 |
\col@sep\tabcolsep |
| 449 |
\let\d@llarbegin\begingroup\let\d@llarend\endgroup |
| 450 |
% \end{macrocode} |
| 451 |
% |
| 452 |
% \begin{macrocode} |
| 453 |
\let\@mkpream\TY@mkpream |
| 454 |
% \end{macrocode} |
| 455 |
% |
| 456 |
% \begin{macrocode} |
| 457 |
\def\multicolumn##1##2##3{\multispan##1\relax}% |
| 458 |
\CT@start\TY@tabarray} |
| 459 |
% \end{macrocode} |
| 460 |
% \end{macro} |
| 461 |
% |
| 462 |
% \begin{macro}{\TY@tabarray} |
| 463 |
% \changes{v0.7}{2003/09/07} |
| 464 |
% {new macro to support [t] optional arg} |
| 465 |
% \begin{macrocode} |
| 466 |
\def\TY@tabarray{\@ifnextchar[{\TY@array}{\@array[t]}} |
| 467 |
\def\TY@array[#1]{\@array[t]} |
| 468 |
% \end{macrocode} |
| 469 |
% \end{macro} |
| 470 |
% |
| 471 |
% \begin{macro}{\TY@width} |
| 472 |
% Just a shorthand to access a column width macro. |
| 473 |
% \begin{macrocode} |
| 474 |
\def\TY@width#1{% |
| 475 |
\expandafter#1\csname TY@\the\TY@count\endcsname} |
| 476 |
% \end{macrocode} |
| 477 |
% \end{macro} |
| 478 |
% |
| 479 |
% \begin{macro}{\TY@subwidth} |
| 480 |
% Subtract a width from the current column width and also |
| 481 |
% The total line table width and the target line width. |
| 482 |
% \begin{macrocode} |
| 483 |
\def\TY@subwidth#1{% |
| 484 |
\TY@width\dimen@ |
| 485 |
\advance\dimen@-#1\relax |
| 486 |
\TY@width\xdef{\the\dimen@}% |
| 487 |
\global\advance\TY@linewidth-#1\relax} |
| 488 |
% \end{macrocode} |
| 489 |
% \end{macro} |
| 490 |
% |
| 491 |
% \begin{macro}{\endtabulary} |
| 492 |
% First run one modified tabular, making sure to add a |
| 493 |
% blank row (cf longtable) to the end in case the user supplied last |
| 494 |
% row is hidden by an hline or something. |
| 495 |
% \begin{macrocode} |
| 496 |
\def\endtabulary{% |
| 497 |
\SuspendTagging {tabulary}% |
| 498 |
\gdef\@halignto{}% |
| 499 |
% \end{macrocode} |
| 500 |
% |
| 501 |
% Save values of counters, to reset after the trial |
| 502 |
% \begin{macrocode} |
| 503 |
\def\@elt##1{\global\value{##1}\the\value{##1}\relax}% |
| 504 |
\edef\TY@ckpt{\cl@@ckpt}% |
| 505 |
% \end{macrocode} |
| 506 |
% |
| 507 |
% \begin{macrocode} |
| 508 |
\expandafter\TY@tab\the\toks@ |
| 509 |
\crcr\omit |
| 510 |
{\xdef\TY@save@row{}% |
| 511 |
\loop |
| 512 |
\advance\TY@count\m@ne |
| 513 |
\ifnum\TY@count>\z@ |
| 514 |
\xdef\TY@save@row{\TY@save@row&\omit}% |
| 515 |
\repeat}\TY@save@row |
| 516 |
\endarray\global\setbox1=\lastbox\setbox0=\vbox{\unvbox1 |
| 517 |
\unskip\global\setbox1=\lastbox}\egroup |
| 518 |
\ResumeTagging {tabulary}% |
| 519 |
% \end{macrocode} |
| 520 |
% Check that |\tymin| is not too large. |
| 521 |
% \begin{macrocode} |
| 522 |
\dimen@\TY@linewidth |
| 523 |
\divide\dimen@\TY@count |
| 524 |
\ifdim\dimen@<\tymin |
| 525 |
\TY@warn{tymin too large (\the\tymin), resetting to \the\dimen@}% |
| 526 |
\tymin\dimen@ |
| 527 |
\fi |
| 528 |
% \end{macrocode} |
| 529 |
% Now take the last row apart, cf longtable or appendix D. |
| 530 |
% \begin{macrocode} |
| 531 |
\setbox\tw@=\hbox{\unhbox\@ne |
| 532 |
\loop |
| 533 |
\@tempdima=\lastskip |
| 534 |
\ifdim\@tempdima>\z@ |
| 535 |
Z \message{ecs=\the\@tempdima^^J}% |
| 536 |
\global\advance\TY@linewidth-\@tempdima |
| 537 |
\fi |
| 538 |
\unskip |
| 539 |
\setbox\tw@=\lastbox |
| 540 |
\ifhbox\tw@ |
| 541 |
Z \message{Col \the\TY@count: Initial=\the\wd\tw@\space}% |
| 542 |
\ifdim\wd\tw@>\tymax |
| 543 |
\wd\tw@\tymax |
| 544 |
Z \message{> max\space}% |
| 545 |
Z \else |
| 546 |
Z \message{ \@spaces\space}% |
| 547 |
\fi |
| 548 |
\TY@width\dimen@ |
| 549 |
Z \message{\the\dimen@\space}% |
| 550 |
\advance\dimen@\wd\tw@ |
| 551 |
Z \message{Final=\the\dimen@\space}% |
| 552 |
\TY@width\xdef{\the\dimen@}% |
| 553 |
\ifdim\dimen@<\tymin |
| 554 |
Z \message{< tymin}% |
| 555 |
\global\advance\TY@linewidth-\dimen@ |
| 556 |
\expandafter\xdef\csname TY@F\the\TY@count\endcsname |
| 557 |
{\the\dimen@}% |
| 558 |
\else |
| 559 |
\expandafter\ifx\csname TY@F\the\TY@count\endcsname\z@ |
| 560 |
Z \message{***}% |
| 561 |
\global\advance\TY@linewidth-\dimen@ |
| 562 |
\expandafter\xdef\csname TY@F\the\TY@count\endcsname |
| 563 |
{\the\dimen@}% |
| 564 |
\else |
| 565 |
Z \message{> tymin}% |
| 566 |
\global\advance\TY@tablewidth\dimen@ |
| 567 |
\global\expandafter\let\csname TY@F\the\TY@count\endcsname |
| 568 |
\maxdimen |
| 569 |
\fi\fi |
| 570 |
\advance\TY@count\m@ne |
| 571 |
\repeat}% |
| 572 |
% \end{macrocode} |
| 573 |
% |
| 574 |
% A bit cheap just doing this four times, but prevents any |
| 575 |
% possibilities of looping\ldots. |
| 576 |
% \begin{macrocode} |
| 577 |
\TY@checkmin |
| 578 |
\TY@checkmin |
| 579 |
\TY@checkmin |
| 580 |
\TY@checkmin |
| 581 |
% \end{macrocode} |
| 582 |
% Reset the counter. |
| 583 |
% \begin{macrocode} |
| 584 |
\TY@count\z@ |
| 585 |
% \end{macrocode} |
| 586 |
% |
| 587 |
% Reset the LCRJ column definition to set paragraphs to the calculated |
| 588 |
% widths. |
| 589 |
% \begin{macrocode} |
| 590 |
\let\TY@box\TY@box@v |
| 591 |
% \end{macrocode} |
| 592 |
% |
| 593 |
% Restore counter values. |
| 594 |
% \begin{macrocode} |
| 595 |
\TY@ckpt |
| 596 |
% \end{macrocode} |
| 597 |
% |
| 598 |
% Run a second tabular, and for the star form, unbox it. |
| 599 |
% \begin{macrocode} |
| 600 |
{\expandafter\TY@final\the\toks@\endTY@final}% |
| 601 |
% \end{macrocode} |
| 602 |
% |
| 603 |
% Finish off by restoring global commands. |
| 604 |
% \begin{macrocode} |
| 605 |
\count@\z@ |
| 606 |
\@tempswatrue |
| 607 |
\@whilesw\if@tempswa\fi{% |
| 608 |
\advance\count@\@ne |
| 609 |
\expandafter\ifx\csname TY@SF\the\count@\endcsname\relax |
| 610 |
\@tempswafalse |
| 611 |
\else |
| 612 |
\global\expandafter\let\csname TY@F\the\count@\expandafter\endcsname |
| 613 |
\csname TY@SF\the\count@\endcsname |
| 614 |
\global\expandafter\let\csname TY@\the\count@\expandafter\endcsname |
| 615 |
\csname TY@S\the\count@\endcsname |
| 616 |
\fi}% |
| 617 |
\TY@linewidth\@ovxx |
| 618 |
\TY@tablewidth\@ovyy |
| 619 |
% \end{macrocode} |
| 620 |
% |
| 621 |
% \begin{macrocode} |
| 622 |
\ifnum0=`{\fi}} |
| 623 |
% \end{macrocode} |
| 624 |
% \end{macro} |
| 625 |
% |
| 626 |
% \begin{macro}{\TY@checkmin} |
| 627 |
% Check that no column is squeezed below |\tymin|. If it is, fix the |
| 628 |
% width of that column to |\tymin| and try again re-computing the |
| 629 |
% ratio. (The new ratio will be smaller, and may squeeze yet more |
| 630 |
% rows, so need to iterate this, currently just do it four times.) |
| 631 |
% \begin{macrocode} |
| 632 |
\def\TY@checkmin{% |
| 633 |
\let\TY@checkmin\relax |
| 634 |
\ifdim\TY@tablewidth>\z@ |
| 635 |
\Gscale@div\TY@ratio\TY@linewidth\TY@tablewidth |
| 636 |
% \changes{v0.9}{2008/12/01} |
| 637 |
% {\cs{TY@linewidth}} |
| 638 |
\ifdim\TY@tablewidth <\TY@linewidth |
| 639 |
\def\TY@ratio{1}% |
| 640 |
\fi |
| 641 |
\else |
| 642 |
\TY@warn{No suitable columns!}% |
| 643 |
\def\TY@ratio{1}% |
| 644 |
\fi |
| 645 |
\count@\z@ |
| 646 |
Z \message{^^JLine Width: \the\TY@linewidth, |
| 647 |
Z Natural Width: \the\TY@tablewidth, |
| 648 |
Z Ratio: \TY@ratio^^J}% |
| 649 |
\@tempdima\z@ |
| 650 |
\loop |
| 651 |
\ifnum\count@<\TY@count |
| 652 |
\advance\count@\@ne |
| 653 |
\ifdim\csname TY@F\the\count@\endcsname>\tymin |
| 654 |
\dimen@\csname TY@\the\count@\endcsname |
| 655 |
\dimen@\TY@ratio\dimen@ |
| 656 |
\ifdim\dimen@<\tymin |
| 657 |
Z \message{Column \the\count@\space ->}% |
| 658 |
% \end{macrocode} |
| 659 |
% |
| 660 |
% \changes{v0.4}{1996/03/29} |
| 661 |
% {\cs{global} added} |
| 662 |
% \begin{macrocode} |
| 663 |
\global\expandafter\let\csname TY@F\the\count@\endcsname\tymin |
| 664 |
\global\advance\TY@linewidth-\tymin |
| 665 |
\global\advance\TY@tablewidth-\csname TY@\the\count@\endcsname |
| 666 |
\let\TY@checkmin\TY@@checkmin |
| 667 |
\else |
| 668 |
% \end{macrocode} |
| 669 |
% |
| 670 |
% \changes{v0.4}{1996/03/29} |
| 671 |
% {\cs{xdef} not \cs{edef}} |
| 672 |
% \begin{macrocode} |
| 673 |
\expandafter\xdef\csname TY@F\the\count@\endcsname{\the\dimen@}% |
| 674 |
\advance\@tempdima\csname TY@F\the\count@\endcsname |
| 675 |
\fi |
| 676 |
\fi |
| 677 |
Z \dimen@\csname TY@F\the\count@\endcsname\message{\the\dimen@, }% |
| 678 |
\repeat |
| 679 |
Z \message{^^JTotal:\the\@tempdima^^J}% |
| 680 |
} |
| 681 |
% \end{macrocode} |
| 682 |
% \end{macro} |
| 683 |
% |
| 684 |
% \begin{macro}{\TY@@checkmin} |
| 685 |
% Saved value |
| 686 |
% \begin{macrocode} |
| 687 |
\let\TY@@checkmin\TY@checkmin |
| 688 |
% \end{macrocode} |
| 689 |
% \end{macro} |
| 690 |
% |
| 691 |
% \begin{macro}{TY@linewidth} |
| 692 |
% Stores the target width. |
| 693 |
% \begin{macrocode} |
| 694 |
\newdimen\TY@linewidth |
| 695 |
% \end{macrocode} |
| 696 |
% \end{macro} |
| 697 |
% |
| 698 |
% \begin{macro}{\tyformat} |
| 699 |
% What to do with columns |
| 700 |
% \begin{macrocode} |
| 701 |
\def\tyformat{\everypar{{\nobreak\hskip\z@skip}}} |
| 702 |
% \end{macrocode} |
| 703 |
% \end{macro} |
| 704 |
% |
| 705 |
% \begin{macro}{tymin} |
| 706 |
% Columns narrower than this are not fudged. |
| 707 |
% \begin{macrocode} |
| 708 |
\newdimen\tymin |
| 709 |
\tymin=10pt |
| 710 |
% \end{macrocode} |
| 711 |
% \end{macro} |
| 712 |
% |
| 713 |
% \begin{macro}{tymin} |
| 714 |
% Columns wider than this are all treated alike and set to the same |
| 715 |
% width, to stop one particularly long entry hijacking the entire |
| 716 |
% table. |
| 717 |
% \begin{macrocode} |
| 718 |
\newdimen\tymax |
| 719 |
\tymax=2\textwidth |
| 720 |
% \end{macrocode} |
| 721 |
% \end{macro} |
| 722 |
% |
| 723 |
% \begin{macro}{\@testpatch} |
| 724 |
% \iffalse |
| 725 |
% Add |s| possibility. This works for \emph{all} |array| and |tabular| |
| 726 |
% environments. |
| 727 |
% \fi |
| 728 |
% Also add |LCRJ| although these don't do anything useful |
| 729 |
% except in |tabulary|. |
| 730 |
% \begin{macrocode} |
| 731 |
\def\@testpach{\@chclass |
| 732 |
\ifnum \@lastchclass=6 \@ne \@chnum \@ne \else |
| 733 |
\ifnum \@lastchclass=7 5 \else |
| 734 |
\ifnum \@lastchclass=8 \tw@ \else |
| 735 |
\ifnum \@lastchclass=9 \thr@@ |
| 736 |
\else \z@ |
| 737 |
\ifnum \@lastchclass = 10 \else |
| 738 |
\edef\@nextchar{\expandafter\string\@nextchar}% |
| 739 |
\@chnum |
| 740 |
\if \@nextchar c\z@ \else |
| 741 |
\if \@nextchar l\@ne \else |
| 742 |
\if \@nextchar r\tw@ \else |
| 743 |
% \if \@nextchar s6 \else |
| 744 |
\if \@nextchar C7 \else |
| 745 |
\if \@nextchar L8 \else |
| 746 |
\if \@nextchar R9 \else |
| 747 |
\if \@nextchar J10 \else |
| 748 |
\z@ \@chclass |
| 749 |
\if\@nextchar |\@ne \else |
| 750 |
\if \@nextchar !6 \else |
| 751 |
\if \@nextchar @7 \else |
| 752 |
\if \@nextchar <8 \else |
| 753 |
\if \@nextchar >9 \else |
| 754 |
10 |
| 755 |
\@chnum |
| 756 |
\if \@nextchar m\thr@@\else |
| 757 |
\if \@nextchar p4 \else |
| 758 |
\if \@nextchar b5 \else |
| 759 |
\z@ \@chclass \z@ \@preamerr \z@ \fi \fi \fi \fi\fi \fi \fi\fi \fi |
| 760 |
% \fi |
| 761 |
\fi \fi \fi \fi \fi \fi \fi \fi \fi \fi \fi} |
| 762 |
% \end{macrocode} |
| 763 |
% \end{macro} |
| 764 |
% |
| 765 |
% \begin{macro}{\TY@classz} |
| 766 |
% Here hacked around without the respect Frank's code deserves\ldots |
| 767 |
% \begin{macrocode} |
| 768 |
\def\TY@classz{% |
| 769 |
\@classx |
| 770 |
\@tempcnta\count@ |
| 771 |
\ifx\TY@box\TY@box@v |
| 772 |
\global\advance\TY@count\@ne |
| 773 |
\fi |
| 774 |
\let\centering c% |
| 775 |
\let\raggedright\noindent |
| 776 |
\let\raggedleft\indent |
| 777 |
\let\arraybackslash\relax |
| 778 |
\prepnext@tok |
| 779 |
\ifnum\@chnum<6 |
| 780 |
\global\expandafter\let\csname TY@F\the\TY@count\endcsname\z@ |
| 781 |
\fi |
| 782 |
\ifnum\@chnum=6 |
| 783 |
\global\expandafter\let\csname TY@F\the\TY@count\endcsname\z@ |
| 784 |
\fi |
| 785 |
\@addtopreamble{% |
| 786 |
\ifcase\@chnum |
| 787 |
\hfil\hskip1sp% |
| 788 |
\d@llarbegin\insert@column\d@llarend\do@row@strut\hfil \or |
| 789 |
\hskip1sp% |
| 790 |
\d@llarbegin \insert@column \d@llarend\do@row@strut\hfil \or |
| 791 |
\hfil\hskip1sp% |
| 792 |
\d@llarbegin \insert@column \d@llarend\do@row@strut \or |
| 793 |
\setbox\ar@mcellbox\vbox |
| 794 |
\@startpbox{\@nextchar}\insert@pcolumn \@endpbox |
| 795 |
\ar@align@mcell |
| 796 |
\do@row@strut\or |
| 797 |
\vtop \@startpbox{\@nextchar}\insert@pcolumn \@endpbox \or |
| 798 |
\vbox \@startpbox{\@nextchar}\insert@pcolumn \@endpbox \or |
| 799 |
\d@llarbegin \insert@column \d@llarend \do@row@strut \or% dubious "s" case |
| 800 |
\TY@box\centering\or |
| 801 |
\TY@box\raggedright\or |
| 802 |
\TY@box\raggedleft\or |
| 803 |
\TY@box\relax |
| 804 |
\fi}\prepnext@tok} |
| 805 |
% \end{macrocode} |
| 806 |
% \end{macro} |
| 807 |
% |
| 808 |
% \begin{macro}{\TY@box} |
| 809 |
% The argument is |\centering| etc depending on whether LCRJ is used. |
| 810 |
% However in this version the entries are set in horizontal mode with |
| 811 |
% definitions mimicing the standard lcr columns. Later |\TY@box| will |
| 812 |
% be redefined to |\TY@box@v| which really sets the entries in |
| 813 |
% vertical mode. |
| 814 |
% \begin{macrocode} |
| 815 |
\def\TY@box#1{% |
| 816 |
\ifx\centering#1% |
| 817 |
\hfil\hskip1sp% |
| 818 |
\d@llarbegin\insert@column\d@llarend\do@row@strut \hfil \else |
| 819 |
\ifx\raggedright#1% |
| 820 |
\hskip1sp% |
| 821 |
\d@llarbegin \insert@column \d@llarend\do@row@strut \hfil \else |
| 822 |
\ifx\raggedleft#1% |
| 823 |
\hfil\hskip1sp% |
| 824 |
\kern\z@ \d@llarbegin \insert@column \d@llarend\do@row@strut \else |
| 825 |
\ifx\relax#1% |
| 826 |
\d@llarbegin \insert@column \d@llarend\do@row@strut |
| 827 |
\fi \fi \fi \fi} |
| 828 |
% \end{macrocode} |
| 829 |
% \end{macro} |
| 830 |
% |
| 831 |
% \begin{macro}{\TY@box@v} |
| 832 |
% The version to use in a final run, set the |CLRJ| columns in a |
| 833 |
% parbox of the appropriate width. |
| 834 |
% \begin{macrocode} |
| 835 |
\def\TY@box@v#1{% |
| 836 |
\vtop \@startpbox{\csname TY@F\the\TY@count\endcsname}% |
| 837 |
#1\arraybackslash\tyformat |
| 838 |
\insert@pcolumn\@endpbox} |
| 839 |
% \end{macrocode} |
| 840 |
% \end{macro} |
| 841 |
% |
| 842 |
% \begin{macro}{\TY@tablewidth} |
| 843 |
% The natural width of the table on the first run. |
| 844 |
% \begin{macrocode} |
| 845 |
\newdimen\TY@tablewidth |
| 846 |
% \end{macrocode} |
| 847 |
% \end{macro} |
| 848 |
% |
| 849 |
% \begin{macro}{\Gscale@div} |
| 850 |
% Stolen from graphics package. |
| 851 |
% \begin{macrocode} |
| 852 |
\def\Gscale@div#1#2#3{% |
| 853 |
\setlength\dimen@{#3}% |
| 854 |
\ifdim\dimen@=\z@ |
| 855 |
\PackageError{graphics}{Division by 0}\@eha |
| 856 |
\dimen@#2% |
| 857 |
\fi |
| 858 |
\edef\@tempd{\the\dimen@}% |
| 859 |
\setlength\dimen@{#2}% |
| 860 |
\count@65536\relax |
| 861 |
\ifdim\dimen@<\z@ |
| 862 |
\dimen@-\dimen@ |
| 863 |
\count@-\count@ |
| 864 |
\fi |
| 865 |
\loop |
| 866 |
\ifdim\dimen@<8192\p@ |
| 867 |
\dimen@\tw@\dimen@ |
| 868 |
\divide\count@\tw@ |
| 869 |
\repeat |
| 870 |
\dimen@ii=\@tempd\relax |
| 871 |
\divide\dimen@ii\count@ |
| 872 |
\divide\dimen@\dimen@ii |
| 873 |
\edef#1{\strip@pt\dimen@}} |
| 874 |
% \end{macrocode} |
| 875 |
% \end{macro} |
| 876 |
% |
| 877 |
% \begin{macro}{\TY@get@body} |
| 878 |
% Place all tokens as far as the first |\end| into a token register. |
| 879 |
% Then call |\TY@find@end| to see if we are at |\end{tabulary}|. |
| 880 |
% \begin{macrocode} |
| 881 |
\long\def\TY@get@body#1\end |
| 882 |
{\toks@\expandafter{\the\toks@#1}\TY@find@end} |
| 883 |
% \end{macrocode} |
| 884 |
% \end{macro} |
| 885 |
% |
| 886 |
% \begin{macro}{\TY@find@end} |
| 887 |
% If we are at |\end{tabulary}|, call |\end{tabulary}|, otherwise |
| 888 |
% add |\end{...}| to the register, and call |\TY@get@body| again. |
| 889 |
% \begin{macrocode} |
| 890 |
\def\TY@find@end#1{% |
| 891 |
\def\@tempa{#1}% |
| 892 |
\ifx\@tempa\TY@\def\@tempa{\end{#1}}\expandafter\@tempa |
| 893 |
\else\toks@\expandafter |
| 894 |
{\the\toks@\end{#1}}\expandafter\TY@get@body\fi} |
| 895 |
% \end{macrocode} |
| 896 |
% \end{macro} |
| 897 |
% |
| 898 |
% \begin{macro}{\TY@warn} |
| 899 |
% Warning messages. |
| 900 |
% \begin{macrocode} |
| 901 |
\def\TY@warn{% |
| 902 |
\PackageWarning{tabulary}} |
| 903 |
% \end{macrocode} |
| 904 |
% \end{macro} |
| 905 |
% |
| 906 |
% |
| 907 |
% \begin{macrocode} |
| 908 |
\catcode`\Z=11 |
| 909 |
% \end{macrocode} |
| 910 |
% |
| 911 |
% \textsf{colortbl} support. |
| 912 |
% \begin{macrocode} |
| 913 |
\AtBeginDocument{ |
| 914 |
\@ifpackageloaded{colortbl}{% |
| 915 |
\expandafter\def\expandafter\@mkpream\expandafter#\expandafter1% |
| 916 |
\expandafter{% |
| 917 |
\expandafter\let\expandafter\CT@setup\expandafter\relax |
| 918 |
\expandafter\let\expandafter\CT@color\expandafter\relax |
| 919 |
\expandafter\let\expandafter\CT@do@color\expandafter\relax |
| 920 |
\expandafter\let\expandafter\color\expandafter\relax |
| 921 |
\expandafter\let\expandafter\CT@column@color\expandafter\relax |
| 922 |
\expandafter\let\expandafter\CT@row@color\expandafter\relax |
| 923 |
\expandafter\let\expandafter\CT@cell@color\expandafter\relax |
| 924 |
\@mkpream{#1}} |
| 925 |
\let\TY@@mkpream\@mkpream |
| 926 |
\def\TY@classz{% |
| 927 |
\@classx |
| 928 |
\@tempcnta\count@ |
| 929 |
\ifx\TY@box\TY@box@v |
| 930 |
\global\advance\TY@count\@ne |
| 931 |
\fi |
| 932 |
\let\centering c% |
| 933 |
\let\raggedright\noindent |
| 934 |
\let\raggedleft\indent |
| 935 |
\let\arraybackslash\relax |
| 936 |
\prepnext@tok |
| 937 |
\expandafter\CT@extract\the\toks\@tempcnta\columncolor!\@nil |
| 938 |
\ifnum\@chnum<6 |
| 939 |
\global\expandafter\let\csname TY@F\the\TY@count\endcsname\z@ |
| 940 |
\fi |
| 941 |
\ifnum\@chnum=6 |
| 942 |
\global\expandafter\let\csname TY@F\the\TY@count\endcsname\z@ |
| 943 |
\fi |
| 944 |
\@addtopreamble{% |
| 945 |
\setbox\z@\hbox\bgroup\bgroup |
| 946 |
\ifcase\@chnum |
| 947 |
\hskip\stretch{.5}\kern\z@ |
| 948 |
\d@llarbegin\insert@column\d@llarend\hskip\stretch{.5}\or |
| 949 |
\kern\z@%<<<<<<<<<<<<<<<<<<<<<<<<<<< |
| 950 |
\d@llarbegin \insert@column \d@llarend \hfill \or |
| 951 |
\hfill\kern\z@ \d@llarbegin \insert@column \d@llarend \or |
| 952 |
\setbox\ar@mcellbox\vbox |
| 953 |
\@startpbox{\@nextchar}\insert@pcolumn \@endpbox |
| 954 |
\ar@align@mcell |
| 955 |
\do@row@strut \or |
| 956 |
\vtop \@startpbox{\@nextchar}\insert@pcolumn \@endpbox \or |
| 957 |
\vbox \@startpbox{\@nextchar}\insert@pcolumn \@endpbox \or |
| 958 |
\d@llarbegin \insert@pcolumn \d@llarend \or% dubious s case |
| 959 |
\TY@box\centering\or |
| 960 |
\TY@box\raggedright\or |
| 961 |
\TY@box\raggedleft\or |
| 962 |
\TY@box\relax |
| 963 |
\fi |
| 964 |
\egroup\egroup |
| 965 |
\begingroup |
| 966 |
\CT@setup |
| 967 |
\CT@column@color |
| 968 |
\CT@row@color |
| 969 |
\CT@cell@color |
| 970 |
\CT@do@color |
| 971 |
\endgroup |
| 972 |
\@tempdima\ht\z@ |
| 973 |
\advance\@tempdima\minrowclearance |
| 974 |
\vrule\@height\@tempdima\@width\z@ |
| 975 |
\unhbox\z@ |
| 976 |
}\prepnext@tok}% |
| 977 |
% \end{macrocode} |
| 978 |
% |
| 979 |
% \begin{macrocode} |
| 980 |
\def\TY@arrayrule{% |
| 981 |
\TY@subwidth\arrayrulewidth |
| 982 |
\@addtopreamble{{\CT@arc@\vline}}}% |
| 983 |
% \end{macrocode} |
| 984 |
% |
| 985 |
% \begin{macrocode} |
| 986 |
\def\TY@classvi{\ifcase \@lastchclass |
| 987 |
\@acol \or |
| 988 |
\TY@subwidth\doublerulesep |
| 989 |
\ifx\CT@drsc@\relax |
| 990 |
\@addtopreamble{\hskip\doublerulesep}% |
| 991 |
\else |
| 992 |
\@addtopreamble{{\CT@drsc@\vrule\@width\doublerulesep}}% |
| 993 |
\fi\or |
| 994 |
\@acol \or |
| 995 |
\@classvii |
| 996 |
\fi}% |
| 997 |
% \end{macrocode} |
| 998 |
% |
| 999 |
% \begin{macrocode} |
| 1000 |
}{% |
| 1001 |
\let\CT@start\relax |
| 1002 |
} |
| 1003 |
% \end{macrocode} |
| 1004 |
% end of at begin document |
| 1005 |
% \begin{macrocode} |
| 1006 |
} |
| 1007 |
% \end{macrocode} |
| 1008 |
% |
| 1009 |
% \begin{macro}{\TX@warn} |
| 1010 |
% \changes{v0.6}{2003/02/26}{macro added} |
| 1011 |
% |\verb| support, uses same csnames as in TX so they share code if |
| 1012 |
% both loaded (this version names tabulary in the warning though). |
| 1013 |
% See tabularx for documentation. |
| 1014 |
% \begin{macrocode} |
| 1015 |
{\uccode`\*=`\ % |
| 1016 |
\uppercase{\gdef\TX@verb{% |
| 1017 |
\leavevmode\null\TX@vwarn |
| 1018 |
{\ifnum0=`}\fi\ttfamily\let\\\ignorespaces |
| 1019 |
\@ifstar{\let~*\TX@vb}{\TX@vb}}}} |
| 1020 |
\def\TX@vb#1{\def\@tempa##1#1{\toks@{##1}\edef\@tempa{\the\toks@}% |
| 1021 |
\expandafter\TX@v\meaning\@tempa\\ \\\ifnum0=`{\fi}}\@tempa!} |
| 1022 |
\def\TX@v#1!{\afterassignment\TX@vfirst\let\@tempa= } |
| 1023 |
\begingroup |
| 1024 |
\catcode`\*=\catcode`\# |
| 1025 |
\catcode`\#=12 |
| 1026 |
\gdef\TX@vfirst{% |
| 1027 |
\if\@tempa#% |
| 1028 |
\def\@tempb{\TX@v@#}% |
| 1029 |
\else |
| 1030 |
\let\@tempb\TX@v@ |
| 1031 |
\if\@tempa\space~\else\@tempa\fi |
| 1032 |
\fi |
| 1033 |
\@tempb} |
| 1034 |
\gdef\TX@v@*1 *2{% |
| 1035 |
\TX@v@hash*1##\relax\if*2\\\else~\expandafter\TX@v@\fi*2} |
| 1036 |
\gdef\TX@v@hash*1##*2{*1\ifx*2\relax\else#\expandafter\TX@v@hash\fi*2} |
| 1037 |
\endgroup |
| 1038 |
\def\TX@vwarn{% |
| 1039 |
\@warning{\noexpand\verb may be unreliable inside tabularx/y}% |
| 1040 |
\global\let\TX@vwarn\@empty} |
| 1041 |
% \end{macrocode} |
| 1042 |
% \end{macro} |
| 1043 |
% |
| 1044 |
% \begin{macro}{\tblcrcrn}^^A L3 name |
| 1045 |
% Patch to ensure |\tbl_crcr:n| ends with |\crcr|. |
| 1046 |
% (Will be fixed in later \LaTeX\ releases. |
| 1047 |
% \begin{macrocode} |
| 1048 |
%<package> |
| 1049 |
% \end{macrocode} |
| 1050 |
% |
| 1051 |
% \begin{macrocode} |
| 1052 |
\ExplSyntaxOn |
| 1053 |
\cs_set:Npn \@tempa #1 { |
| 1054 |
\int_compare:nNnT \g__tbl_col_int > 0 |
| 1055 |
{ |
| 1056 |
\tbl_count_missing_cells:n {#1} |
| 1057 |
\cr |
| 1058 |
} |
| 1059 |
} |
| 1060 |
\ifx\@tempa\tbl_crcr:n |
| 1061 |
\cs_set:Npn \tbl_crcr:n #1 { |
| 1062 |
\int_compare:nNnT \g__tbl_col_int > 0 |
| 1063 |
{ |
| 1064 |
\tbl_count_missing_cells:n {#1} |
| 1065 |
} |
| 1066 |
\crcr |
| 1067 |
} |
| 1068 |
\fi |
| 1069 |
\let\@tempa\@undefined |
| 1070 |
\ExplSyntaxOff |
| 1071 |
% \end{macrocode} |
| 1072 |
% |
| 1073 |
% \begin{macrocode} |
| 1074 |
%</package> |
| 1075 |
% \end{macrocode} |
| 1076 |
% \end{macro} |
| 1077 |
% |
| 1078 |
% \PrintIndex |
| 1079 |
% \Finale |
| 1080 |
% |