| 1 |
%% LaTeX2e file `ltxtable.sty' |
| 2 |
%% generated by the `filecontents' environment |
| 3 |
%% from source `ltxtable' on 2021/06/13. |
| 4 |
%% |
| 5 |
% |
| 6 |
%% ltxtable package (C) 1995, 2021 David Carlisle |
| 7 |
%% |
| 8 |
%% This file may be distributed under the terms of the LPPL. |
| 9 |
%% See 00readme.txt for details. |
| 10 |
% |
| 11 |
% User documentation is in the file ltxtable.tex |
| 12 |
% |
| 13 |
% \begin{macrocode} |
| 14 |
\NeedsTeXFormat{LaTeX2e} |
| 15 |
\ProvidesPackage{ltxtable} |
| 16 |
[2021/06/13 v0.4 longtable/tabularx merge (DPC)] |
| 17 |
% \end{macrocode} |
| 18 |
% |
| 19 |
% May as get these in, going to need them... |
| 20 |
% \begin{macrocode} |
| 21 |
\RequirePackage{tabularx,longtable} |
| 22 |
% \end{macrocode} |
| 23 |
% |
| 24 |
% \begin{macrocode} |
| 25 |
\def\LTXtable#1#2{% |
| 26 |
\begingroup |
| 27 |
\TX@target#1\relax |
| 28 |
\expandafter\TX@newcol\expandafter{\tabularxcolumn{\TX@col@width}}% |
| 29 |
\def\@elt##1{\global\value{##1}\the\value{##1}\relax}% |
| 30 |
\edef\TX@ckpt{\cl@@ckpt}% |
| 31 |
\let\@elt\relax |
| 32 |
\TX@old@table=\maxdimen |
| 33 |
\TX@col@width=\TX@target |
| 34 |
\global\TX@cols=\@ne |
| 35 |
\TX@typeout@ |
| 36 |
{\@spaces Table Width\@spaces Column Width\@spaces X Columns}% |
| 37 |
% \end{macrocode} |
| 38 |
% Need to modify |\TX@trial| so that |longtable| functions are |
| 39 |
% Subverted to do the measuring that |tabularx| normally does. |
| 40 |
% Also during the trial runs each `chunk' is not unboxed so it just |
| 41 |
% gets thrown away when the next chunk starts. |
| 42 |
% \begin{macrocode} |
| 43 |
\def\TX@trial##1{% |
| 44 |
\setbox\@tempboxa=\hbox{% |
| 45 |
% \end{macrocode} |
| 46 |
% |\multicolum| A sad tale, For now just stop |longtable| messing with |
| 47 |
% it, so that |tabularx| can mess with it. |
| 48 |
% \begin{macrocode} |
| 49 |
\let\LTmulticolumn\multicolumn |
| 50 |
% \end{macrocode} |
| 51 |
% |
| 52 |
% \begin{macrocode} |
| 53 |
\def\endlongtable{% |
| 54 |
\LT@echunk |
| 55 |
% from 2021 longtable uses an allocated box \LT@gbox not \box1 |
| 56 |
\global\setbox\LT@gbox\hbox{\unhbox\LT@gbox}% |
| 57 |
\kern\wd\LT@gbox |
| 58 |
\LT@get@widths% |
| 59 |
\endgroup}% |
| 60 |
% \end{macrocode} |
| 61 |
% |
| 62 |
% \begin{macrocode} |
| 63 |
\def\LT@ntabularcr{% |
| 64 |
\ifnum0=`{}\fi |
| 65 |
\LT@echunk |
| 66 |
\LT@get@widths |
| 67 |
\LT@bchunk}% |
| 68 |
% \end{macrocode} |
| 69 |
% |
| 70 |
% \begin{macrocode} |
| 71 |
\def\LT@argtabularcr[####1]{% |
| 72 |
\ifnum0=`{}\fi |
| 73 |
\ifdim ####1>\z@ |
| 74 |
\unskip\@xargarraycr{####1}\else \@yargarraycr{####1}\fi |
| 75 |
\LT@echunk |
| 76 |
\LT@get@widths |
| 77 |
\LT@bchunk}% |
| 78 |
% \end{macrocode} |
| 79 |
% |
| 80 |
% \begin{macrocode} |
| 81 |
% Any extra commands. This is used on the first run to count the number |
| 82 |
% of {\ttfamily X} columns. |
| 83 |
% \begin{macrocode} |
| 84 |
##1\relax |
| 85 |
% \end{macrocode} |
| 86 |
% Added at v1.05: dissable "\write"s during a trial run. This trick is |
| 87 |
% from the \TeX{}Book. |
| 88 |
% \begin{macrocode} |
| 89 |
\let\immediate=\relax\def\write####1####{{\afterassignment}\toks@=}% |
| 90 |
% \end{macrocode} |
| 91 |
% Turn off warnings (see appendix D). Also prevent them being turned |
| 92 |
% back on by setting the parameter names to be registers. |
| 93 |
% \begin{macrocode} |
| 94 |
\hbadness=\@M\hfuzz=\maxdimen |
| 95 |
\let\hbadness=\@tempcnta\let\hfuzz=\@tempdima |
| 96 |
% \end{macrocode} |
| 97 |
% Make the table, and finish the hbox. |
| 98 |
% Since v1.06, "\toks@" contains the preamble specification, |
| 99 |
% and possible optional argument, as well as the table body. |
| 100 |
% Well it does in |tabularx|, here the body is in an external file so |
| 101 |
% just input it. |
| 102 |
% \begin{macrocode} |
| 103 |
\input{#2}\unskip}% |
| 104 |
% \end{macrocode} |
| 105 |
% Since v1.05 reset all \LaTeX\ counters, by executing "\TX@ckpt". |
| 106 |
% \begin{macrocode} |
| 107 |
\TX@ckpt |
| 108 |
% \end{macrocode} |
| 109 |
% Print some statistics. |
| 110 |
% Added "\TX@align" in v1.05, to line up the columns. |
| 111 |
% \begin{macrocode} |
| 112 |
\TX@typeout@{\@spaces |
| 113 |
\expandafter\TX@align |
| 114 |
\the\wd\@tempboxa\space\space\space\space\space\@@ |
| 115 |
\expandafter\TX@align |
| 116 |
\the\TX@col@width\space\space\space\space\space\@@ |
| 117 |
\@spaces\the\TX@cols}}% |
| 118 |
% \end{macrocode} |
| 119 |
% \end{macro} |
| 120 |
\TX@trial{\def\NC@rewrite@X{% |
| 121 |
\global\advance\TX@cols\@ne\NC@find p{\TX@col@width}}}% |
| 122 |
\let\LT@make@row\LT@blank@row |
| 123 |
\loop |
| 124 |
\TX@arith |
| 125 |
\ifTX@ |
| 126 |
\TX@trial{}% |
| 127 |
\repeat |
| 128 |
% \end{macrocode} |
| 129 |
% On the last run, may as well run with |\setlongtables|. |
| 130 |
% \begin{macrocode} |
| 131 |
\let\LT@make@row\relax |
| 132 |
\input{#2}% |
| 133 |
\endgroup} |
| 134 |
% \end{macrocode} |
| 135 |
|
| 136 |
|