1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592
|
%%
%% This is file `polytable.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% polytable.dtx (with options: `package')
%%
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{polytable}%
[2003/12/26 v0.7.1 `polytable' package (Andres Loeh)]
\RequirePackage{lazylist}
\RequirePackage{array}
\DeclareOption{debug}{\AtEndOfPackage\PT@debug}
\DeclareOption{silent}{\AtEndOfPackage\PT@silent}
\ProcessOptions
\newdimen\PT@colwidth
\newcount\PT@cols
\newcount\PT@table
\newif\ifPT@changed
\def\PT@allcols{\Nil}
\def\PT@allpubliccols{\Nil}
\let\PT@infromto\empty
\let\PT@currentwidths\empty
\def\PT@false{0}
\def\PT@true{1}
\let\PT@inrestore\PT@false
\def\PT@debug
{\def\PT@typeout@ ##1{\typeout{(polytable) ##1}}}
\let\PT@typeout@\@gobble
\def\PT@warning{\PackageWarning{polytable}}%
\def\PT@silent
{\let\PT@typeout@\@gobble\let\PT@warning\@gobble}
\def\PT@rerun
{\PT@typeout@{We have to rerun LaTeX ...}%
\AtEndDocument
{\PackageWarning{polytable}%
{Column widths have changed. Rerun LaTeX.\@gobbletwo}}%
\global\let\PT@rerun\relax}
\def\PT@listopmacro #1#2#3% #1 #3 to the list #2
{\def\PT@temp{#1{#3}}%
\expandafter\expandafter\expandafter
\def\expandafter\expandafter\expandafter
#2\expandafter\expandafter\expandafter
{\expandafter\PT@temp\expandafter{#2}}}
\def\PT@consmacro{\PT@listopmacro\Cons}
\def\PT@appendmacro{\PT@listopmacro\Cat}
\def\PT@addbeginmacro #1#2% add #2 to the beginning of #1
{\def\PT@temp{#2}%
\expandafter\expandafter\expandafter
\def\expandafter\expandafter\expandafter
#1\expandafter\expandafter\expandafter
{\expandafter\PT@temp #1}}
\def\PT@gaddendmacro #1#2% add #2 to the end of #1
{\expandafter\gdef\expandafter #1\expandafter{#1#2}}
\def\PT@enamedef #1#2% sets name #1 to the expansion of #2
{\expandafter\Twiddle\expandafter\@namedef\expandafter{#2}{#1}}
\def\PT@adddeftomacroas#1#2#3%
{\expandafter\expandafter\expandafter
\def\expandafter\expandafter\expandafter\PT@temp
\expandafter\expandafter\expandafter
{\expandafter\expandafter\expandafter\def
\expandafter\expandafter\csname #2\endcsname
\expandafter{#3}}%
\expandafter\expandafter\expandafter\PT@gaddendmacro
\expandafter\expandafter\expandafter
{\expandafter\expandafter\csname #1\endcsname
\expandafter}\expandafter{\PT@temp}}
\def\PT@adddeftomacro#1#2%
{\def\PT@temp{\PT@adddeftomacroas{#1}{#2}}%
\expandafter\PT@temp\csname #2\endcsname}
\def\PT@addoptargtomacro
{\PT@add@argtomacro\PT@makeoptarg}
\def\PT@addargtomacro
{\PT@add@argtomacro\PT@makearg}
\def\PT@add@argtomacro#1#2#3%
{\expandafter\expandafter\expandafter\gdef
\expandafter\expandafter\expandafter\PT@temp
\expandafter\expandafter\expandafter{\csname #3\endcsname}%
#1%
\expandafter\PT@gaddendmacro\expandafter
{\expandafter#2\expandafter}\expandafter{\PT@temp}}
\def\PT@makeoptarg%
{\expandafter\def\expandafter\PT@temp\expandafter
{\expandafter[\PT@temp]}}
\def\PT@makearg%
{\expandafter\def\expandafter\PT@temp\expandafter
{\expandafter{\PT@temp}}}
\newcommand*{\PT@gobbleoptional}[1][]{\ignorespaces}
\let\PT@origomit\omit
\def\PT@disableomitonce
{\def\omit
{\let\omit\PT@origomit}}
\newcommand{\beginpolytable}%
{\edef\PT@environment{\@currenvir}%
\begingroup
% new in v0.7: save counters
\PT@savecounters
\toks@{}% initialise token register
\PT@scantoend}
\let\endpolytable=\relax
\long\def\PT@scantoend #1\end #2%
{\toks@\expandafter{\the\toks@ #1}%
\def\PT@temp{#2}%
\ifx\PT@temp\PT@environment
\expandafter\PT@getwidths
\else
\toks@\expandafter{\the\toks@\end{#2}}%
\expandafter\PT@scantoend
\fi}
\def\PT@getwidths
{\let\column\PT@firstrun@column
\let\savecolumns\PT@savewidths
\let\restorecolumns\PT@restorewidths
\column{@begin@}{@{}l@{}}
\PT@cols=0\relax%
\let\fromto\PT@fromto
\let\nextline\PT@resetcolumn
\PT@changedfalse % nothing has changed so far
\PT@resetcolumn % we are at the beginning of a line
\the\toks@
\ifx\column\PT@otherrun@column
\else
% we are in first run, print extra info
\PT@typeout@{Number of columns: \the\PT@cols}%
\PT@typeout@{Column list: \Print\PT@allcols}%
\fi
\let\PT@firstrun@column\PT@otherrun@column
\let\savecolumns\PT@gobbleoptional
\let\restorecolumns\PT@gobbleoptional
\let\PT@savewidths\PT@gobbleoptional
\let\PT@restorewidths\PT@gobbleoptional
\PT@restorecounters
\ifPT@changed
% we need to rerun if something has changed
\expandafter\PT@getwidths
\else
% we are done and can do the sorting
\PT@typeout@{Reached fixpoint.}%
\expandafter\PT@sortcols
\fi}
\def\PT@savecounters
{\begingroup
\def\@elt ##1%
{\global\csname c@##1\endcsname\the\csname c@##1\endcsname}%
\xdef\PT@restorecounters{\cl@@ckpt}%
\endgroup}
\def\PT@sortcols
{\edef\PT@sortedlist
{\Foldr{\noexpand\Cons}{\noexpand\Nil}%
{\Insertsort\PT@ltmax\PT@allcols}}%
\PT@typeout@{Sorted columns: \Print\PT@sortedlist}%
\PT@cols=0\relax%
\Execute{\Map\PT@numbercol\PT@sortedlist}%
\PT@typeout@{Numbered successfully, last column is \StripColumn\PT@lastcol}%
\ifx\PT@currentwidths\empty
\else
\PT@typeout@{Saving table information for \PT@currentwidths .}%
\expandafter\PT@saveinformation\expandafter{\PT@currentwidths}%
\fi
\PT@typeset}
\def\PT@typeset
{\PT@typeout@{Typesetting the table ...}%
\edef\PT@temp{@{}\Execute{\Map\PT@preamble\PT@sortedlist}}%
%\PT@typeout@{Preamble: \PT@temp}%
\let\fromto\PT@multicolumn
\PT@resetcolumn % we are at the beginning of a line
\let\nextline=\PT@resetandcr
\expandafter\PT@begin\expandafter{\PT@temp}%
\the\toks@
\PT@end
\endgroup
\PT@typeout@{Finished.}%
\expandafter\end\expandafter{\PT@environment}}%
\newcommand\PT@firstrun@column[3][0pt]%
{\@ifundefined{PT@col@#2.type}%
{\PT@typeout@{Defining column #2 at #1.}%
\@namedef{PT@col@#2.type}{#3}%
\@namedef{PT@col@#2.width}{#1}% initialize the width of the column
% add the new column to the (sortable) list of all columns
\PT@consmacro\PT@allcols{PT@col@#2}%
\advance\PT@cols by 1\relax}%
{\expandafter\ifx\csname PT@col@#2.type\endcsname\empty
\relax % will be defined in a later table of the same set
\else
\PT@warning{Redefining column #2}%
\fi
\@namedef{PT@col@#2.type}{#3}%
\expandafter\ifdim#1>0pt\relax
\PT@typeout@{Redefining column #2 at #1.}%
\@namedef{PT@col@#2.width}{#1}%
\fi
}%
\@ifundefined{PT@col@#2.max}%
{\@namedef{PT@col@#2.max}{#1}%
\expandafter\let\csname PT@col@#2.trusted\endcsname\PT@true}{}%
\ignorespaces}
\newcommand\PT@otherrun@column[3][]%
{\ignorespaces}
\def\PT@checkcoldefined #1%
{\@ifundefined{PT@col@#1.type}%
{\PackageError{polytable}{Undefined column #1}{}}{}}%
\def\PT@fromto #1#2#3%
{\PT@infromto
\def\PT@infromto{%
\PackageError{polytable}{Nested fromto}{}}%
\PT@checkcoldefined{#1}%
\PT@checkcoldefined{#2}%
\def\PT@temp{PT@col@#1}%
\ifx\PT@currentcol\PT@temp
\PT@typeout@{No need to skip columns.}%
\else
\PT@colwidth=\expandafter\@nameuse\expandafter
{\PT@currentcol.width}\relax
\ifdim\PT@colwidth>\csname PT@col@#1.width\endcsname\relax
% we need to change the width
\PT@typeout@{s #1: old=\@nameuse{PT@col@#1.width} new=\the\PT@colwidth}%
\PT@changedtrue
\PT@enamedef{PT@col@#1.width}{\the\PT@colwidth}%
\fi
\PT@colwidth=\expandafter\@nameuse\expandafter
{\PT@currentcol.max}\relax
\ifdim\PT@colwidth>\csname PT@col@#1.max\endcsname\relax
% we need to change the width
\PT@typeout@{S #1: old=\@nameuse{PT@col@#1.max} new=\the\PT@colwidth}%
\PT@changedtrue
\PT@checkrerun
\PT@enamedef{PT@col@#1.max}{\the\PT@colwidth}%
\fi
\ifnum\csname PT@col@#1.trusted\endcsname=\PT@false\relax
\ifdim\PT@colwidth=\csname PT@col@#1.max\endcsname\relax
\PT@typeout@{#1=\the\PT@colwidth\space is now trusted}%
\expandafter\let\csname PT@col@#1.trusted\endcsname\PT@true%
\fi
\fi
\fi
\begingroup
\ifmmode
\let\d@llarbegin=$%$
\let\d@llarend=$%$
\let\col@sep=\arraycolsep
\else
\let\d@llarbegin=\begingroup
\let\d@llarend=\endgroup
\let\col@sep=\tabcolsep
\fi
%\def\PT@currentcol{PT@col@#1}%
%\ifx\PT@currentcol\PT@nullcol
%\else
% \PT@addbeginmacro\PT@currentpreamble{@{}}%
%\fi
\expandafter\expandafter\expandafter
\def\expandafter\expandafter\expandafter\PT@currentpreamble
\expandafter\expandafter\expandafter
{\csname PT@col@#1.type\endcsname}%
\setbox0=\hbox{%
\expandafter\@mkpream\expandafter{\PT@currentpreamble}%
\def\@sharp{\strut #3}%
%\show\@preamble
\@preamble}%
\expandafter\gdef\expandafter\PT@temp\expandafter{\the\wd0}%
\endgroup
\global\PT@colwidth=\@nameuse{PT@col@#1.width}%
\global\advance\PT@colwidth by \PT@temp\relax%
\ifdim\PT@colwidth>\csname PT@col@#2.width\endcsname\relax
% we need to change the width
\PT@typeout@{c #2:
old=\@nameuse{PT@col@#2.width}
new=\the\PT@colwidth}%
\PT@changedtrue
\PT@enamedef{PT@col@#2.width}{\the\PT@colwidth}%
\fi
\global\PT@colwidth=\@nameuse{PT@col@#1.max}%
\global\advance\PT@colwidth by \PT@temp\relax%
\ifdim\PT@colwidth>\csname PT@col@#2.max\endcsname\relax
% we need to change the width
\PT@typeout@{C #2:
old=\@nameuse{PT@col@#2.max}
new=\the\PT@colwidth}%
\PT@changedtrue
\PT@checkrerun
\PT@enamedef{PT@col@#2.max}{\the\PT@colwidth}%
\fi
\ifnum\csname PT@col@#2.trusted\endcsname=\PT@false\relax
\ifdim\PT@colwidth=\csname PT@col@#2.max\endcsname\relax
\PT@typeout@{#2=\the\PT@colwidth\space is now trusted}%
\expandafter\let\csname PT@col@#2.trusted\endcsname\PT@true%
\fi
\fi
\def\PT@currentcol{PT@col@#2}%
\let\PT@infromto\empty
\ignorespaces}%
\def\PT@checkrerun
{\ifnum\PT@inrestore=\PT@true\relax
\PT@rerun
\fi}
\newcommand*{\PT@resetcolumn}[1][]%
{\let\PT@currentcol\PT@nullcol}
\def\PT@nullcol
{PT@col@@begin@}
\def\Execute{\Foldr\Sequence\empty}
\def\Sequence #1#2{#1#2}
\def\ShowColumn #1%
{\ShowColumn@#1\ShowColumn@}
\def\ShowColumn@ PT@col@#1\ShowColumn@
{#1 }
\def\StripColumn #1%
{\expandafter\StripColumn@#1\StripColumn@}
\def\StripColumn@ PT@col@#1\StripColumn@
{#1}
\def\Print#1{\Execute{\Map\ShowColumn#1}}
\def\PT@TeXif #1%
{\expandafter\@gobble#1\relax
\PT@gobblefalse
\else\relax
\gobbletrue
\fi}
\def\PT@gobblefalse\else\relax\gobbletrue\fi #1#2%
{\fi #1}
\def\PT@ltmax #1#2%
{\PT@TeXif{\ifdim\csname #1.max\endcsname<\csname #2.max\endcsname}}
\def\PT@numbercol #1%
{%\PT@typeout@{numbering #1 as \the\PT@cols}%
\PT@enamedef{#1.num}{\the\PT@cols}%
\def\PT@lastcol{#1}%
\advance\PT@cols by 1\relax}
\def\PT@preamble #1%
{l@{}}
\newcommand{\PT@resetandcr}[1][0pt]%
{\ifx\PT@currentcol\PT@lastcol
\else
\ifx\PT@currentcol\PT@nullcol
\edef\PT@currentcol{\Head{\Tail\PT@sortedlist}}%
\fi
\edef\PT@currentcol@{\StripColumn\PT@currentcol}%
\edef\PT@lastcol@
{\StripColumn\PT@lastcol}%
\PT@typeout@{adding implicit fromto from \PT@currentcol@
\space to \PT@lastcol@}%
\expandafter\expandafter\expandafter\fromto
\expandafter\expandafter\expandafter{%
\expandafter\expandafter\expandafter\PT@currentcol@
\expandafter}\expandafter{\PT@lastcol@}{}%
\fi
\PT@typeout@{Next line ...}%
\PT@resetcolumn\\[#1]}
\def\PT@multicolumn #1#2#3%
{%\omit\PT@disableomitonce
% skip to current position
\global\PT@cols=\@nameuse{PT@col@#1.num}%
\global\advance\PT@cols
by -\expandafter\csname\PT@currentcol.num\endcsname\relax
\ifx\PT@currentcol\PT@nullcol
\global\advance\PT@cols by -1\relax%
\fi
\PT@typeout@{skipping:
nf=\expandafter\ShowColumn
\expandafter{\PT@currentcol}nt=#1 %
from=\expandafter
\csname\PT@currentcol.num\endcsname\space
to=\@nameuse{PT@col@#1.num}}%
\ifnum\PT@cols>0\relax
\ifnum\PT@cols>1\relax
\global\advance\PT@cols by -1\relax
\PT@typeout@{after next &, multicolumn \the\PT@cols\space blank}%
\PT@NextCol
\multicolumn{\the\PT@cols}{@{}l@{}}{}%
\fi
\PT@NextCol
\fi
\global\PT@cols=\@nameuse{PT@col@#2.num}%
\global\advance\PT@cols by -\@nameuse{PT@col@#1.num}\relax%
%\ifnum\PT@cols>1\relax
% we always skip one column
\PT@typeout@{after next &,
putting text in \the\PT@cols\space multicol}%
\PT@typeout@{nf=#1 nt=#2 %
from=\@nameuse{PT@col@#1.num}
to=\@nameuse{PT@col@#2.num}}%
\expandafter\global\expandafter\let\expandafter\PT@temp
\csname PT@col@#1.type\endcsname%
\PT@NextCol
% use multicolumn
\expandafter\multicolumn
\expandafter{\expandafter\the\expandafter\PT@cols
\expandafter}\expandafter{\PT@temp}{#3}%
%\PT@typeout@{!!!!}%
%\else
% \PT@NextCol
% #3%
%\fi
% set current column
\def\PT@currentcol{PT@col@#2}%
\ignorespaces}%
\def\PT@NextCol
{\PT@typeout@{ & }%
&}%
\def\PT@placeinbox#1#2#3%
{\PT@colwidth=\@nameuse{PT@col@#1.max}%
\advance\PT@colwidth by -\expandafter\csname\PT@currentcol.max\endcsname
\leavevmode
\hb@xt@\PT@colwidth{%
\expandafter\@mkpream\expandafter{@{}l@{}}%
\let\@sharp\empty%
%\show\@preamble
\@preamble}%
\PT@colwidth=\@nameuse{PT@col@#2.max}%
\advance\PT@colwidth by -\@nameuse{PT@col@#1.max}\relax%
\ifmmode
\PT@typeout@{*math mode*}%
\let\d@llarbegin=$%$
\let\d@llarend=$%$
\let\col@sep=\arraycolsep
\else
\PT@typeout@{*text mode*}%
\let\d@llarbegin=\begingroup
\let\d@llarend=\endgroup
\let\col@sep=\tabcolsep
\fi
%\def\PT@currentcol{PT@col@#1}%
\expandafter\expandafter\expandafter
\def\expandafter\expandafter\expandafter\PT@currentpreamble
\expandafter\expandafter\expandafter
{\csname PT@col@#1.type\endcsname}%
%\ifx\PT@currentcol\PT@nullcol
%\else
% \PT@addbeginmacro\PT@currentpreamble{@{}}%
%\fi
\hb@xt@\PT@colwidth{%
\expandafter\@mkpream\expandafter{\PT@currentpreamble}%
\def\@sharp{\strut #3}%
%\show\@preamble
\@preamble}%
\def\PT@currentcol{PT@col@#2}%
\ignorespaces}%
\newcommand*{\PT@setmaxwidth}[3][\PT@false]% #2 column name, #3 maximum width
{\@namedef{PT@col@#2.max}{#3}%
\ifdim#3=0pt\relax
\expandafter\let\csname PT@col@#2.trusted\endcsname=\PT@true%
\else
\expandafter\let\csname PT@col@#2.trusted\endcsname=#1%
\fi
\column{#2}{}}
\def\PT@loadtable#1% #1 table id number
{%\expandafter\show\csname PT@restore@\romannumeral #1\endcsname
%\show\column
\PT@typeout@
{Calling \expandafter\string
\csname PT@restore@\romannumeral #1\endcsname.}%
\let\maxcolumn\PT@setmaxwidth
%\expandafter\show\csname PT@load@\romannumeral #1\endcsname
\csname PT@restore@\romannumeral #1\endcsname}
\def\PT@loadtablebyname#1% #1 set name
{\PT@typeout@{Loading table information for column width set #1.}%
\expandafter\PT@loadtable\expandafter{\csname PT@widths@#1\endcsname}}%
\def\PT@saveinformation#1% #1 set name
{\expandafter\def\expandafter\PT@temp\expandafter
{\csname PT@widths@#1\endcsname}%
\expandafter\def\expandafter\PT@temp\expandafter
{\csname PT@restore@\romannumeral\PT@temp\endcsname}%
\expandafter\gdef\PT@temp{}% start empty
% this is: \Execute{\Map{\PT@savecolumn{\PT@temp}}\PT@sortedlist}
\expandafter\Execute\expandafter{\expandafter
\Map\expandafter{\expandafter\PT@savecolumn
\expandafter{\PT@temp}}\PT@sortedlist}}
\def\PT@savecolumn#1#2% #1 macro name, #2 column name
{\PT@typeout@{saving column #2 in \string #1 ...}%
\def\PT@temp{#2}%
\ifx\PT@temp\PT@nullcol
\PT@typeout@{skipping nullcol ...}%
\else
\PT@typeout@{max=\csname #2.max\endcsname, %
width=\csname #2.width\endcsname, %
trusted=\csname #2.trusted\endcsname}%
% we need the column command in here
% we could do the same in \column, but then the location of
% \save / \restore matters ...
\PT@gaddendmacro{#1}{\maxcolumn}%
\ifnum\csname #2.trusted\endcsname=\PT@true\relax
\PT@gaddendmacro{#1}{[\PT@true]}%
\fi
\edef\PT@temp{\StripColumn{#2}}%
\PT@addargtomacro{#1}{PT@temp}%
\PT@addargtomacro{#1}{#2.max}%
\PT@gaddendmacro{#1}{\column}%
\PT@addoptargtomacro{#1}{#2.width}%
\edef\PT@temp{\StripColumn{#2}}%
\PT@addargtomacro{#1}{PT@temp}%
\PT@addargtomacro{#1}{#2.type}%
%\show#1%
\fi
}
\newcommand*{\PT@savewidths}[1][default@]
{\PT@typeout@{Executing \string\savecolumns [#1].}%
\def\PT@currentwidths{#1}%
\PT@verifywidths{#1}%
\global\advance\PT@table by 1\relax
\expandafter\xdef\csname PT@widths@#1\endcsname
{\the\PT@table}%
\PT@loadtable{\PT@table}%
\ignorespaces}
\newcommand*{\PT@restorewidths}[1][default@]
{\PT@typeout@{Executing \string\restorecolumns [#1].}%
\def\PT@currentwidths{#1}%
\let\PT@inrestore\PT@true
\PT@loadtablebyname{#1}%
\ignorespaces}
\def\PT@comparewidths#1% #1 full column name
{\@ifundefined{#1.max}%
{\PT@typeout@{computed width for #1 is fine ...}}%
{\ifdim\csname #1.max\endcsname>\csname #1.width\endcsname\relax
\PT@typeout@{Preferring saved width for \StripColumn{#1}.}%
\PT@changedtrue
\PT@colwidth=\@nameuse{#1.max}\relax
\PT@enamedef{#1.width}{\the\PT@colwidth}%
\fi}}
\def\PT@trustedmax#1%
{\PT@TeXif{\ifnum\csname #1.trusted\endcsname=\PT@true}}
\def\PT@equalwidths#1% #1 full column name
{\@ifundefined{#1.max}{}%
{\ifdim\csname #1.max\endcsname=\csname #1.width\endcsname\relax
\PT@typeout@{col #1 is okay ...}%
\else
\PT@rerun% a rerun is needed
\fi}}
\def\PT@verifywidths#1% #1 column width set name
{\@ifundefined{PT@widths@#1}%
{\PT@typeout@{Nothing to verify yet for set #1.}%
\PT@typeout@{Scheduling set #1 for verification at end of document.}%
\AtEndDocument{\PT@verifywidths{#1}}}%
{\PT@typeout@{Verifying column width set #1.}%
\expandafter\PT@verify@widths\expandafter
{\csname PT@widths@#1\endcsname}{#1}}}
\def\PT@verify@widths#1#2% #1 set id number, #2 set name
{\@ifundefined{PT@restore@\romannumeral #1}{}%
{\begingroup
\let\column\PT@firstrun@column
\PT@cols=0\relax%
\def\PT@allcols{\Nil}%
\PT@loadtablebyname{#2}%
\PT@table=#1\relax
% nullcolumn is not loaded, therefore:
\expandafter\def\csname\PT@nullcol .width\endcsname{0pt}%
% checking trust
\All{\PT@trustedmax}{\PT@allcols}%
{\PT@typeout@{All maximum widths can be trusted -- writing .max!}%
\PT@save@table{.max}}%
{\PT@typeout@{Untrustworthy maximums widths -- writing .width!}%
\PT@rerun
\PT@save@table{.width}}%
\endgroup}%
\PT@typeout@{Verification for #2 successful.}}
\def\PT@save@table#1%
{\PT@typeout@{Saving column width information.}%
\if@filesw
{\immediate\write\@auxout{%
\gdef\expandafter\noexpand
\csname PT@restore@\romannumeral\PT@table\endcsname
{\Execute{\Map{\PT@write@column{#1}}\PT@allcols}}}}%
\fi}
\def\PT@write@column #1#2%
{\noexpand\maxcolumn^^J%
{\StripColumn{#2}}%
{\@nameuse{#2#1}}}%
\newenvironment{ptabular}[1][c]%
{\def\PT@begin{\tabular[#1]}%
\let\PT@end\endtabular
\beginpolytable}
{\endpolytable}
\newenvironment{parray}[1][c]%
{\def\PT@begin{\array[#1]}%
\let\PT@end\endarray
\beginpolytable}
{\endpolytable}
\def\pboxed{%
\let\PT@begin\@gobble
\let\PT@end\empty
\let\PT@multicolumn\PT@placeinbox
\expandafter\beginpolytable\ignorespaces}
\let\endpboxed\endpolytable
\endinput
%%
%% End of file `polytable.sty'.
|