summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/page-mul.mkiv
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/context/base/page-mul.mkiv')
-rw-r--r--Master/texmf-dist/tex/context/base/page-mul.mkiv110
1 files changed, 61 insertions, 49 deletions
diff --git a/Master/texmf-dist/tex/context/base/page-mul.mkiv b/Master/texmf-dist/tex/context/base/page-mul.mkiv
index 88ec7a5e7be..581ba5a598a 100644
--- a/Master/texmf-dist/tex/context/base/page-mul.mkiv
+++ b/Master/texmf-dist/tex/context/base/page-mul.mkiv
@@ -358,8 +358,7 @@
\newdimen\mcscratchdimen
\newcount\nofcolumnlines
-\chardef\multicolumnlinemethod\zerocount % 0: overshoot (old default), 1: tight
-% \chardef\multicolumnlinemethod\plusone
+\newconstant\multicolumnlinemethod % 0: overshoot (old default), 1: tight
\def\getmulticolumnlines
{\mcscratchdimen-\columntextoffset
@@ -443,12 +442,14 @@
\vskip-\struttotal
\fi
\global\savedpagetotal\pagetotal
- \global\singlecolumnout\output
+ \global\singlecolumnout\output % hm
%\global\output{\global\setbox\precolumnbox\vbox{\unvbox\normalpagebox}}%
- \global\output{\global\setbox\precolumnbox\vbox{\dotopinsertions\unvbox\normalpagebox}}%
+ %\global\output{\global\setbox\precolumnbox\vbox{\dotopinsertions\unvbox\normalpagebox}}%
+ \setoutputroutine{\global\setbox\precolumnbox\vbox{\dotopinsertions\unvbox\normalpagebox}}%
\eject % no \holdinginserts=1, can make footnote disappear !
\global\precolumnboxheight\ht\precolumnbox
- \global\output{\continuousmulticolumnsout}%
+ %\global\output{\continuousmulticolumnsout}%
+ \setoutputroutine{\continuousmulticolumnsout}%
\setcolumnfloats
\dohandleallcolumns
{\global\setbox\currenttopcolumnbox\emptybox}%
@@ -475,7 +476,7 @@
%D e.g. when there is no text given between \type{\begin..}
%D and \type{\end..}. The \type{\par} is needed!
-\chardef\multicolumnendsyncmethod\plusone % 1: old sync 2: new sync (cont-loc/project) / may fail ! ! ! !
+\setnewconstant\multicolumnendsyncmethod\plusone % 1: old sync 2: new sync (cont-loc/project) / may fail ! ! ! !
\def\endmulticolumns
{%\par
@@ -493,17 +494,21 @@
\par
\ifbalancecolumns
\ifnum\multicolumnendsyncmethod=\plusone
- \global\output{\continuousmulticolumnsout}%
+ %\global\output{\continuousmulticolumnsout}%
+ \setoutputroutine{\continuousmulticolumnsout}%
\goodbreak
\fi
- \global\output{\balancedmulticolumnsout}%
+ %\global\output{\balancedmulticolumnsout}%
+ \setoutputroutine{\balancedmulticolumnsout}%
\else
\goodbreak
\fi
\eject % the prevdepth is important, try e.g. toclist in
\prevdepth\zeropoint % columns before some noncolumned text text
- \global\output\singlecolumnout
- \global\output{\the\mainoutput}% % % % % todo
+ %\global\output\singlecolumnout
+ \setoutputroutine{\singlecolumnout}%
+ %\global\output{\the\mainoutput}% % % % % todo
+ \setoutputroutine{\the\mainoutput}% % % % % todo
\ifvoid\precolumnbox\else
\unvbox\precolumnbox
\fi
@@ -569,8 +574,8 @@
\edef\maxcolumndepth{\the\dp\currentcolumnbox}%
\fi}}
-\chardef\multicolumntopflushmethod\plusone % 0: no correction, 1: correction when topstuff, 2: correction, 3: correction++
-\chardef\multicolumntopalignmethod\plustwo % 0: nothing, 1: force grid, 2: follow grid
+\setnewconstant\multicolumntopflushmethod\plusone % 0: no correction, 1: correction when topstuff, 2: correction, 3: correction++
+\setnewconstant\multicolumntopalignmethod\plustwo % 0: nothing, 1: force grid, 2: follow grid
\def\flushprecolumnboxnogrid
{\unvbox\precolumnbox}
@@ -599,6 +604,8 @@
\setmaxcolumndimensions
\dohandleallcolumns
{\mkprocesscolumncontents\currentcolumnbox}%
+ \dohandleallcolumns
+ {\docolumnpagebodymarks\plusone\nofcolumns\mofcolumns\currentcolumnbox}%
\postprocesscolumns
\dohandleallcolumns % \hbox i.v.m. \showcomposition
{\global\setbox\currentcolumnbox\hbox to \localcolumnwidth
@@ -1022,30 +1029,27 @@
\dontshowcomposition
\widowpenalty\zerocount
\setbox0\vbox{\unvbox\normalpagebox}%
-\ifdim\ht0>\openlineheight % at least one line
- \ifnum\minbalancetoplines<2 % balance anyway
- \donetrue
- \else % check criterium to available lines
- \getnoflines{\ht0}%
- \divide\noflines \nofcolumns \relax
- \ifnum\noflines<\minbalancetoplines \relax
- \dimen0\ht0
- \advance\dimen0 \ht\firsttopcolumnbox
- \advance\dimen0 \openlineheight \relax % let's play safe
- \ifdim\dimen0>\columntextheight % column exceeding text height
- \donetrue
- \else % it seems to fit
- \donefalse
- \fi
- \else % balance indeed
- \donetrue
- \fi
+ \ifdim\ht0>\openlineheight % at least one line
+ \ifnum\minbalancetoplines<2 % balance anyway
+ \donetrue
+ \else % check criterium to available lines
+ \getnoflines{\ht0}%
+ \divide\noflines \nofcolumns \relax
+ \ifnum\noflines<\minbalancetoplines \relax
+ % let's play safe
+ \ifdim\dimexpr\ht0+\ht\firsttopcolumnbox+\openlineheight\relax>\columntextheight
+ \donetrue % column exceeding text height
+ \else
+ \donefalse % it seems to fit
+ \fi
+ \else % balance indeed
+ \donetrue
+ \fi
+ \fi
+ \else % balancing does not make sense
+ \donefalse
\fi
-\else % balancing does not make sense
- \donefalse
-\fi
-\ifdone % start balancing
- %\ifdim\ht0>\openlineheight
+ \ifdone % start balancing, was: \ifdim\ht0>\openlineheight
\dimen0\ht0
\advance\dimen0 \topskip
\advance\dimen0 -\baselineskip
@@ -1160,18 +1164,19 @@
\showmessage\m!columns{10}\empty
\global\setbox\firstcolumnbox\vbox{\unvbox0}%
\fi
- \global\output{\balancingerror}%
+ %\global\output{\balancingerror}%
+ \setoutputroutine{\balancingerror}%
\b@selinebottomtrue % forces depth in separation rule
\flushcolumnedpage\plusone
\multicolumnseject
\egroup}
\def\multicolumnseject
- {\ifdim\pagetotal>\textheight
- \eject % new
- \else
+ {%\ifdim\pagetotal>\textheight
+ % \eject % new, but wrong as fails on mixed-001.tex (wrong pagetotal at this point)
+ %\else
\allowbreak
- \fi}
+ }%\fi}
%D The multicolumn mechanism is incorporated in a \CONTEXT\
%D interface, which acts like:
@@ -1251,9 +1256,17 @@
\def\OTRMULdotopinsertions {\ifconditional\onlylocalcolumnfloats\relax \else\OTRONEdotopinsertions \fi}
\def\OTRMULdoflushfloats {\ifconditional\onlylocalcolumnfloats\doflushcolumnfloats\else\OTRONEdoflushfloats \fi}
+\newtoks\everylocalcolumnfloatspar
+
+\everylocalcolumnfloatspar
+ {\flushnotes
+ \flushcolumnfloat
+ % \flushmargincontents
+ \checkindentation}
+
\def\setlocalcolumnfloats
{\settrue\onlylocalcolumnfloats
- \everypar{\flushnotes\flushcolumnfloat\flushmargincontents\checkindentation}%
+ \everypar\everylocalcolumnfloatspar
\let\flushcolumnfloat\doflushcolumnfloat
\let\flushcolumnfloats\doflushcolumnfloats}
@@ -1326,7 +1339,7 @@
\else
\bgroup
\getcolumnstatus\column\count255\total\dimen0\goal\dimen2\\%
- \dofloatsgetinfo{text}%
+ \dofloatsgetinfo\s!text
\setbox\scratchbox\vbox % tricky met objecten ?
{\blank[\@@bkspacebefore]
\snaptogrid\vbox{\vskip\floatheight}}% copy?
@@ -1356,7 +1369,7 @@
\let\doflushcolumnfloat\relax
\getcolumnstatus\column\mofcolumns\total\dimen0\goal\dimen2\\%
\ifdim\dimen0>\zeropoint
- \dofloatsgetinfo{text}%
+ \dofloatsgetinfo\s!text
\ifdim\floatwidth>\hsize
% dropped ?
\else
@@ -1368,7 +1381,7 @@
\ifnum\mofcolumns<\nofcolumns
\advance\mofcolumns \plusone
\ifdim\ht\currenttopcolumnbox=\zeropoint
- \dofloatsflush{text}{1}%
+ \dofloatsflush\s!text{1}%
\global\setbox\currenttopcolumnbox\vbox
{\snaptogrid\vbox{\box\floatbox}
\whitespace % nodig ?
@@ -1392,7 +1405,7 @@
\blank[\@@bkspacebefore]
\nobreak
\fi
- \dofloatsflush{text}{1}%
+ \dofloatsflush\s!text{1}%
\flushfloatbox
\blank[\@@bkspaceafter]
\fi
@@ -1415,7 +1428,6 @@
%D When handling lots of (small) floats spacing can get worse
%D because of lining out the columns.
-
\def\doflushcolumnfloats
{\ifpostponecolumnfloats\else
\bgroup
@@ -1434,7 +1446,7 @@
\whitespace % nodig ?
\blank[\@@bkspaceafter]}%
\else
- \dofloatsgetinfo{text}%
+ \dofloatsgetinfo\s!text
\ifdim\floatwidth>\hsize
\dimen0\dimexpr\floatwidth+\intercolumnwidth+.5pt\relax
\dimen2\dimexpr\hsize +\intercolumnwidth+.5pt\relax
@@ -1445,7 +1457,7 @@
\count0\zerocount
\else
\dimen0\dimexpr\count0\hsize+\count0\intercolumnwidth-\intercolumnwidth\relax
- \dofloatsflush{text}{1}%
+ \dofloatsflush\s!text{1}%
\ifdim\floatwidth>\finalcolumntextwidth % better somewhere else too
\global\setbox\floatbox\hbox to \finalcolumntextwidth{\hss\box\floatbox\hss}%
\fi % otherwise the graphic may disappear
@@ -1458,7 +1470,7 @@
\fi
\showmessage\m!columns{13}\empty
\else
- \dofloatsflush{text}{1}%
+ \dofloatsflush\s!text{1}%
\ifdim\floatwidth>\finalcolumntextwidth % better somewhere else too
\global\setbox\floatbox\hbox to \finalcolumntextwidth{\hss\box\floatbox\hss}%
\fi % otherwise the graphic may disappear