diff options
Diffstat (limited to 'Master/texmf-dist/tex/context/base/page-set.mkii')
-rw-r--r-- | Master/texmf-dist/tex/context/base/page-set.mkii | 369 |
1 files changed, 13 insertions, 356 deletions
diff --git a/Master/texmf-dist/tex/context/base/page-set.mkii b/Master/texmf-dist/tex/context/base/page-set.mkii index b8a0751795c..eb01799ae8d 100644 --- a/Master/texmf-dist/tex/context/base/page-set.mkii +++ b/Master/texmf-dist/tex/context/base/page-set.mkii @@ -545,26 +545,9 @@ %\gdef\localcolumnmaxcells{0}% here ? \global\mofcolumns\nofcolumns} % otherwise problems in finaloutput -% \def\OTRSETdofinaloutput -% {\ifdim\ht\OTRfinalpagebox=\teksthoogte -% % \bgroup \let\OTRSETsetvsize\relax % prevents useless search for gap -% \ifcase\OTRSETbalancemethod -% \finaloutput\box\OTRfinalpagebox -% \else\ifdim\OTRSETbalht>\zeropoint -% \global\setbox\OTRfinalpagebox \iftracecolumnset\ruledvbox\else\vbox\fi to \OTRSETbalht -% {\box\OTRfinalpagebox}% -% \global\dp\OTRfinalpagebox\strutdepth -% \box\OTRfinalpagebox -% \else -% \finaloutput\box\OTRfinalpagebox -% \fi \fi -% \globallet\OTRSETbalht\zeropoint -% % \egroup -% \fi} - \def\OTRSETdofinaloutput {\ifdim\ht\OTRfinalpagebox=\textheight - \bgroup % \let\OTRSETsetvsize\relax % prevents useless search for gap + \bgroup % \let\OTRSETsetvsize\relax % prevents useless search for gap \ifcase\OTRSETbalancemethod \finaloutput\box\OTRfinalpagebox \else\ifdim\OTRSETbalht>\zeropoint @@ -585,7 +568,7 @@ \finaloutput\box\OTRfinalpagebox \fi \fi \globallet\OTRSETbalht\zeropoint - \egroup + \egroup \fi} \definesystemvariable {mc} @@ -1784,66 +1767,6 @@ \def\localcolumnmaxcells{0} -% currently line represents real line, i.e. on the grid, and -% not something noflines (also, watch out for switching from -% 2-3 columns on one page with both sets balanced: the -% second set does not see the first set - -% \def\OTRSETinitbalancing -% {\ifcase\OTRSETbalancemethod\or -% \let\savedcolumnmaxcells\columnmaxcells -% \ifnum\realpageno=\balancingpageno\relax -% \ifnum\mofcolumns=\plusone -% \dorecurse\nofcolumns -% {\!!counta\recurselevel\relax -% \!!countb\getvalue{\??mc\OTRSETidentifier\number\!!counta\c!regels}\relax -% \ifcase\!!countb -% \!!countb\getvalue{\??mc\OTRSETidentifier\c!regels}\relax -% \fi -% \ifcase\!!countb -% \!!countb \savedcolumnmaxcells\relax -% \fi -% % can be an option: absolute versus relative -% \ifnum\OTRSETbalancemethod=\plusthree -% \advance\!!countb\precolumnlines -% \ifnum\!!countb>\localcolumnmaxcells\relax -% \xdef\localcolumnmaxcells{\the\!!countb}% -% \fi -% \advance\!!countb \plusone -% \dostepwiserecurse\!!countb\columnmaxcells\plusone -% {\ifvoid\OTRSETgridcell\!!counta\recurselevel -% \OTRSETsetgridcell\!!counta\recurselevel\copy\placeholderboxe -% \fi}% -% \else -% \globallet\localcolumnmaxcells\columnmaxcells -% \advance\!!countb-\columnmaxcells -% \!!countb-\!!countb -% \advance\!!countb \minusone -% \ifnum\!!countb>\zerocount -% \dostepwiserecurse\plusone\!!countb\plusone -% {\ifvoid\OTRSETgridcell\!!counta\recurselevel -% \OTRSETsetgridcell\!!counta\recurselevel\copy\placeholderboxe -% \fi}% -% \fi -% \fi}% -% \OTRSETsetvsize % ! ! ! -% \fi -% \fi -% \fi} -% -% \def\OTRSETpresetbalancing -% {\doifvaluesomething{\??mc\OTRSETidentifier\c!regels}% -% {\getcommacommandsize[\csname\??mc\OTRSETidentifier\c!regels\endcsname]% -% \ifnum\commalistsize>\plusone -% \scratchcounter\zerocount -% \def\docommand##1% -% {\advance\scratchcounter\plusone -% \setvalue{\??mc\OTRSETidentifier\the\scratchcounter\c!regels}{##1}}% -% \processcommacommand -% [\csname\??mc\OTRSETidentifier\c!regels\endcsname]\docommand -% \setvalue{\??mc\OTRSETidentifier\c!regels}{0}% -% \fi}} - % don't loose empty 1page/1column with area (example **) % % \definecolumntextarea[title][x=1,y=4,nx=2,ny=7,state=start] @@ -1859,32 +1782,6 @@ \def\setupcolumnsetarea {\setupcolumntextarea} \def\setupcolumnsetareatext{\setupcolumntextareatext} -% so this will be changed - -% \def\OTRSETnobalance -% {\iflastcolumnfootnotes % testen ! optie -% % inhibit flush of floats ! -% % todo: nothing if no footnotes, else empty page -% \dostepwiserecurse\mofcolumns\nofcolumns\plusone -% {\vskip-\struttotal\verticalstrut\vfill\eject}% -% \else -% \ifdim\pagetotal>\zeropoint % no, see example ** -% \ifnum\mofcolumns=\nofcolumns -% \OTRSETflushfinalfootnotes -% \else -% % probably todo -% \fi -% \vfill -% \eject -% % brr, may result in empty page after nicely fit text -% % or if left, then lost of first column only text -% \ifnum\mofcolumns>1 -% \OTRSETdofinalflush -% \OTRSETdofinaloutput -% \fi -% \fi -% \fi} - \def\OTRSETnobalance {\iflastcolumnfootnotes % testen ! optie % inhibit flush of floats ! @@ -2037,31 +1934,12 @@ % test: % -% \definecolumnset[two] [n=2,balance=yes] -% \definecolumnset[three][n=3,balance=yes] -% \setupcolumnset [two] [1] [lines=10] -% \setupcolumnset [two] [2] [lines=10] -% -% \startcolumnset[two] \dorecurse{14}{\input tufte \par} \stopcolumnset -% \startcolumnset[three] \dorecurse{12}{\input tufte \par} \stopcolumnset -% -% with: -% -% \installoutput\OTRSETflushpreposttext -% {%\ifvoid\normalpagebox -% % \global\setbox\precolumnbox\vbox{}% -% %\else -% \global\setbox\precolumnbox\vbox -% {\unvcopy\normalpagebox}% -% \global\setbox\precolumnbox\vbox to \ht\precolumnbox -% {\box\normalpagebox}% -% %\fi -% \global\dp\precolumnbox\strutdepth -% \ifcarryoverfootnotes \else -% \global\setbox\postcolumnbox\vbox{\placebottomnotes}% -% \fi} - -% testcase : pascal demo-bbi, paragraaf/aanduiding koppen +% \setupcolumnset [test-1] [balance=yes] +% \setupcolumnset [test-2] [balance=yes] +% \setupcolumnsetlines[test-1][1][1] [8] +% \setupcolumnsetlines[test-1][1][2][10] +% \startcolumnset [test-1] \dorecurse {1}{\input tufte \par} \stopcolumnset +% \startcolumnset [test-2] \dorecurse {2}{\input ward \par} \stopcolumnset \ifx\lastskipinotr\undefined \newskip\lastskipinotr \fi @@ -2081,30 +1959,6 @@ \let\precolumnlines \!!zerocount \let\postcolumnlines\!!zerocount -% \def\OTRSEThandlepreposttext -% {\ifdim\ht\precolumnbox>\zeropoint % new -% \getnoflines{\ht\precolumnbox}% -% \edef\precolumnlines{\the\noflines}% -% \doOTRSETsetgridcells -% {\copy\placeholderboxe} -% \plusone\plusone\nofcolumns\noflines -% {\box\precolumnbox}% -% \else -% \let\precolumnlines\!!zerocount -% \fi -% \ifdim\ht\postcolumnbox>\zeropoint % new, otherwise empty bottom line -% \getnoflines{\ht\postcolumnbox}% -% \edef\postcolumnlines{\the\noflines}% -% \advance\columnfreecells -\noflines -% \advance\columnfreecells \plusone -% \doOTRSETsetgridcells -% {\copy\placeholderboxe} -% \plusone\columnfreecells\nofcolumns\noflines -% {\box\postcolumnbox}% -% \else -% \let\postcolumnlines\!!zerocount -% \fi} - \def\OTRSEThandlepreposttext {\ifdim\ht\precolumnbox>\zeropoint % new \getnoflines{\ht\precolumnbox}% @@ -2423,6 +2277,7 @@ \v!right=>\doglobal\addtocommalist{#1}\columnrightareas]% \getparameters[\??mt#1#2] [\c!x=1,\c!y=1,\c!nx=1,\c!ny=1,\c!clipoffset=2\lineheight, + \c!leftoffset=\zeropoint,\c!rightoffset=\zeropoint, \c!offset=\v!overlay,\c!strut=\v!no,\c!frame=\v!off, \c!type=#2,\c!page=1,\c!state=\v!stop,#3]}}% \else @@ -2573,7 +2428,8 @@ %\c!bottomoffset=\columntextareaparameter\c!clipoffset,% %\c!leftoffset=\columntextareaparameter\c!clipoffset,% \c!offset=\columntextareaparameter\c!clipoffset,% - \c!rightoffset=\zeropoint,% + \c!offset=\columntextareaparameter\c!clipoffset,% + \c!rightoffset=\columntextareaparameter\c!rightoffset,% \c!width=\!!widthb,% \c!height=\!!heighta]% {\copy\scratchbox}% @@ -2590,7 +2446,8 @@ %\c!bottomoffset=\columntextareaparameter\c!clipoffset,% %\c!rightoffset=\columntextareaparameter\c!clipoffset,% \c!offset=\columntextareaparameter\c!clipoffset,% - \c!leftoffset=\zeropoint,% + \c!offset=\columntextareaparameter\c!clipoffset,% + \c!leftoffset=\columntextareaparameter\c!leftoffset,% \c!width=\!!widtha,% \c!height=\!!heighta,% \c!hoffset=\!!widthb]% @@ -2798,206 +2655,6 @@ % \startcolumnsetspan[two] \input tufte \stopcolumnsetspan % \stopcolumnset -% We need to set the \dimen globally since we are in the -% OTR. Unfortunately this interferes with local settings, -% although we may assume that they will not cross page -% boundaries. - -\def\OTRSETcheckcontent - {\bgroup - \donefalse - \def\OTRSETcheckcontent##1% - {\setbox\scratchbox##1\recurselevel - \setbox\scratchbox\vbox{\unvbox\scratchbox}% - \ifdim\ht\scratchbox>\zeropoint\donetrue\fi}% - \dorecurse{\nofcolumns} - {\OTRSETcheckcontent\columngettextbox - \OTRSETcheckcontent\columngetfootbox - \OTRSETcheckcontent\columngettopbox - \OTRSETcheckcontent\columngetbotbox}% - \ifdone\egroup\donefalse\else\egroup\donetrue\fi} - -\def\OTRSETgetcolumntextheight#1% max - boven - top - {\scratchdimen=\OTRSETgetparameter\c!maxhoogte#1% - \advance\scratchdimen -\OTRSETgetparameter\c!bovenoffset#1% - \advance\scratchdimen -\ht\columntopbox#1% - \advance\scratchdimen -\getvalue{\??mc\number\mofcolumns-f}% - \advance\scratchdimen -\ht\columnbotbox#1} % not used - -\def\OTRSETgetcolumnnaturalheight#1% max - boven - top - {\setbox\scratchbox\vbox{\unvcopy\columntextbox#1}% - \scratchdimen\ht\scratchbox - \advance\scratchdimen \OTRSETgetparameter\c!bovenoffset#1% - \advance\scratchdimen \ht\columntopbox#1% - \advance\scratchdimen -\getvalue{\??mc\number\mofcolumns-f}% - \advance\scratchdimen \ht\columnbotbox#1} % not used - -\def\OTRSETdobalance% splitten in met en zonder footnotes - {\bgroup - \maxdeadcycles=1000 - % collect content and notes - \bgroup - \OTRSEToutput - {\global\setbox1\vbox{\unvbox\normalpagebox}% - \global\setbox3\vbox{\unvbox\footins}}% - \verticalstrut\vskip-\struttotal % makes footnotes flush - \eject - \global\collectingcontentfalse - % check for footnotes only - \ifdim\ht1<\topskip % real dirty - \global\setbox1=\vbox{} - % fix height of first line - \ifdim\ht3>\!!zeropoint - \global\setbox3\vbox - {\setfootnotebodyfont - \kern-\strutht - \kern\topskip - \unvbox3} - \fi - % prepare trial box - \global\setbox5\vbox - {\ifdim\ht1>\zeropoint - \unvcopy1 \ifdim\ht3>\zeropoint \kern\skip\footins \fi - \fi - \ifdim\ht3>\zeropoint \unvcopy3 \fi} - \egroup - % erase old stuff - \columnerasetextboxes - \columnerasefootboxes - % prepare floats - \OTRSETdotopinsertions - \OTRSETdobotinsertions % not used can be removed - % calculate available space - \!!heighta\zeropoint % available total height - \dorecurse{\nofcolumns} - {\OTRSETgetcolumntextheight\recurselevel - \OTRSETcalculatelines\scratchdimen - \advance\!!heighta \scratchdimen} - % quick check - \ifdim\ht5>\!!heighta - % use normal routine - \columnerasetextboxes - \columnerasefootboxes - % TEMP, TODO, FORCE NEXT PASS ! - \unvbox1 - \unvbox3 - \doglobal\addtocommalist{-\realfolio}\OTRSETbalancinglist - \donefalse - %\writestatus\m!columns{no balancing, text overflows height}% - \else\ifdim\ht5>\zeropoint \relax - % some text and/or notes - \donetrue - \else - \donefalse - \dorecurse\nofcolumns - {\ifdim\ht\columntopbox\recurselevel>\zeropoint \donetrue \fi}% - \ifdone - % no text and notes, but figures - \else - % no text, no notes, no figures - \doglobal\addtocommalist{-\realfolio}\OTRSETbalancinglist - \writestatus\m!columns{no balancing, nothing to be placed}% - \fi - \fi\fi - \ifdone - \ifdim\ht5>\zeropoint \relax - % balancing text and notes - %\writestatus\m!columns{text may fit, balancing}% - \newcounter\loopcounter - \newcounter\balancinglines - \doloop - {\increment\loopcounter\relax - % initialize - \columnerasetextboxes - \columnerasefootboxes - \setbox0=\copy5 - \splittopskip\topskip - % pre-split loop and quality calculation - %\writestatus\m!columns{pass \loopcounter: correction -\balancinglines} - \dorecurse\nofcolumns - {\OTRSETgetcolumntextheight\recurselevel - \OTRSETcalculatelines\scratchdimen - \!!heightc\scratchdimen - \ifnum\recurselevel<\nofcolumns - \advance\!!heightc -\balancinglines\lineheight - \fi - \columnsettextbox\recurselevel\vsplit0 to \!!heightc} - % just one method - \OTRSETgetcolumnnaturalheight1 \dimen4\scratchdimen - \OTRSETgetcolumnnaturalheight\nofcolumns \dimen6\scratchdimen - %\writestatus\m!columns{first column: \the\dimen4}% - %\writestatus\m!columns{last column: \the\dimen6}% - \ifdim\dimen4=\dimen6 - \donetrue % perfect balance - \else\ifdim\dimen4>\dimen6 - \donefalse % not yet good enough - \increment\balancinglines % try again - \edef\balancingcount{\the\!!counta} - \else - \donetrue % worse balance - \ifnum\balancinglines>0 % take previous - \decrement\balancinglines - \fi - \fi\fi - % extra check - % \ifdim\ht0>\zeropoint\relax \donefalse \fi - % another check - \ifdone - %\writestatus\m!columns{balancing finished in pass \loopcounter}% - \else \ifnum\loopcounter>100 \donetrue - %\writestatus\m!columns{balancing aborted after pass \loopcounter}% - \else - %\writestatus\m!columns{balancing continued after pass \loopcounter}% - \fi \fi - % final balancing pass - \ifdone - \setbox0\copy1 - \setbox2\copy3 - \columnerasetextboxes - \columnerasefootboxes - \dorecurse\nofcolumns - {\OTRSETgetcolumntextheight\recurselevel - \OTRSETcalculatelines\scratchdimen - \!!heightc\scratchdimen - \ifnum\recurselevel<\nofcolumns - \advance\!!heightc -\balancinglines\lineheight - \fi - % split off text - \ifdim\ht0>\zeropoint - \columnsettextbox\recurselevel\vsplit0 to \!!heightc - \setbox4\vbox{\unvcopy\columntextbox\recurselevel} - \advance\!!heightc -\ht4 - \ifdim\ht0>\zeropoint - \columnsettextbox\recurselevel\box4 - \advance\!!heightc \skip\footins - \fi - \fi - % split off footnotes - \ifdim\ht0>\zeropoint\relax \else - \ifdim\ht2>\zeropoint\relax - \setbox4\vsplit2 to \!!heightc - \setbox\footins=\vbox{\unvbox4} % ugly and dirty trick - \ifdim\ht\columntextbox\recurselevel=\zeropoint\relax - \columnsettextbox\recurselevel\hbox - {\raise\strutdp\hbox % ugly but needed - {\setfootnotebodyfont % both these moves - \lower\strutdp\hbox{\placebottomnotes}}} - \else - \columnsetfootbox\recurselevel\hbox{\placebottomnotes} - \fi - \fi - \fi} - \exitloop - \fi} - \else - % no reason to balance floats - \fi - \fi - \doglobal\addtocommalist{\realfolio}\OTRSETbalancinglist - \OTRSETdoflush - \fi - \egroup} - \protect \endinput % extreme examples (1) |