diff options
Diffstat (limited to 'Master/texmf-dist/tex/context/base/core-tbl.tex')
-rw-r--r-- | Master/texmf-dist/tex/context/base/core-tbl.tex | 206 |
1 files changed, 83 insertions, 123 deletions
diff --git a/Master/texmf-dist/tex/context/base/core-tbl.tex b/Master/texmf-dist/tex/context/base/core-tbl.tex index 902b578b937..843e9266211 100644 --- a/Master/texmf-dist/tex/context/base/core-tbl.tex +++ b/Master/texmf-dist/tex/context/base/core-tbl.tex @@ -142,43 +142,44 @@ % \NC 500 \NC \NC 20 \NC \NC 100 \NC \NR % \stoptabulate -\newtoks \tabulatepreamble -\newtoks \tabulatebefore -\newtoks \tabulateafter -\newtoks \tabulatebmath -\newtoks \tabulateemath -\newtoks \tabulatefont -\newtoks \tabulatesettings -\newtoks \tabulatedummy +\newtoks \tabulatepreamble +\newtoks \tabulatebefore +\newtoks \tabulateafter +\newtoks \tabulatebmath +\newtoks \tabulateemath +\newtoks \tabulatefont +\newtoks \tabulatesettings +\newtoks \tabulatedummy -\newcount \nofautotabulate % \newcounter \nofautotabulate -\newcount \tabulatecolumns % \newcounter \tabulatecolumns +\newcount \nofautotabulate +\newcount \tabulatecolumns +\newcount \tabulatecolumn -\newcounter \tabulateminplines -\newcounter \tabulatemaxplines +\newcount \tabulateminplines +\newcount \tabulatemaxplines -\newif \ifautotabulate -\newif \ifsplittabulate \splittabulatetrue +\newif \ifautotabulate +\newif \ifsplittabulate \splittabulatetrue -\newif \ifhandletabulatepbreak \handletabulatepbreaktrue -\newif \iftabulatenopbreak \tabulatenopbreakfalse +\newif \ifhandletabulatepbreak \handletabulatepbreaktrue +\newif \iftabulatenopbreak \tabulatenopbreakfalse -\newif \iftabulateequal -\newif \iftracetabulate -\newif \ifframedtabulate +\newif \iftabulateequal +\newif \iftracetabulate +\newif \ifframedtabulate -\newdimen \tabulatepwidth -\newdimen \tabulatewidth -\newdimen \tabulateunit -\newdimen \tabulatemaxpheight +\newdimen \tabulatepwidth +\newdimen \tabulatewidth +\newdimen \tabulateunit +\newdimen \tabulatemaxpheight -\newbox \tabulatebox +\newbox \tabulatebox % [|lg{.}|] => \NG 12.34 \NC \gdef\handletabulatecharalign#1 % space delimited ! - {\edef\alignmentclass{\tabulatecolumn}% - \edef\alignmentcharacter{\getvalue{\@@tabalign@@\tabulatecolumn}}% + {\edef\alignmentclass{\the\tabulatecolumn}% + \edef\alignmentcharacter{\getvalue{\@@tabalign@@\the\tabulatecolumn}}% \ifcase\tabulatepass\or \setfirstpasscharacteralign\checkalignment{#1}% \fi % force hsize @@ -234,74 +235,7 @@ \fi} \def\checktabulatesetups - {\getvalue{\@@tabsetups@@\tabulatecolumn}} - -% \def\dodosettabulatepreamble#1#2% -% {\ifzeropt\tabulatewidth -% \ifcase\tabulatemodus\relax -% \let\preamblebox\empty -% \else -% \def\preamblebox{\autotabulatetrue}% -% \fi -% \else -% \ifcase\tabulatemodus\relax -% \edef\preamblebox{\hbox to \the\tabulatewidth}% -% \else -% \edef\preamblebox{\hsize\the\tabulatewidth}% -% \fi -% \fi -% % -% % less bytes -% % -% %\edef\preamblebox% -% % {\ifcase\tabulatewidth -% % \ifcase\tabulatemodus\relax\else\noexpand\autotabulatetrue\fi -% % \els -% % \ifcase\tabulatemodus\relax\hbox to\else\hsize\fi\the\tabulatewidth -% % \fi}% -% % -% % 0 = NC column next EQ equal column -% % 1 = RC column raw RQ equal column raw -% % 2 = HC column hook HQ equal column hook -% % some entries can be left out if we test for them being set -% \@EA\appendtoks \@EA&\@EA\hskip\pretabskip##&\to\!!toksa -% \appendtoks \ignorespaces\to\!!toksa -% %\@EA\appendtoks\@EA\xdef\@EA\tabulatecolumn\@EA{\tabulatecolumns}\to\!!toksa -% \@EA\appendtoks\@EA\xdef\@EA\tabulatecolumn\@EA{\the\tabulatecolumns}\to\!!toksa -% \appendtoks \checktabulatesetups\to\!!toksa -% \appendtoks \checktabulatehook\to\!!toksa -% \@EA\appendtoks \preamblebox\to\!!toksa -% \appendtoks \bgroup\bbskip\bgroup#1\to\!!toksa -% \appendtoks\ifnum\tabulatetype=\plusone \else \to\!!toksa -% \@EA\appendtoks \the\tabulatebmath\to\!!toksa -% \@EA\appendtoks \the\tabulatefont\to\!!toksa -% \@EA\appendtoks \the\tabulatesettings\to\!!toksa -% \@EA\appendtoks \the\tabulatebefore\to\!!toksa -% \appendtoks\fi \to\!!toksa -% \appendtoks \bgroup\ignorespaces\to\!!toksa -% % -% \appendtoks \tabulatehook##\to\!!toksa -% % -% %%\doifdefinedelse{\@@tabalign@@\tabulatecolumns} -% %\doifdefinedelse{\@@tabalign@@\the\tabulatecolumns} -% % {\appendtoks\handletabulatecharalign## \to\!!toksa} -% % {\appendtoks\tabulatehook ##\to \!!toksa}% -% % waarom kan ik hier geen \xx{##} geven, om een of -% % andere reden passeert dan tex de hele regel (incl \NC's) -% % als argument; elke delimiter <> space gaat trouwens fout -% \appendtoks \unskip\unskip\ifmmode\else\endgraf\fi\egroup\to\!!toksa -% \appendtoks\ifnum\tabulatetype=1 \else \to\!!toksa -% \@EA\appendtoks \the\tabulateafter\to\!!toksa -% \@EA\appendtoks \the\tabulateemath\to\!!toksa -% \appendtoks\fi \to\!!toksa -% \appendtoks #2\egroup\egroup\to\!!toksa -% \@EA\appendtoks \@EA&\@EA\hskip\postabskip##\to\!!toksa -% \appendtoks\NC\to\tabulatedummy -% \let\bbskip\empty -% \def\pretabskip{.5\tabulateunit}% -% \let\postabskip\pretabskip -% \let\gettabulateexit\dogettabulateexit -% \tabulatewidth\zeropoint} + {\getvalue{\@@tabsetups@@\the\tabulatecolumn}} \let\pretabrule \donothing \let\posttabrule\donothing @@ -336,8 +270,8 @@ % some entries can be left out if we test for them being set \@EA\appendtoks \@EA&\@EA\hskip\pretabskip\pretabrule##&\to\!!toksa \appendtoks \ignorespaces\to\!!toksa - %\@EA\appendtoks\@EA\xdef\@EA\tabulatecolumn\@EA{\tabulatecolumns}\to\!!toksa - \@EA\appendtoks\@EA\xdef\@EA\tabulatecolumn\@EA{\the\tabulatecolumns}\to\!!toksa +% \@EA\appendtoks\@EA\xdef\@EA\tabulatecolumn\@EA{\the\tabulatecolumns}\to\!!toksa + \@EA\appendtoks\@EA\global\@EA\tabulatecolumn\the\tabulatecolumns\relax\to\!!toksa \appendtoks \checktabulatesetups\to\!!toksa \appendtoks \checktabulatehook\to\!!toksa \@EA\appendtoks \preamblebox\to\!!toksa @@ -526,7 +460,9 @@ \def\tabulatenotragged {\ifnum\tabulatetype=\plusone \else\notragged \fi} \def\tabulatehss {\ifnum\tabulatetype=\plusone \else\hss \fi} -\def\nexttabulate#1|% +\bgroup \catcode`\|=\@@other + +\gdef\nexttabulate#1|% {\chardef\tabulatealign\@@tabulatealign \chardef\tabulatemodus\zerocount \chardef\tabulatedimen\zerocount @@ -563,6 +499,8 @@ \fi \futurelet\next\donexttabulate} +\egroup + \def\donexttabulate {\ifx\next\relax\else \expandafter\nexttabulate @@ -580,13 +518,13 @@ \dp\tabulatebox\strutdp \box\tabulatebox} -\def\dotabulatehook {\getvalue{\@@tabhook@@ \tabulatecolumn}} -\def\dotabulatealign {\getvalue{\@@tabalign@@ \tabulatecolumn}} +\def\dotabulatehook {\getvalue{\@@tabhook@@ \the\tabulatecolumn}} +\def\dotabulatealign {\getvalue{\@@tabalign@@ \the\tabulatecolumn}} \def\resettabulatepheight - {\globallet\tabulateminplines\!!plusone + {\global\tabulateminplines\plusone \getnoflines\tabulatemaxpheight - \xdef\tabulatemaxplines{\the\noflines}% + \global\tabulatemaxplines\noflines \global\tabulatemaxpheight\zeropoint} \def\settabulatepheight @@ -604,7 +542,7 @@ \ifnum\tabulateminplines=\plusone \dotabulatenobreak \fi - \doglobal\increment\tabulateminplines + \global\advance\tabulateminplines\plusone \ifnum\tabulateminplines=\tabulatemaxplines\relax \dotabulatenobreak \fi @@ -642,10 +580,12 @@ % \starttabulate[preamble] % \starttabulate -> \starttabulate[|l|p|] -\def\definetabulate +\bgroup \catcode`\|=\@@other + +\gdef\definetabulate {\dotripleempty\dodefinetabulate} -\def\dodefinetabulate[#1][#2][#3]% +\gdef\dodefinetabulate[#1][#2][#3]% {\ifthirdargument \doifundefined{\??tt#1::\c!unit} {\copyparameters @@ -668,6 +608,8 @@ \definetabulate[#1][][|l|p|]% \fi\fi} +\egroup + \let\tabulateheadcontent\empty \let\tabulatetailcontent\empty @@ -731,7 +673,9 @@ \setvalue{\e!start\v!tabulate}% {\bgroup\dodoubleempty\donormalstarttabulate} -\def\donormalstarttabulate[#1][#2]% +\bgroup + +\gdef\donormalstarttabulate[#1][#2]% {\ifsecondargument \getparameters[\??tt\v!tabulate::][#2]% \fi @@ -742,6 +686,8 @@ \fi \next} +\egroup + % The much neede hook: \newtoks\everytabulate @@ -757,6 +703,11 @@ \def\tabulateparameter#1{\csname\??tt\currenttabulate#1\endcsname} +\bgroup + \catcode`\|=\@@other \gdef\@@otherbar{|} + \catcode`\|=\@@active \gdef\@@useotherbar{\let|\@@otherbar} +\egroup + \def\dofinalstarttabulate[#1][#2][#3]% identifier sub preamble {\edef\currenttabulate{#1::#2}% \ifinsidefloat \else @@ -807,8 +758,9 @@ {\appendtoks{##1}\to\!!toksb\do}% \def\dodododo##1% {\appendtoks##1\to\!!toksb\do}% - \globallet\tabulatecolumn\!!zerocount - \do#3\relax + \global\tabulatecolumn\zerocount +% \do#3\relax +\bgroup\@@useotherbar\expanded{\egroup\noexpand\do#3\relax}% \processcontent {\e!stop#1}% \currenttabulate} \tabulatecontent @@ -952,7 +904,13 @@ \chardef\tabulaterepeathead\zerocount -\def\processtabulate[|#1|]% in the process of optimizing +\newcount\noftabulatelines +\newcount\totalnoftabulatelines +\newcount\minusnoftabulatelines + +\bgroup \catcode`\|=\@@other + +\gdef\processtabulate[|#1|]% in the process of optimizing {\tabulateunit\tabulateparameter\c!unit \checkfulltabulatecontent \globallet\tabulateruledepth \!!zeropoint @@ -969,9 +927,9 @@ \def\postabskip{.5\tabulateunit}% \global\tabulatecolumns\zerocount \global\nofautotabulate\zerocount - \doglobal\newcounter\noftabulatelines - \let\totalnoftabulatelines\noftabulatelines - \let\minusnoftabulatelines\noftabulatelines + \global\noftabulatelines\zerocount + \totalnoftabulatelines\noftabulatelines + \minusnoftabulatelines\noftabulatelines \global\tabulatepwidth\zeropoint \global\tabulateequalfalse \resettabulatepheight @@ -1004,10 +962,10 @@ \def\HR{\doHR\zerocount} \def\HL{\doHL\zerocount} \unexpanded \def\NR % next row - {\doglobal\increment\noftabulatelines + {\global\advance\noftabulatelines\plusone \global\tabulatefirstflushedfalse \global\tabulateequalfalse - \globallet\tabulatecolumn\!!zerocount + \global\tabulatecolumn\zerocount \resettabulatepheight \unskip\unskip\crcr\flushtabulated \TABLEnoalign @@ -1036,7 +994,7 @@ \let\doHR\gobbleoneargument \let\doHL\gobbleoneargument \global\let\flushtabulated\empty - \let\savedbar|\let|\nexttabulate +% \let\savedbar|\let|\nexttabulate \tabskip\zeropoint \ifdim\tabulateparameter\c!margin>\zeropoint \!!toksa{&\flushtabulateindent\strut##% @@ -1047,7 +1005,8 @@ &##\tabskip\zeropoint}% \fi \tabulatewidth\zeropoint - |#1X|\relax + % |#1X|\relax + \nexttabulate #1X|\relax \scratchcounter\tabulatecolumns \multiply\scratchcounter3% \advance\scratchcounter4% @@ -1059,9 +1018,9 @@ % {\global\setbox\csname\@@tabbox@@\recurselevel\endcsname\box\voidb@x}}% \initializetableboxes\tabulatecolumns \appendtoks&##\to\!!toksa - \appendtoks\doglobal\increment\tabulatecolumn\to\!!toksa + \appendtoks\global\advance\tabulatecolumn\plusone\to\!!toksa \appendtoks\NC\unskip\unskip\crcr\flushtabulated\to\tabulatedummy % no count - \globallet\tabulatecolumn\!!zerocount + \global\tabulatecolumn\zerocount \resettabulatepheight \def\bskip {\setbox\tabulatebox\vbox\bgroup @@ -1075,7 +1034,7 @@ \def\xeskip {\par\egroup\egroup \global\let\tabulatehook\dotabulatehook}% - \let|\savedbar + % \let|\savedbar \global\let\tabulatehook\dotabulatehook \doifvalue{\??tt\currenttabulate\c!indenting}\v!no\forgetparindent \ifinsidefloat @@ -1134,7 +1093,7 @@ \gdef\flushtabulated {\TABLEnoalign % noalign % no interference ! {\global\let\flushtabulatedindeed\empty - \globallet\tabulatecolumn\!!zerocount + \global\tabulatecolumn\zerocount \handletabulatepbreak \dorecurse\tabulatecolumns % was: \noftabcolumns {\ifvoid\tablebox\recurselevel\else @@ -1153,10 +1112,9 @@ \def\eskip % vertical strut added august 2003 {\par\verticalstrut\vskip-\struttotal\egroup}% \fi - \let\totalnoftabulatelines\noftabulatelines - \let\minusnoftabulatelines\noftabulatelines - \decrement\minusnoftabulatelines - \doglobal\newcounter\noftabulatelines + \totalnoftabulatelines\noftabulatelines + \minusnoftabulatelines\numexpr\noftabulatelines+\minusone\relax + \global\noftabulatelines\zerocount % not satisfying % \def\doHL##1% % {\TABLEnoalign @@ -1302,6 +1260,8 @@ \fi \egroup} +\egroup + % \setuptabulate[split=yes,header=text,title=Vervolg van Tabel] % % % \starttabulatehead |