diff options
Diffstat (limited to 'Master/texmf-dist/tex/context/base/tabl-tbl.mkiv')
-rw-r--r-- | Master/texmf-dist/tex/context/base/tabl-tbl.mkiv | 108 |
1 files changed, 72 insertions, 36 deletions
diff --git a/Master/texmf-dist/tex/context/base/tabl-tbl.mkiv b/Master/texmf-dist/tex/context/base/tabl-tbl.mkiv index bfff978ab70..400d8a659de 100644 --- a/Master/texmf-dist/tex/context/base/tabl-tbl.mkiv +++ b/Master/texmf-dist/tex/context/base/tabl-tbl.mkiv @@ -15,6 +15,8 @@ % \processbetween gebruiken in head/tail macros +% todo: \aligntab \alignmark (after 0.60 is out) + \unprotect %D I can probably reimplement this using a \LUA||\TEX\ combination @@ -173,6 +175,7 @@ \newif \ifframedtabulate \newdimen \tabulatepwidth +\newdimen \tabulatexwidth \newdimen \tabulatewidth \newdimen \tabulateunit \newdimen \tabulatemaxpheight @@ -316,6 +319,13 @@ \unexpanded\def\beforetabulateentry{\ignorespaces\tabulatehook} \unexpanded\def\aftertabulateentry {\unskip\unskip\ifmmode\else\endgraf\fi} +\unexpanded\def\beginreshapedtabulatepar + {\dowithnextbox + {\ctxlua{commands.doreshapeframedbox(\number\nextbox)}\ifvmode\unvbox\else\box\fi\nextbox} + \vbox\bgroup} + +\let\endreshapedtabulatepar\egroup + \def\dodosettabulatepreamble#1#2% only makes sense for many tabulates {\normalexpanded{\!!toksa{\the\!!toksa &\hskip\pretabskip\noexpand\pretabrule##&% @@ -328,7 +338,7 @@ \noexpand\autotabulatetrue \fi \else - \ifnum\tabulatemodus=\zeropoint + \ifnum\tabulatemodus=\zerocount \hbox to \else \hsize @@ -339,8 +349,11 @@ \noexpand\bbskip \bgroup % we cannot combine the if because a cell may have only one ## \noexpand#1% + \ifcase\tabulatereshape\else + \beginreshapedtabulatepar + \fi \noexpand\ifnum\noexpand\tabulatetype=\plusone\noexpand\else - \the\tabulatebmath + \the\tabulatebmath % maybe later? \the\tabulatefont \the\tabulatesettings \the\tabulatebefore @@ -356,6 +369,9 @@ \the\tabulateafter \the\tabulateemath \noexpand\fi + \ifcase\tabulatereshape\else + \endreshapedtabulatepar + \fi \noexpand#2% \egroup \egroup @@ -410,8 +426,8 @@ \def\gettabulatepreskip#1% {\doifnumberelse{#1} - {\edef\pretabskip{\the\dimenexpr#1\tabulateunit}\let\next\empty} - {\edef\pretabskip{\the\dimenexpr.5\tabulateunit}\def\next{#1}}% + {\edef\pretabskip{\the\dimexpr#1\tabulateunit}\let\next\empty} + {\edef\pretabskip{\the\dimexpr.5\tabulateunit}\def\next{#1}}% \@EA\settabulatepreamble\next} \def\gettabulateposskip#1% @@ -423,8 +439,8 @@ \def\gettabulatepreposskip#1% {\doifnumberelse{#1} - {\edef\pretabskip{\the\dimenexpr#1\tabulateunit}\let\next\empty} - {\edef\pretabskip{\the\dimenexpr.5\tabulateunit}\def\next{#1}}% + {\edef\pretabskip{\the\dimexpr#1\tabulateunit}\let\next\empty} + {\edef\pretabskip{\the\dimexpr.5\tabulateunit}\def\next{#1}}% \let\postabskip\pretabskip \let\gettabulateexit\settabulatepreamble \@EA\settabulatepreamble\next} @@ -483,6 +499,8 @@ [ \v!fit=>\let\tabulatemodus\plusthree, \v!fixed=>\let\tabulatemodus\plusthree \tabulatenopbreaktrue, + \v!auto=>\let\tabulatemodus\plusthree + \let\tabulatereshape\plusone, \s!unknown=>\tabulatewidth#1\relax]% \ifnum\tabulatedimen=\plusone \global\advance\tabulatepwidth\tabulatewidth @@ -533,11 +551,12 @@ {\let\tabulatealign\@@tabulatealign \let\tabulatemodus\zerocount \let\tabulatedimen\zerocount - \tabulatebefore \emptytoks - \tabulateafter \emptytoks - \tabulatebmath \emptytoks - \tabulateemath \emptytoks - \tabulatefont \emptytoks + \let\tabulatereshape\zerocount + \tabulatebefore\emptytoks + \tabulateafter\emptytoks + \tabulatebmath\emptytoks + \tabulateemath\emptytoks + \tabulatefont\emptytoks \tabulatesettings\emptytoks \global\advance\tabulatecolumns\plusone \expandafter\let\csname\??tt:s:\the\tabulatecolumns\endcsname\donothing @@ -947,7 +966,7 @@ %D When set to true, no (less) break optimization is done. -\newif\iftolerantTABLEbreak +\newif\iftolerantTABLEbreak % used in styles ! %D The main processing macro is large but splitting it up %D would make things less clear. @@ -1017,7 +1036,7 @@ \def\tabulatexeskipone{\par\egroup\egroup\glet\tabulatehook\dotabulatehook} \def\tabulatebaselinecorrection - {\def\dobaselinecorrection + {\def\dobaselinecorrection % todo: mkiv {\vskip-\prevdepth \vskip\strutdp \vskip\strutdp}% @@ -1042,26 +1061,31 @@ \global\tabulatecolumn\zerocount \resettabulatepheight \unskip\unskip\crcr\flushtabulated - \TABLEnoalign - {\the\everyaftertabulaterow}% - \TABLEnoalign - {\iftolerantTABLEbreak\else - \ifconditional\tabulatesomeamble \ifcase\tabulaterepeathead \else - \allowbreak - \fi \fi - \ifnum\noftabulatelines=\plusone - \dotabulatenobreak - \else\ifnum\noftabulatelines=\minusnoftabulatelines - \ifnum\tabulatemaxplines<\plustwo - \dotabulatenobreak - \else - \allowbreak % needed with pbreak prevention - \fi - \else - \allowbreak % needed with pbreak prevention - \fi\fi - \fi - \global\tabulatefirstflushedfalse}} + \TABLEnoalign{\the\everyaftertabulaterow}% + \TABLEnoalign{\checktabulatepenaltiesa}} + +\def\checktabulatepenaltiesa + {\iftolerantTABLEbreak\else + \ifnum\totalnoftabulatelines=\plusone + % \allowbreak + \else + \ifconditional\tabulatesomeamble \ifcase\tabulaterepeathead \else + \allowbreak + \fi \fi + \ifnum\noftabulatelines=\plusone + \dotabulatenobreak + \else\ifnum\noftabulatelines=\minusnoftabulatelines + \ifnum\tabulatemaxplines<\plustwo + \dotabulatenobreak + \else + \allowbreak % needed with pbreak prevention + \fi + \else + \allowbreak % needed with pbreak prevention + \fi\fi + \fi + \fi + \global\tabulatefirstflushedfalse} \def\tabulatebbskiptwo {\ifvoid\tablebox\tabulatecolumn @@ -1175,12 +1199,23 @@ \prevdepth\strutdp \dotabulatenobreak}} +% see *** +% +% \enabletrackers[nodes.page_vspacing] +% \starttext +% \starttabulate[||] \dorecurse{100}{\NC Eins \NC \NR \HL} \stoptabulate +% \stoptext + \def\tabulateMLfive{\TABLEnoalign {\dotabulateruleseperator \dotabulaterule \ifnum\noftabulatelines>\plusone \ifnum\noftabulatelines<\minusnoftabulatelines - \vskip\topskip\allowbreak\vskip-\topskip + % *** somehow topskip messes up as it's intercepted + % \vskip \topskip\allowbreak\vskip- \topskip + % messy anyhow so this needs to be improved, so for + % the momenet we keep this bugged variant + \vskip1\topskip\allowbreak\vskip-1\topskip \vskip-\tabulateparameter\c!rulethickness \dotabulaterule \fi @@ -1223,6 +1258,7 @@ \totalnoftabulatelines\noftabulatelines \minusnoftabulatelines\noftabulatelines \global\tabulatepwidth\zeropoint + \global\tabulatexwidth\zeropoint \global\tabulateequalfalse \resettabulatepheight \ifinsidesplitfloat @@ -1291,7 +1327,7 @@ \ifnum\nofautotabulate>\zerocount % so, even if the natural size is larger, in the final % run, we force the calculated width - \tabulatewidth\dimexpr\hsize-\wd0-\tabulatepwidth\relax + \tabulatewidth\dimexpr\hsize-\wd0-\tabulatepwidth-\tabulatexwidth\relax \ifnum\nofautotabulate>\zerocount \divide\tabulatewidth \nofautotabulate\relax \fi @@ -1446,7 +1482,7 @@ % \NC \digits $@@@.@@1,@@$ \NC\NR % \stoptabulatie -\def\setuptabulate +\unexpanded\def\setuptabulate {\dotripleempty\dosetuptabulate} \def\dosetuptabulate[#1][#2][#3]% |