diff options
Diffstat (limited to 'Master/texmf-dist/tex/context/base/page-mul.mkiv')
-rw-r--r-- | Master/texmf-dist/tex/context/base/page-mul.mkiv | 1045 |
1 files changed, 479 insertions, 566 deletions
diff --git a/Master/texmf-dist/tex/context/base/page-mul.mkiv b/Master/texmf-dist/tex/context/base/page-mul.mkiv index 581ba5a598a..3792f06ee25 100644 --- a/Master/texmf-dist/tex/context/base/page-mul.mkiv +++ b/Master/texmf-dist/tex/context/base/page-mul.mkiv @@ -5,12 +5,16 @@ %D subtitle=Multi Column Output, %D author=Hans Hagen, %D date=\currentdate, -%D copyright={PRAGMA / Hans Hagen \& Ton Otten}] +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] %C %C This module is part of the \CONTEXT\ macro||package and is %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. +% SEE PAGE-MUL-NEW.MKIV + +% BEWARE: TEMPORARY ISSUES WITH VSIZE AND HSIZE BUT WILL BE REDONE + \writestatus{loading}{ConTeXt Page Macros / Simple Multi Column} %D This module is mostly a copy from the original multi column @@ -22,163 +26,57 @@ \unprotect -% TO DO ! +\unexpanded\def\page_mul_command_side_float_output + {\page_otr_construct_and_shipout\unvbox\normalpagebox} -\let\OTRMULsetvsize \OTRONEsetvsize -\let\OTRMULsethsize \OTRONEsethsize -\let\OTRMULdopagecontents \OTRONEdopagecontents -\let\OTRMULfinalsidefloatoutput\OTRONEfinalsidefloatoutput % ??? -\let\OTRMULflushfloatbox \OTRONEflushfloatbox +\unexpanded\def\page_mul_command_flush_side_floats + {\page_sides_forget_floats} -\let\OTRMULdosettopinserts \relax -\let\OTRMULdosetbotinserts \relax -\let\OTRMULdotopinsertions \relax -\let\OTRMULdobotinsertions \relax -\let\OTRMULdosetbothinserts \relax -\let\OTRMULflushsavedfloats \relax +\unexpanded\def\page_mul_command_synchronize_side_floats + {\page_sides_forget_floats} -\let\OTRMULflushsidefloats \forgetsidefloats % \relax -\let\OTRMULsynchronizesidefloats\forgetsidefloats % \relax +\unexpanded\def\page_mul_command_next_page + {\page_otr_eject_page} -\newtoks \OTRMULoutput +\unexpanded\def\page_mul_command_next_page_and_inserts + {\page_otr_eject_page_and_flush_inserts} -\def\OTRMULgotonextpage - {\ejectpage} - -\def\OTRMULgotonextpageX % will become obsolete - {\superejectpage} - % check \count<insert> multiplications -% some day try this in balancing routine -% -% \ifdim\pagetotal>\pagegoal -% \eject -% \else -% \goodbreak -% \fi - -%D The following macro's implement a multi||column output -%D routine. The original implementation was based on Donald -%D Knuth's implementation, which was adapted by Craig Platt to -%D support balancing of the last page. I gradually adapted -%D Platt's version to our needs but under certain -%D circumstances things still went wrong. I considered all -%D calls to Platt's \type{\balancingerror} as undesirable. - -%D This completely new implementation can handle enough -%D situations for everyday documents, but is still far from -%D perfect. While at the moment the routine doesn't support -%D all kind of floats, it does support: +%D The following macro's implement a multi||column output routine. The original +%D implementation was based on Donald Knuth's implementation, which was adapted by +%D Craig Platt to support balancing of the last page. I gradually adapted Platt's +%D version to our needs but under certain circumstances things still went wrong. I +%D considered all calls to Platt's \type{\balancingerror} as undesirable. +%D +%D This completely new implementation can handle enough situations for everyday +%D documents, but is still far from perfect. While at the moment the routine doesn't +%D support all kind of floats, it does support: %D %D \startitemize[packed] %D \item an unlimitted number of columns %D \item ragged or not ragged bottoms %D \item optional balancing without \type{\balancingerrors} -%D \item different \type{\baselineskips}, \type{\spacing}, -%D \type{\topskip} and \type{\maxdepth} +%D \item different \type{\baselineskips}, \type{\spacing}, \type {\topskip} and +%D \type {\maxdepth} %D \item left- and right indentation, e.g. within lists %D \item moving columns floats to the next column or page %D \item handling of floats that are to wide for a columns %D \stopitemize %D -%D One could wonder why single and multi||columns modes are -%D still separated. One reason for this is that \TeX\ is not -%D suited well for handling multi||columns. As a result, the -%D single columns routines are more robust. Handling one -%D column as a special case of multi||columns is posible but at -%D the cost of worse float handling, worse page breaking, -%D worse etc. Complicated multi||column page handling should -%D be done in \cap{DTP}||systems anyway. +%D One could wonder why single and multi||columns modes are still separated. One +%D reason for this is that \TeX\ is not suited well for handling multi||columns. As +%D a result, the single columns routines are more robust. Handling one column as a +%D special case of multi||columns is posible but at the cost of worse float +%D handling, worse page breaking, worse etc. Complicated multi||column page handling +%D should be done in \cap{DTP}||systems anyway. %D -%D There are three commands provided for entering and leaving -%D multi||column mode and for going to the next column: +%D There are three commands provided for entering and leaving multi||column mode and +%D for going to the next column: %D %D \interface \type{\beginmulticolumns} \\ \\ %D \interface \type{\endmulticolumns} \\ \\ %D \interface \type{\ejectcolumn} \\ \\ -%D -%D This routines are sort of stand||alone. They communicate -%D with the rest of \CONTEXT\ by means of some interface -%D macro's, which we only mention. -%D -%D \interface \type{\nofcolumns} \\ -%D the number of columns \\ -%D \interface \type{\minbalancetoplines} \\ -%D the minimum number op balanced top lines \\ -%D \interface \type{\betweencolumns} \\ -%D the stuff between columns \\ -%D \interface \type{\finaloutput{action}{box}} \\ -%D some kind of \type{\pagebody} and \type{\shipout} \\ -%D -%D \interface \type{\ifbalancecolumns} \\ -%D balancing the colums or not \\ -%D \interface \type{\ifstretchcolumns} \\ -%D ragging the bottom or not \\ -%D -%D \interface \type{\ifheightencolumns} \\ -%D fix the heigh tor not \\ -%D \interface \type{\fixedcolumnheight} \\ -%D the optional fixed height \\ -%D -%D \interface \type{\ifinheritcolumns} \\ -%D handle ragging or not \\ -%D \interface \type{\ifr@ggedbottom} \\ -%D use ragged bottoms \\ -%D \interface \type{\ifb@selinebottom} \\ -%D put the bottom line on the baseline \\ -%D \interface \type{\ifnormalbottom} \\ -%D put the bottom line at the baseline \\ -%D -%D \interface \type{\ifreversecolumns} \\ -%D reverse the order in wich columns are flushed \\ -%D -%D \interface \type{\usercolumnwidth} \\ -%D the calculated width of a column \\ -%D \interface \type{\columntextwidth} \\ -%D the maximum width of a column \\ -%D \interface \type{\columntextheight} \\ -%D the minimum width of a column \\ -%D -%D \interface \type{\spacingfactor} \\ -%D the spacing factor \\ -%D \interface \type{\bodyfontsize} \\ -%D the (local) bodyfontsize \\ -%D \interface \type{\openlineheight} \\ -%D the lineheight (including \type{\spacing}) \\ -%D -%D \interface \type{\EveryBodyFont} \\ -%D communication channel to font switching routines \\ -%D -%D \interface \type{\global\settopskip} \\ -%D set \type{\topskip} \\ -%D \interface \type{\setvsize} \\ -%D set \type{\vsize} and \type{\pagegoal} \\ -%D \interface \type{\sethsize} \\ -%D set \type{\hsize} \\ -%D -%D \interface \type{\flushcolumnfloats} \\ -%D push saved column floats (next page) \\ -%D \interface \type{\flushcolumnfloat} \\ -%D push saved column floats (next column) \\ -%D \interface \type{\setcolumnfloats} \\ -%D initialize column floats \\ -%D -%D \interface \type{\finishcolumnbox} \\ -%D do something special (a hook) \\ -%D \interface \type{\postprocesscolumnpagebox} \\ -%D do something with each columnbox (also a hook) \\ -%D \interface \type{\postprocesscolumnbox} \\ -%D do something with each columnbox (also a hook) \\ -%D \interface \type{\postprocesscolumnline} \\ -%D do something with each columnline (also a hook) \\ -%D \interface \type{\currentcolumn} \\ -%D the current column \\ -%D -%D These interface macro's are called upon or initialized -%D by the multi||column macro's. - -%D A lot of footnote stuff added! \def\finalcolumntextwidth {\makeupwidth} \def\finalcolumntextheight {\textheight} @@ -195,23 +93,11 @@ \let\flushcolumnfloat \relax % in CONTEXT used for floats \let\finishcolumnbox \relax % in CONTEXT used for backgrounds -% %D In fact, the column height and width are set by means of -% %D two macro's. One can change their meaning if needed: -% -% \def\setcolumntextheight -% {\def\columntextheight{\teksthoogte}} -% -% \def\setcolumntextwidth -% {\def\columntextwidth{\zetbreedte}} - -%D Both macros are redefined in \CONTEXT\ when backgrounds -%D are applied to columns. The final values are used when -%D flushing the columns. +%D Both macros are redefined in \CONTEXT\ when backgrounds are applied to +%D columns. The final values are used when flushing the columns. -\newtoks\singlecolumnout % remove that one - -%D It's more convenient to use \type {\columnwidth} instead -%D of messing around with boxes each time. +%D It's more convenient to use \type {\columnwidth} instead of messing around +%D with boxes each time. \newdimen\columnwidth \newdimen\gutterwidth @@ -219,54 +105,31 @@ \def\determinecolumnwidth {\bgroup \setbox\scratchbox\hbox - {\setcolumnhsize + {\page_mul_command_set_hsize \global\columnwidth\usercolumnwidth \global\gutterwidth\intercolumnwidth}% \egroup} -%D Going to a new columns is done by means of a -%D \type{\ejectcolumn}. The following definition does not -%D always work. +%D Going to a new columns is done by means of a \type {\ejectcolumn}. The +%D following definition does not always work. \def\ejectcolumn - {\goodbreak\showmessage\m!columns2\empty} - -%D The next macro should never be called so let's deal with it. -%D There were several solutions to these kind of errors. First -%D we check for a good breakpoint before firing up the -%D multi||column routine (\type{\break} or \type{\allowbreak}). -%D We do the same at the end of the routine -%D (\type{\allowbreak}). These allowances are definitely -%D needed! -%D -%D Some on first sight redundant calls to for instance -%D \type{\setvsize} in the flushing, splitting and balancing -%D macro's can definitely not be omitted! Some are just there -%D to handle situations that only few times arise. One of -%D those can be that the output routine is invoked before -%D everything is taken care of. This happens when we -%D flush (part of) the current page with an \type{\unvbox} -%D with a \type{\pagetotal}~$\approx$ \type{\pagegoal}. One -%D simply cannot balance columns that are just balanced. -%D -%D I hope one never sees the following message. Because it -%D took me a lot of time to develop the multi||columns -%D routines, every (although seldom) warning gives me the -%D creeps! + {\goodbreak + \showmessage\m!columns2\empty} \def\balancingerror {\showmessage\m!columns3\empty - \finaloutput\unvbox\normalpagebox} + \page_otr_construct_and_shipout\unvbox\normalpagebox} -\def\OTRMULsometopsfloat{\showmessage\m!columns4\empty \someherefloat} -\def\OTRMULsomebotsfloat{\showmessage\m!columns5\empty \someherefloat} +\def\page_mul_place_float_top {\showmessage\m!columns4\empty\page_one_place_float_here} +\def\page_mul_place_float_bottom{\showmessage\m!columns5\empty\page_one_place_float_here} +\def\page_mul_place_float_here {\page_one_place_float_here} +\def\page_mul_place_float_force {\page_one_place_float_force} -\def\OTRMULsomeherefloat{\OTRONEsomeherefloat} +%D The local column width is available in the dimension register \type +%D {\localcolumnwidth}, which is calculated as: -%D The local column width is available in the dimension -%D register \type{\localcolumnwidth}, which is calculated as: - -\def\setcolumnhsize % beware, this one is available for use in macros +\unexpanded\def\page_mul_command_set_hsize % beware, this one is available for use in macros {\setbox\scratchbox\hbox{\parindent\zeropoint\betweencolumns}% \intercolumnwidth\wd\scratchbox \localcolumnwidth\columntextwidth @@ -350,15 +213,14 @@ %D \getbuffer %D \stop -%D One should be aware that when font related dimensions are -%D used in typesetting the in||between material, these -%D dimensions are influenced by bodyfont switches inside +%D One should be aware that when font related dimensions are used in typesetting the +%D in||between material, these dimensions are influenced by bodyfont switches inside %D multi||column mode. \newdimen\mcscratchdimen \newcount\nofcolumnlines -\newconstant\multicolumnlinemethod % 0: overshoot (old default), 1: tight +\setnewconstant\multicolumnlinemethod\plusone % 0: overshoot (old default), 1: tight \def\getmulticolumnlines {\mcscratchdimen-\columntextoffset @@ -381,29 +243,49 @@ \def\multicolumnovershootratio{.5} % {\ifgridsnapping0\else.5\fi} -\def\setcolumnvsize - {\getmulticolumnlines +\unexpanded\def\page_mul_command_set_vsize + {\page_one_command_set_vsize % indeed? + \getmulticolumnlines \mcscratchdimen\nofcolumnlines\openlineheight \advance\mcscratchdimen \multicolumnovershootratio\openlineheight % collect enough data \global\vsize\nofcolumns\mcscratchdimen \global\pagegoal\vsize} % let's do it only here -%D It really starts here. After some checks and initializations -%D we change the output routine to continous multi||column -%D mode. This mode handles columns that fill the current and -%D next full pages. The method used is (more or less) -%D multiplying \type{\vsize} and dividing \type{\hsize} by -%D \type{\nofcolumns}. More on this can be found in the -%D \TeX book. We save the top of the current page in box +%D It really starts here. After some checks and initializations we change the output +%D routine to continous multi||column mode. This mode handles columns that fill the +%D current and next full pages. The method used is (more or less) multiplying \type +%D {\vsize} and dividing \type {\hsize} by \type {\nofcolumns}. More on this can be +%D found in the \TeX book. We save the top of the current page in box %D \type{\precolumnbox}. %D -%D We manipulate \type{\topskip} a bit, just to be shure that -%D is has no flexibility. This has te be done every time a -%D font switch takles place, because \type{\topskip} can depend -%D on this. -%D -%D Watch the trick with the \type{\vbox}. This way we get the -%D right interlining and white space. +%D We manipulate \type {\topskip} a bit, just to be shure that is has no +%D flexibility. This has te be done every time a font switch takles place, because +%D \type{\topskip} can depend on this. + +\newconstant\c_page_mul_routine + +\setnewconstant\c_page_mul_routine_regular \zerocount +\setnewconstant\c_page_mul_routine_intercept \plusone +\setnewconstant\c_page_mul_routine_continuous \plustwo +\setnewconstant\c_page_mul_routine_balanced \plusthree +\setnewconstant\c_page_mul_routine_error \plusfour + +\unexpanded\def\page_mul_command_routine + {\ifcase\c_page_mul_routine + \page_one_command_routine + \or + \interceptmulticolumnsout + \or + \continuousmulticolumnsout + \or + \balancedmulticolumnsout + \or + \balancingerror + \fi} + +\def\interceptmulticolumnsout + {\global\setbox\precolumnbox\vbox + {\page_otr_command_flush_top_insertions\unvbox\normalpagebox}} \def\beginmulticolumns {\par @@ -418,7 +300,6 @@ \leftskip\zeropoint \rightskip\zeropoint % - \dontshowcomposition %\setcolumntextwidth\relax %\setcolumntextheight\relax \widowpenalty\zerocount % is gewoon beter @@ -442,39 +323,29 @@ \vskip-\struttotal \fi \global\savedpagetotal\pagetotal - \global\singlecolumnout\output % hm - %\global\output{\global\setbox\precolumnbox\vbox{\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 ! + \setupoutputroutine[\s!multicolumn]% + \c_page_mul_routine\c_page_mul_routine_intercept + \page_otr_trigger_output_routine % no \holdinginserts=1, can make footnote disappear ! \global\precolumnboxheight\ht\precolumnbox - %\global\output{\continuousmulticolumnsout}% - \setoutputroutine{\continuousmulticolumnsout}% + \c_page_mul_routine\c_page_mul_routine_continuous \setcolumnfloats - \dohandleallcolumns - {\global\setbox\currenttopcolumnbox\emptybox}% + \dohandleallcolumns{\global\setbox\currenttopcolumnbox\emptybox}% \checkbegincolumnfootnotes - \activateotr{MUL}{ONE}% todo ! ! ! ! - \let\sethsize\setcolumnhsize - \let\setvsize\setcolumnvsize - \sethsize - \setvsize - \showcomposition} - -%D When we leave the multi||column mode, we have to process the -%D not yet shipped out part of the columns. When we don't -%D balance, we simply force a continuous output, but a balanced -%D output is more tricky. - -%D First we try to fill up the page and when all or something -%D is left we try to balance things. This is another useful -%D adaption of the ancesters of these macro's. It takes some -%D reasoning to find out what happens and maybe I'm making + \page_otr_command_set_hsize + \page_otr_command_set_vsize} + +%D When we leave the multi||column mode, we have to process the not yet shipped out +%D part of the columns. When we don't balance, we simply force a continuous output, +%D but a balanced output is more tricky. +%D +%D First we try to fill up the page and when all or something is left we try to +%D balance things. This is another useful adaption of the ancesters of these +%D macro's. It takes some reasoning to find out what happens and maybe I'm making %D some mistake, but it works. %D -%D Voiding box \type{\precolumnbox} is sometimes necessary, -%D e.g. when there is no text given between \type{\begin..} -%D and \type{\end..}. The \type{\par} is needed! +%D Voiding box \type {\precolumnbox} is sometimes necessary, e.g. when there is no +%D text given between \type {\begin..} and \type {\end..}. The \type {\par} is +%D needed! \setnewconstant\multicolumnendsyncmethod\plusone % 1: old sync 2: new sync (cont-loc/project) / may fail ! ! ! ! @@ -487,43 +358,42 @@ \vskip\lineheight \vskip-\lineheight % take footnotes into account \fi - \dontshowcomposition \doflushcolumnfloat % added recently %\doflushcolumnfloats % no, since it results in wrong top floats \flushnotes % before start of columns \par \ifbalancecolumns \ifnum\multicolumnendsyncmethod=\plusone - %\global\output{\continuousmulticolumnsout}% - \setoutputroutine{\continuousmulticolumnsout}% + \c_page_mul_routine\c_page_mul_routine_continuous \goodbreak \fi - %\global\output{\balancedmulticolumnsout}% - \setoutputroutine{\balancedmulticolumnsout}% + \c_page_mul_routine\c_page_mul_routine_balanced \else \goodbreak \fi - \eject % the prevdepth is important, try e.g. toclist in + % still the multi column routine + \page_otr_trigger_output_routine % the prevdepth is important, try e.g. toclist in \prevdepth\zeropoint % columns before some noncolumned text text - %\global\output\singlecolumnout - \setoutputroutine{\singlecolumnout}% - %\global\output{\the\mainoutput}% % % % % todo - \setoutputroutine{\the\mainoutput}% % % % % todo + % + \c_page_mul_routine\c_page_mul_routine_regular +% \page_otf_set_engine_output_routine{\singlecolumnout}% +% \page_otf_set_engine_output_routine{\page_otr_triggered_output_routine}% + % \ifvoid\precolumnbox\else \unvbox\precolumnbox \fi \global\precolumnboxheight\zeropoint \endgroup % here \nofcolumns\plusone - \setvsize % the outer one! + \page_otr_command_set_vsize % the outer vsize (NEEDS CHECKING) \synchronizeoutput % new may 2004 / we need to: \pagegoal\vsize \checkendcolumnfootnotes \dosomebreak\allowbreak \dopopcolumnfloats} - -%D Because some initializations happen three times, we -%D defined a macro for them. Erasing \type{\everypar} is -%D needed because we don't want anything to interfere. + +%D Because some initializations happen three times, we defined a macro for +%D them. Erasing \type{\everypar} is needed because we don't want anything +%D to interfere. \def\setmulticolumnsout {\everypar\emptytoks @@ -536,27 +406,22 @@ \boxmaxdepth\maxdepth % dangerous \emergencystretch\zeropoint\relax} % sometimes needed ! -%D Flushing the page comes to pasting the columns together and -%D appending the result to box \type{\precolumnbox}, if not -%D void. I've seen a lot of implementations in which some skip -%D was put between normal text and multi||column text. When we -%D don't want this, the baselines can be messed up. I hope the -%D seemingly complicated calculation of a correction -%D \type{\kern} is adequate to overcome this. Although not -%D watertight, spacing is taken into account and even multiple -%D mode changes on one page go well. But cross your fingers and -%D don't blame me. +%D Flushing the page comes to pasting the columns together and appending the result +%D to box \type {\precolumnbox}, if not void. I've seen a lot of implementations in +%D which some skip was put between normal text and multi||column text. When we don't +%D want this, the baselines can be messed up. I hope the seemingly complicated +%D calculation of a correction \type {\kern} is adequate to overcome this. Although +%D not watertight, spacing is taken into account and even multiple mode changes on +%D one page go well. But cross your fingers and don't blame me. %D -%D One of the complications of flushing out the boxes is that -%D \type{\precolumnbox} needs to be \type{\unvbox}'ed, otherwise -%D there is too less flexibility in the page when using -%D \type{\r@ggedbottom}. It took a lot of time before these -%D kind of problems were overcome. Using \type{\unvbox} at the -%D wrong moment can generate \type{\balancingerror}'s. +%D One of the complications of flushing out the boxes is that \type {\precolumnbox} +%D needs to be \type {\unvbox}'ed, otherwise there is too less flexibility in the +%D page when using \type {\raggedbottom}. It took a lot of time before these kind of +%D problems were overcome. Using \type {\unvbox} at the wrong moment can generate +%D \type {\balancingerror}'s. %D -%D One can use the macros \type {\maxcolumnheight} and \type -%D {\maxcolumndepth} when generating material between columns -%D as well as postprocessing column lines. +%D One can use the macros \type {\maxcolumnheight} and \type {\maxcolumndepth} when +%D generating material between columns as well as postprocessing column lines. \let\maxcolumnheight=\zeropoint \let\maxcolumndepth =\zeropoint @@ -600,20 +465,19 @@ \fi \forgetall \setmulticolumnsout - \showcomposition \setmaxcolumndimensions \dohandleallcolumns {\mkprocesscolumncontents\currentcolumnbox}% \dohandleallcolumns - {\docolumnpagebodymarks\plusone\nofcolumns\mofcolumns\currentcolumnbox}% + {\page_marks_synchronize_column\plusone\nofcolumns\mofcolumns\currentcolumnbox}% \postprocesscolumns - \dohandleallcolumns % \hbox i.v.m. \showcomposition + \dohandleallcolumns {\global\setbox\currentcolumnbox\hbox to \localcolumnwidth - {\box\currentcolumnbox - \global\wd\currentcolumnbox\localcolumnwidth - \ifheightencolumns - \global\ht\currentcolumnbox\fixedcolumnheight - \fi}}% + {\box\currentcolumnbox}% + \wd\currentcolumnbox\localcolumnwidth + \ifheightencolumns + \ht\currentcolumnbox\fixedcolumnheight + \fi}% \setmaxcolumndimensions \overlaycolumnfootnotes \setbox\columnpagebox\vbox @@ -624,9 +488,12 @@ \else \@EA\dohandleallcolumns \fi - {\finishcolumnbox{\hbox - {\ifx\finishcolumnbox\relax\else\strut\fi - \box\currentcolumnbox}}% + {\finishcolumnbox + {\setbox\scratchbox\hbox + {\ifx\finishcolumnbox\relax\else\strut\fi + \strut\box\currentcolumnbox}% + \anch_mark_column_box\scratchbox + \box\scratchbox}% \hfil}% \unskip \hskip\colrightskip}}% new @@ -662,7 +529,7 @@ \fi \fi \fi \global\precolumnboxheight\zeropoint - \setvsize + \page_otr_command_set_vsize \dosomebreak\nobreak % hm, only needed when topstuff \ifgridsnapping \else @@ -672,28 +539,28 @@ \or % \input tufte \startcolumns \showbaselines \input tufte \stopcolumns \input tufte \ifconditional\someprecolumncontent -% \scratchdimen\topskip -% \advance\scratchdimen -\openstrutheight -% \nointerlineskip -% \vskip-\scratchdimen + % \scratchdimen\topskip + % \advance\scratchdimen -\openstrutheight + % \nointerlineskip + % \vskip-\scratchdimen \nointerlineskip \vskip\dimexpr\openstrutheight-\topskip\relax \fi \or -% \scratchdimen\topskip -% \advance\scratchdimen -\openstrutheight -% \nointerlineskip -% \vskip-\scratchdimen + % \scratchdimen\topskip + % \advance\scratchdimen -\openstrutheight + % \nointerlineskip + % \vskip-\scratchdimen \nointerlineskip \vskip\dimexpr\openstrutheight-\topskip\relax \or % untested but maybe handy -% \scratchdimen\topskip -% \advance\scratchdimen -\openstrutheight -% \nointerlineskip -% \vskip-\scratchdimen -% \vskip-\lineheight -% \vbox{\strut}% + % \scratchdimen\topskip + % \advance\scratchdimen -\openstrutheight + % \nointerlineskip + % \vskip-\scratchdimen + % \vskip-\lineheight + % \vbox{\strut}% \nointerlineskip \vskip\dimexpr\openstrutheight-\topskip-\lineheight\relax \vbox{\strut}% @@ -715,8 +582,12 @@ \vskip-\scratchdimen}% \scratchdimen\noflines\openlineheight \advance\scratchdimen-\openstrutdepth - \advance\scratchdimen-\openlineheight - \advance\scratchdimen\topskip + \ifgridsnapping + % quick hack (at least it works with itemize) + \else + \advance\scratchdimen-\openlineheight + \advance\scratchdimen\topskip + \fi \ht\columnpagebox\scratchdimen \dp\columnpagebox\openstrutdepth % end of mess @@ -724,13 +595,11 @@ \box\columnpagebox \egroup} -%D In case one didn't notice, finaly \type{\finishcolumnbox} is -%D applied to all boxes. One can use these hooks for special -%D purposes. +%D In case one didn't notice, finaly \type{\finishcolumnbox} is applied to +%D all boxes. One can use these hooks for special purposes. %D -%D Once upon a time I wanted to manipulate the individual lines -%D in a column. This feature is demonstrated in the two examples -%D below. +%D Once upon a time I wanted to manipulate the individual lines in a column. +%D This feature is demonstrated in the two examples below. %D %D \startbuffer %D \def\postprocesscolumnline#1% or \postprocesscolumnbox @@ -809,21 +678,18 @@ %D \macros %D {reversecolumnstrue} %D -%D We can force the macro that takes care of combining -%D the columns, to flush them in the revere order. Of -%D course, by default we don't reverse. +%D We can force the macro that takes care of combining the columns, to +%D flush them in the revere order. Of course, by default we don't reverse. \newif\ifreversecolumns -%D Here comes the simple splitting routine. It's a bit -%D longer than expected because of ragging bottoms or not. -%D This part can be a bit shorter but I suppose that I will -%D forget what happens. The splitting takes some already -%D present material (think of floats) into account! +%D Here comes the simple splitting routine. It's a bit longer than expected because +%D of ragging bottoms or not. This part can be a bit shorter but I suppose that I +%D will forget what happens. The splitting takes some already present material +%D (think of floats) into account! %D -%D First we present some auxiliary routines. Any material, -%D like for instance floats, that is already present in the -%D boxes is preserved. +%D First we present some auxiliary routines. Any material, like for instance floats, +%D that is already present in the boxes is preserved. \def\splitcolumn#1from \box#2to \dimen#3 top \box#4% {\bgroup @@ -844,7 +710,7 @@ \fuzzysnappedbox\unvbox0 \fakecolumnfootnotes{#1}}% \else - \ifcase\clevernotes + \ifcase\c_strc_notes_page_location \global\setbox#1\vsplit#2 to \dimen#3% \global\setbox#1\vbox {\fuzzysnappedbox\unvbox{#1}}% % or \box ? @@ -874,7 +740,7 @@ \def\fakecolumnfootnotes#1% {\relax - \ifcase\clevernotes\else + \ifcase\c_strc_notes_page_location\else \ifnum#1=\lastcolumnbox \fakenotes \fi @@ -882,7 +748,7 @@ \def\columnfootnotecorrection#1#2% {\relax - \ifcase\clevernotes + \ifcase\c_strc_notes_page_location % page notes \or \ifnum#1=\firstcolumnbox\relax @@ -898,64 +764,69 @@ \def\overlaycolumnfootnotes {\relax - \ifcase\clevernotes - % page notes - \else - \checknotepresence - \ifnotespresent - % the note box has the depth of the notefont - % because a column (i.e. first column has no depth, - % we need to anchor top down) - \bgroup - \ifcase\clevernotes\or - \getmulticolumnlines - \advance\nofcolumnlines \minustwo - \scratchdimen\nofcolumnlines\lineheight - \advance\scratchdimen \topskip - \setbox0\hbox - {\lower\scratchdimen\vbox{\placenoteinserts}}% - \ht0=\openstrutheight % \strutht - \dp0=\openstrutdepth % \strutdp - \wd0=\zeropoint - \scratchdimen\ht\firstcolumnbox - \global\setbox\firstcolumnbox\vbox to \scratchdimen - {\box\firstcolumnbox - \vskip-\scratchdimen - \box0}% - \else - % maybe here also \getmulticolumnlines - \scratchdimen\ht\firstcolumnbox - \advance\scratchdimen -\openstrutdepth % \strutdp - \getnoflines\scratchdimen - \advance\noflines \minustwo - \scratchdimen\noflines\lineheight - \advance\scratchdimen \topskip - \setbox0\hbox - {\lower\scratchdimen\vbox{\placenoteinserts}}% - \ht0=\openstrutheight % \strutht - \dp0=\openstrutdepth % \strutdp - \wd0=\zeropoint - \scratchdimen\ht\lastcolumnbox - \global\setbox\lastcolumnbox\vbox to \scratchdimen - {\box\lastcolumnbox - \vskip-\scratchdimen - \box0}% - \fi - \egroup - \fi + \ifcase\c_strc_notes_page_location + % page + \or + \checknotepresence \ifnotespresent \page_mul_notes_flush_first_column \fi + \or + \checknotepresence \ifnotespresent \page_mul_notes_flush_last_column \fi \fi} -%D Here comes the routine that splits the long box in columns. -%D The macro \type{\flushcolumnfloats} can be used to flush -%D either floats that were present before the multi||column -%D mode was entered, or floats that migrate to next columns. +\newbox\b_page_mul_notes + +\def\page_mul_notes_flush_first_column + {\begingroup + \setbox\b_page_mul_notes\vbox{\placenoteinserts}% + \ifzeropt\ht\b_page_mul_notes + % can't happen as we already checked + \else + \getmulticolumnlines + \advance\nofcolumnlines \minustwo + \scratchdimen\dimexpr\nofcolumnlines\lineheight+\topskip\relax + \setbox\b_page_mul_notes\hbox{\lower\scratchdimen\box\b_page_mul_notes}% + \ht\b_page_mul_notes\openstrutheight + \dp\b_page_mul_notes\openstrutdepth + \wd\b_page_mul_notes\zeropoint + \scratchdimen\ht\firstcolumnbox + \global\setbox\firstcolumnbox\vbox to \scratchdimen + {\box\firstcolumnbox + \vskip-\scratchdimen + \box\b_page_mul_notes}% + \fi + \endgroup} + +\def\page_mul_notes_flush_last_column + {\begingroup + \setbox\b_page_mul_notes\vbox{\placenoteinserts}% + \ifzeropt\ht\b_page_mul_notes + % can't happen as we already checked + \else + % maybe here also \getmulticolumnlines + \scratchdimen\dimexpr\ht\firstcolumnbox-\openstrutdepth\relax % \strutdp + \getnoflines\scratchdimen + \advance\noflines \minustwo + \scratchdimen\dimexpr\noflines\lineheight+\topskip\relax + \setbox\b_page_mul_notes\hbox{\lower\scratchdimen\box\b_page_mul_notes}% + \ht\b_page_mul_notes\openstrutheight + \dp\b_page_mul_notes\openstrutdepth + \wd\b_page_mul_notes\zeropoint + \scratchdimen\ht\lastcolumnbox + \global\setbox\lastcolumnbox\vbox to \scratchdimen + {\box\lastcolumnbox + \vskip-\scratchdimen + \box\b_page_mul_notes}% + \fi + \endgroup} + +%D Here comes the routine that splits the long box in columns. The macro \type +%D {\flushcolumnfloats} can be used to flush either floats that were present before +%D the multi||column mode was entered, or floats that migrate to next columns. %D Flushing floats is a delicate process. \def\continuousmulticolumnsout {\bgroup \forgetall \setmulticolumnsout - \dontshowcomposition % \dimen0=\columntextheight % \advance\dimen0 -\precolumnboxheight % \settotalinsertionheight @@ -970,7 +841,8 @@ {\splitcurrentcolumn from \box\normalpagebox to \dimen0}% \setbox\restofpage\vbox{\unvbox\normalpagebox}% \ifinheritcolumns - \ifr@ggedbottom % vreemd + \ifcase\bottomraggednessmode + % 0 = ragged \dohandleallcolumns {\global\setbox\currentcolumnbox\vbox to \ht\firstcolumnbox {\dimen0\dp\currentcolumnbox @@ -979,17 +851,18 @@ \vskip\openstrutdepth % \strutdp \prevdepth\openstrutdepth % \strutdp \vfill}}% - \ifbottomnotes \else + \strc_notes_check_if_bottom_present + \ifconditional\c_notes_bottom_present \else \dimen0\ht\firstcolumnbox \fi - \fi - \ifn@rmalbottom + \or + % 1 = normal \advance\dimen0 \maxdepth \dohandleallcolumns {\global\setbox\currentcolumnbox\vbox to \dimen0 {\unvbox\currentcolumnbox}}% - \fi - \ifb@selinebottom + \or + % 2 = baseline % the columns are on top of the baseline \fi \else @@ -1002,31 +875,28 @@ \vfill \fi}}% \dohandleallcolumns - {\global\ht\currentcolumnbox\dimen0}% + {\ht\currentcolumnbox\dimen0}% redundant \fi \setbox\precolumnbox\vbox{\flushcolumnedpage\zerocount}% - \finaloutput\box\precolumnbox - \sethsize - \setvsize + \page_otr_construct_and_shipout\box\precolumnbox + \page_otr_command_set_hsize + \page_otr_command_set_vsize \flushcolumnfloats \unvbox\restofpage % \penalty\outputpenalty % gaat gruwelijk mis in opsommingen \egroup} -%D And this is the balancing stuff. Again, part of the routine -%D is dedicated to handling ragged bottoms, but here we also -%D see some handling concerning the stretching of columns. -%D We set \type{\widowpenalty} at~0, which enables us to -%D balance columns with few lines. The use of \type{\box2} and -%D \type{\box4} garantees a more robust check when skips are -%D used. +%D And this is the balancing stuff. Again, part of the routine is dedicated to +%D handling ragged bottoms, but here we also see some handling concerning the +%D stretching of columns. We set \type {\widowpenalty} at~0, which enables us to +%D balance columns with few lines. The use of \type {\box2} and \type {\box4} +%D garantees a more robust check when skips are used. \def\multicolumnsbalancemax{250} % 100 is too small when floats are involved \def\balancedmulticolumnsout {\bgroup \setmulticolumnsout - \dontshowcomposition \widowpenalty\zerocount \setbox0\vbox{\unvbox\normalpagebox}% \ifdim\ht0>\openlineheight % at least one line @@ -1056,7 +926,7 @@ \dohandleallcolumns {\advance\dimen0 \ht\currenttopcolumnbox}% \divide\dimen0 \nofcolumns - \vbadness\!!tenthousand\relax + \vbadness\plustenthousand \count255=\zerocount \bgroup \ifgridsnapping @@ -1164,22 +1034,21 @@ \showmessage\m!columns{10}\empty \global\setbox\firstcolumnbox\vbox{\unvbox0}% \fi - %\global\output{\balancingerror}% - \setoutputroutine{\balancingerror}% - \b@selinebottomtrue % forces depth in separation rule + \c_page_mul_routine\c_page_mul_routine_error + \baselinebottom % forces depth in separation rule \flushcolumnedpage\plusone \multicolumnseject \egroup} \def\multicolumnseject {%\ifdim\pagetotal>\textheight - % \eject % new, but wrong as fails on mixed-001.tex (wrong pagetotal at this point) + % \page_otr_trigger_output_routine % new, but wrong as fails on mixed-001.tex (wrong pagetotal at this point) %\else \allowbreak }%\fi} -%D The multicolumn mechanism is incorporated in a \CONTEXT\ -%D interface, which acts like: +%D The multicolumn mechanism is incorporated in a \CONTEXT\ interface, +%D which acts like: %D %D \starttyping %D \startcolumns[n=4,balance=no] @@ -1187,8 +1056,8 @@ %D \stopcolumns %D \stoptyping %D -%D The setup is optional. The default behaviour of columns -%D can be set up with: +%D The setup is optional. The default behaviour of columns can be set +%D up with: %D %D \starttyping %D \setupcolumns @@ -1196,31 +1065,24 @@ %D balance=yes] %D \stoptyping %D -%D In this case, stretching is according to the way it's -%D done outside columns (\type{\inheritcolumnstrue}). Also -%D we can setup the \type{tolerance} within a column, the -%D \type{distance} between columns and the fixed -%D \type{height} of a column. - -%D Multi||column output: the float routines +%D In this case, stretching is according to the way it's done outside columns +%D (\type{\inheritcolumnstrue}). Also we can setup the \type{tolerance} within a +%D column, the \type{distance} between columns and the fixed \type{height} of a +%D column. %D -%D Here come the routines that handle the placement of column -%D floats. Floats that are to big migrate to the next -%D column. Floats that are too wide, migrate to the top of the -%D next page, where they span as much columns as needed. -%D Floats that are left over from outside the multi||column -%D mode are flushed first. In macro \type{\finaloutput} the -%D topfloats that are left from previous text should be set. +%D Here come the routines that handle the placement of column floats. Floats that +%D are to big migrate to the next column. Floats that are too wide, migrate to the +%D top of the next page, where they span as much columns as needed. Floats that are +%D left over from outside the multi||column mode are flushed first. In macro +%D \type{\page_otr_construct_and_shipout} the topfloats that are left from previous +%D text should be set. %D -%D When there are some floats in the queue, we inhibit the -%D flushing of floats on top of columns. The number of -%D waiting floats is preswent in \type{\savednoftopfloats} and -%D is saved. As long as there are floats waiting, the topfloats -%D are places as if we are outside multi||column mode. This is -%D neccessary for e.g. multicolumn lists. +%D When there are some floats in the queue, we inhibit the flushing of floats on top +%D of columns. The number of waiting floats is preswent in \type{\savednoftopfloats} +%D and is saved. As long as there are floats waiting, the topfloats are places as if +%D we are outside multi||column mode. This is neccessary for e.g. multicolumn lists. %D -%D When all those floats are flushed, we switch to the local -%D flushing routine. +%D When all those floats are flushed, we switch to the local flushing routine. \def\dopushcolumnfloats {\ifsomefloatwaiting @@ -1251,10 +1113,29 @@ \newconditional\onlylocalcolumnfloats % temp hack as we will redo floats (grid snapping is also messy now) -\def\OTRMULdocheckiffloatfits{\ifconditional\onlylocalcolumnfloats\docolumnroomfloat \else\relax \fi} -\def\OTRMULdosetbothinserts {\ifconditional\onlylocalcolumnfloats\relax \else\OTRONEdosetbothinserts\fi} -\def\OTRMULdotopinsertions {\ifconditional\onlylocalcolumnfloats\relax \else\OTRONEdotopinsertions \fi} -\def\OTRMULdoflushfloats {\ifconditional\onlylocalcolumnfloats\doflushcolumnfloats\else\OTRONEdoflushfloats \fi} +\unexpanded\def\page_mul_command_flush_floats + {\ifconditional\onlylocalcolumnfloats + \doflushcolumnfloats + \else + \page_one_command_flush_floats + \fi} + +\unexpanded\def\page_mul_command_check_if_float_fits + {\ifconditional\onlylocalcolumnfloats + \docolumnroomfloat + \fi} + +\unexpanded\def\page_mul_command_flush_saved_floats + {\ifconditional\onlylocalcolumnfloats\relax + \else + \page_one_command_flush_saved_floats + \fi} + +\unexpanded\def\page_mul_command_flush_top_insertions + {\ifconditional\onlylocalcolumnfloats\relax + \else + \page_one_command_flush_top_insertions + \fi} \newtoks\everylocalcolumnfloatspar @@ -1280,7 +1161,7 @@ {\bgroup \xdef\localsavednoffloats{\the\savednoffloats}% \global\savednoffloats\globalsavednoffloats - \dotopinsertions + \page_otr_command_flush_top_insertions \xdef\globalsavenoffloats{\the\savednoffloats}% \ifnum\globalsavednoffloats=\zerocount \setlocalcolumnfloats @@ -1288,14 +1169,12 @@ \global\savednoffloats\localsavednoffloats \egroup} -%D We need to calculate the amount of free space in a columns. -%D When there is not enough room, we migrate the float to the -%D next column. These macro's are alternatives (and -%D look||alikes) of \type{\doroomfloat}. When a float is to -%D wide, for one column, it is moved to the top of the next -%D page. Of course such moved floats have to be taken into -%D account when we calculate the available space. It's a pitty -%D that such things are no integral part of \TEX. +%D We need to calculate the amount of free space in a columns. When there is not +%D enough room, we migrate the float to the next column. These macro's are +%D alternatives (and look||alikes) of \type {\doroomfloat}. When a float is to wide, +%D for one column, it is moved to the top of the next page. Of course such moved +%D floats have to be taken into account when we calculate the available space. It's +%D a pitty that such things are no integral part of \TEX. \def\getcolumnstatus\column#1\total#2\goal#3\\% {\dimen0=\ifdim\pagegoal<\maxdimen \pagetotal \else \zeropoint \fi @@ -1341,7 +1220,7 @@ \getcolumnstatus\column\count255\total\dimen0\goal\dimen2\\% \dofloatsgetinfo\s!text \setbox\scratchbox\vbox % tricky met objecten ? - {\blank[\@@bkspacebefore] + {\blank[\rootfloatparameter\c!spacebefore] \snaptogrid\vbox{\vskip\floatheight}}% copy? \advance\dimen0\dimexpr\ht\scratchbox+2\openlineheight+.5\lineheight\relax\relax % needed because goal a bit higher \ifdim\dimen0>\dimen2 @@ -1355,78 +1234,79 @@ \fi \egroup \fi\fi} - -%D Flushing one float is done as soon as possible, i.e. -%D \type{\everypar}. This means that (at the moment) -%D sidefloats are not supported (overulled)! + +%D Flushing one float is done as soon as possible, i.e. \type {\everypar}. +%D This means that (at the moment) sidefloats are not supported (overulled)! \newif\ifflushingcolumnfloats \flushingcolumnfloatstrue \def\doflushcolumnfloat - {\ifpostponecolumnfloats\else\ifflushingcolumnfloats\ifprocessingverbatim\else\ifsomefloatwaiting - \bgroup - \forgetall - \let\doflushcolumnfloat\relax - \getcolumnstatus\column\mofcolumns\total\dimen0\goal\dimen2\\% - \ifdim\dimen0>\zeropoint - \dofloatsgetinfo\s!text - \ifdim\floatwidth>\hsize - % dropped ? - \else - \setbox2\vbox - {\blank[\@@bkspacebefore] - \snaptogrid\vbox{\vskip\floatheight}}% - \advance\dimen0 \ht2 - \ifdim\dimen0>\dimen2 - \ifnum\mofcolumns<\nofcolumns - \advance\mofcolumns \plusone - \ifdim\ht\currenttopcolumnbox=\zeropoint - \dofloatsflush\s!text{1}% - \global\setbox\currenttopcolumnbox\vbox - {\snaptogrid\vbox{\box\floatbox} - \whitespace % nodig ? - \blank[\@@bkspaceafter]}% - \dimen4=\htdp\currenttopcolumnbox - \global\advance\vsize -\dimen4 - \advance\dimen4 -\pagegoal - \global\pagegoal-\dimen4 - \showmessage\m!columns{12}a% - \else - \showmessage\m!columns{12}b% - \fi + {\ifpostponecolumnfloats\else\ifflushingcolumnfloats\ifsomefloatwaiting + \doflushcolumnfloatindeed + \fi\fi\fi} + +\def\doflushcolumnfloatindeed + {\bgroup + \forgetall + \let\doflushcolumnfloat\relax + \getcolumnstatus\column\mofcolumns\total\dimen0\goal\dimen2\\% + \ifdim\dimen0>\zeropoint + \dofloatsgetinfo\s!text + \ifdim\floatwidth>\hsize + % dropped ? + \else + \setbox2\vbox + {\blank[\rootfloatparameter\c!spacebefore] + \snaptogrid\vbox{\vskip\floatheight}}% + \advance\dimen0 \ht2 + \ifdim\dimen0>\dimen2 + \ifnum\mofcolumns<\nofcolumns + \advance\mofcolumns \plusone + \ifdim\ht\currenttopcolumnbox=\zeropoint + \dofloatsflush\s!text{1}% + \global\setbox\currenttopcolumnbox\vbox + {\snaptogrid\vbox{\box\floatbox} + \whitespace % nodig ? + \blank[\rootfloatparameter\c!spaceafter]}% + \dimen4=\htdp\currenttopcolumnbox + \global\advance\vsize -\dimen4 + \advance\dimen4 -\pagegoal + \global\pagegoal-\dimen4 + \showmessage\m!columns{12}a% \else - \showmessage\m!columns{12}c% + \showmessage\m!columns{12}b% \fi \else - \ifhmode{\setbox0\lastbox}\fi% waar is die er in geslopen - \par - \ifdim\prevdepth<\zeropoint \else % anders bovenaan kolom witruimte - \nobreak - \blank[\@@bkspacebefore] - \nobreak - \fi - \dofloatsflush\s!text{1}% - \flushfloatbox - \blank[\@@bkspaceafter] + \showmessage\m!columns{12}c% + \fi + \else + \ifhmode{\setbox0\lastbox}\fi% waar is die er in geslopen + \par + \ifdim\prevdepth<\zeropoint \else % anders bovenaan kolom witruimte + \nobreak + \blank[\rootfloatparameter\c!spacebefore] + \nobreak \fi + \dofloatsflush\s!text{1}% + \page_otr_command_flush_float_box + \blank[\rootfloatparameter\c!spaceafter] \fi \fi - \egroup - \fi\fi\fi\fi} + \fi + \egroup} -%D This one looks complicated. Upto \type{\nofcolumns} floats -%D are placed, taking the width of a float into account. This -%D routine can be improved on different ways: +%D This one looks complicated. Upto \type{\nofcolumns} floats are placed, +%D taking the width of a float into account. This routine can be improved +%D on different ways: %D %D \startitemize[intro,packed] -%D \item taking into account some imaginary baseline, just to -%D get the captions in line -%D \item multipass flushing until as many floats are displaced -%D as possible +%D \item taking into account some imaginary baseline, just to get the +%D captions in line +%D \item multipass flushing until as many floats are displaced as possible %D \stopitemize %D -%D When handling lots of (small) floats spacing can get worse -%D because of lining out the columns. +%D When handling lots of (small) floats spacing can get worse because of +%D lining out the columns. \def\doflushcolumnfloats {\ifpostponecolumnfloats\else @@ -1444,7 +1324,7 @@ {\copy\currenttopcolumnbox \hbox{\vphantom{\vskip\floatheight}}}% known from previous \whitespace % nodig ? - \blank[\@@bkspaceafter]}% + \blank[\rootfloatparameter\c!spaceafter]}% \else \dofloatsgetinfo\s!text \ifdim\floatwidth>\hsize @@ -1462,7 +1342,7 @@ \global\setbox\floatbox\hbox to \finalcolumntextwidth{\hss\box\floatbox\hss}% \fi % otherwise the graphic may disappear \global\setbox\floatbox\hbox to \dimen0 - {\processaction[\@@bklocation] % how easy to forget + {\processaction[\rootfloatparameter\c!location] % how easy to forget [ \v!left=>\box\floatbox\hss, \v!right=>\hss\box\floatbox, \s!default=>\hss\box\floatbox\hss, @@ -1482,7 +1362,7 @@ {\box\currenttopcolumnbox % was copy \box\floatbox} \whitespace % nodig ? - \blank[\@@bkspaceafter]}% + \blank[\rootfloatparameter\c!spaceafter]}% \fi \dimen6\htdp\currenttopcolumnbox \fi @@ -1492,17 +1372,17 @@ \advance\dimen8 \dimen6 \advance\count2 \minusone \advance\count0 \minusone }% - \setvsize + \page_otr_command_set_vsize \global\advance\vsize -\dimen8 \global\pagegoal\vsize \else - %\doflushfloats % does not snap! + % \page_mul_command_flush_floats % does not snap! \fi \egroup \fi} -%D The next macro can be used to flush floats in the current -%D stream. No width checking is (yet) done. +%D The next macro can be used to flush floats in the current stream. No +%D width checking is (yet) done. \def\insertcolumnfloats {\doloop @@ -1511,19 +1391,19 @@ \forgetall % no check for width \dogetfloat - \blank[\@@bkspacebefore] + \blank[\rootfloatparameter\c!spacebefore] \snaptogrid\vbox{\copy\floatbox} - \blank[\@@bkspaceafter] + \blank[\rootfloatparameter\c!spaceafter] \egroup \else \exitloop \fi}} -%D This were the multi||column routines. They can and need to -%D be improved but at the moment their behaviour is acceptable. +%D This were the multi||column routines. They can and need to be improved +%D but at the moment their behaviour is acceptable. %D -%D One inprovement can be to normalize the height of floats -%D to $n\times$\type{\lineheight} with a macro like: +%D One inprovement can be to normalize the height of floats to $ n \times $ +%D \type {\lineheight} with a macro like: %D %D \starttyping %D \normalizevbox{...} @@ -1532,13 +1412,11 @@ % border case, should fit on one page % % \startcolumns -% -% 1 \input tufte \par \plaatsfiguur{}{\omlijnd[breedte=\hsize,hoogte=3cm]{1}} -% 2 \input tufte \par \plaatsfiguur{}{\omlijnd[breedte=\hsize,hoogte=3cm]{2}} -% 3 \input tufte \par \plaatsfiguur{}{\omlijnd[breedte=\hsize,hoogte=3cm]{3}} -% +% 1 \input tufte \par \placefigure{}{\framed[width=\hsize,height=3cm]{1}} +% 2 \input tufte \par \placefigure{}{\framed[width=\hsize,height=3cm]{2}} +% 3 \input tufte \par \placefigure{}{\framed[width=\hsize,height=3cm]{3}} % \stopcolumns - + \unexpanded\def\setupcolumns {\dosingleempty\dosetupcolumns} @@ -1564,7 +1442,9 @@ \hskip.5\dimen0 \vrule \!!width\linewidth - \ifb@selinebottom\!!depth\strutdepth\fi + \ifnum\bottomraggednessmode=\plustwo % baselinebottom + \!!depth\strutdepth + \fi \hskip.5\dimen0\relax \stoptextproperties \egroup} @@ -1589,6 +1469,12 @@ \definecomplexorsimpleempty\startcolumns +% to be reconsidered ... (in any case they need to be unexpandable sinze 2011.12.30) + +\unexpanded\def\page_columns_align_option_yes {\stretchcolumnstrue \inheritcolumnsfalse}% todo: new key +\unexpanded\def\page_columns_align_option_no {\stretchcolumnsfalse\inheritcolumnsfalse}% todo: new key +\unexpanded\def\page_columns_align_option_text{\stretchcolumnsfalse\inheritcolumnstrue }% + \def\complexstartcolumns[#1]% %% \startcolumns {\bgroup \let\stopcolumns\egroup @@ -1613,23 +1499,18 @@ \doifelse\@@klbalance\v!yes \balancecolumnstrue \balancecolumnsfalse - \installalign\v!yes {\stretchcolumnstrue \inheritcolumnsfalse}% todo: new key - \installalign\v!no {\stretchcolumnsfalse\inheritcolumnsfalse}% todo: new key - \installalign\v!text{\stretchcolumnsfalse\inheritcolumnstrue }% + \installalign\v!yes {\page_columns_align_option_yes }% + \installalign\v!no {\page_columns_align_option_no }% + \installalign\v!text{\page_columns_align_option_text}% \stretchcolumnsfalse \inheritcolumnstrue \doifsomething\@@klalign{\expanded{\setupalign[\@@klalign]}}% - \nofcolumns=\@@kln - % - % probably more is needed, and how about nesting save's - % - \saveouterspacing - % + \nofcolumns\@@kln \edef\fixedcolumnheight{\@@klheight}% \edef\minbalancetoplines{\@@klntop}% \setuptolerance[\@@kltolerance]% %% \startcolumns \setupblank[\@@klblank]% - \ifdim\ctxparskip>\zeropoint\relax + \ifdim\s_spac_whitespace_parskip>\zeropoint\relax \setupwhitespace[\@@klblank]% \fi \unexpanded\def\stopcolumns @@ -1641,20 +1522,19 @@ \beginmulticolumns \fi \fi} - -\installcolumnbreakhandler {MUL} \v!preference + +\installcolumnbreakmethod \s!multicolumn \v!preference {\goodbreak} -\installcolumnbreakhandler {MUL} \v!yes +\installcolumnbreakmethod \s!multicolumn \v!yes {\par % todo: since {\testrulewidth\zeropoint\ruledvskip\textheight} % we misuse a \penalty-200 % side effect \vskip-\textheight }% bugged : \prevdepth-\thousandpoint} % signals top of column to \blank - -%D New: only at start of columns; may change ! Rather -%D interwoven and therefore to be integrated when the multi -%D column modules are merged. (moved from cont-new.tex) + +%D New: only at start of columns; may change ! Rather interwoven and therefore +%D to be integrated when the multi column modules are merged. \unexpanded\def\setupcolumnspan[#1]% {\getparameters[\??ks][#1]} @@ -1667,7 +1547,7 @@ \c!offset=\v!overlay, \c!frame=\v!off] -\newbox\columnspanbox \let\postprocesscolumnspanbox\gobbleoneargument +\newbox\b_page_columns_span \let\postprocesscolumnspanbox\gobbleoneargument \def\dostartcolumnspan[#1]% {\bgroup @@ -1678,50 +1558,51 @@ \hsize\@@ksn\hsize \advance\hsize -\intercolumnwidth \fi - \dowithnextbox - {\setbox\columnspanbox\flushnextbox - \ifinsidecolumns\wd\columnspanbox\hsize\fi - \postprocesscolumnspanbox\columnspanbox - \scratchdimen\ht\columnspanbox - \setbox\columnspanbox\hbox % depth to be checked, probably option! - {\localframed[\??ks][\c!offset=\v!overlay]{\box\columnspanbox}}% - \ht\columnspanbox\scratchdimen - \dp\columnspanbox\strutdp - \wd\columnspanbox\hsize - \ifinsidecolumns - \ifnum\@@ksn>1 - \setvsize - \dohandleallcolumns - {\ifnum\currentcolumn>\@@ksn\else - \global\setbox\currenttopcolumnbox=\vbox - {\ifnum\currentcolumn=1 - \snaptogrid\vbox{\copy\columnspanbox} - \else - \snaptogrid\vbox{\vphantom{\copy\columnspanbox}} - \fi}% - \wd\currenttopcolumnbox\hsize - \global\advance\vsize -\ht\currenttopcolumnbox - \fi} - \global\pagegoal\vsize - \else - \snaptogrid\vbox{\box\columnspanbox} - \fi - \else - \snaptogrid\vbox{\box\columnspanbox} - \fi - \endgraf - \ifvmode\prevdepth\strutdp\fi - \egroup} - \vbox\bgroup - %\topskipcorrection % becomes an option ! - \EveryPar{\begstrut\EveryPar{}}} % also ! + \dowithnextboxcs\dofinishcolumnsetspan\vbox\bgroup + %\topskipcorrection % becomes an option ! + \EveryPar{\begstrut\EveryPar{}}} % also ! + +\def\dofinishcolumnsetspan + {\setbox\b_page_columns_span\flushnextbox + \ifinsidecolumns\wd\b_page_columns_span\hsize\fi + \postprocesscolumnspanbox\b_page_columns_span + \scratchdimen\ht\b_page_columns_span + \setbox\b_page_columns_span\hbox % depth to be checked, probably option! + {\localframed[\??ks][\c!offset=\v!overlay]{\box\b_page_columns_span}}% + \ht\b_page_columns_span\scratchdimen + \dp\b_page_columns_span\strutdp + \wd\b_page_columns_span\hsize + \ifinsidecolumns + \ifnum\@@ksn>1 + \page_otr_command_set_vsize + \dohandleallcolumns + {\ifnum\currentcolumn>\@@ksn\else + \global\setbox\currenttopcolumnbox=\vbox + {\ifnum\currentcolumn=1 + \snaptogrid\vbox{\copy\b_page_columns_span} + \else + \snaptogrid\vbox{\vphantom{\copy\b_page_columns_span}} + \fi}% + \wd\currenttopcolumnbox\hsize + \global\advance\vsize -\ht\currenttopcolumnbox + \fi} + \global\pagegoal\vsize + \else + \snaptogrid\vbox{\box\b_page_columns_span} + \fi + \else + \snaptogrid\vbox{\box\b_page_columns_span} + \fi + \endgraf + \ifvmode\prevdepth\strutdp\fi + \egroup} \unexpanded\def\startcolumnspan {\dosingleempty\dostartcolumnspan} \unexpanded\def\stopcolumnspan {\egroup} - + \setupcolumns [\c!n=2, \c!ntop=1, @@ -1737,7 +1618,7 @@ \c!option=, \c!rulethickness=\linewidth, \c!offset=.5\bodyfontsize] - + %D Undocumented and still under development. \unexpanded\def\startsimplecolumns @@ -1760,4 +1641,36 @@ \rigidcolumnbalance\scratchbox \egroup} +\unexpanded\def\setsimplecolumnshsize[#1]% + {\getparameters[\??kl][\c!width=\hsize,\c!distance=1.5\bodyfontsize,\c!n=2,\c!lines=0,#1]% + \let\rigidcolumnlines\@@kllines + \setrigidcolumnhsize\@@klwidth\@@kldistance\@@kln} + +\let\page_mul_command_package_contents\page_one_command_package_contents +\let\page_mul_command_flush_float_box \page_one_command_flush_float_box + +\defineoutputroutine + [\s!multicolumn] + [\s!page_otr_command_routine =\page_mul_command_routine, + \s!page_otr_command_package_contents =\page_mul_command_package_contents, + \s!page_otr_command_set_vsize =\page_mul_command_set_vsize, + \s!page_otr_command_set_hsize =\page_mul_command_set_hsize, + \s!page_otr_command_next_page =\page_mul_command_next_page, + \s!page_otr_command_next_page_and_inserts =\page_mul_command_next_page_and_inserts, + % \s!page_otr_command_synchronize_hsize =\page_mul_command_synchronize_hsize, + % \s!page_otr_command_set_top_insertions =\page_mul_command_set_top_insertions, + % \s!page_otr_command_set_bottom_insertions =\page_mul_command_set_bottom_insertions, + \s!page_otr_command_flush_top_insertions =\page_mul_command_flush_top_insertions, + % \s!page_otr_command_flush_bottom_insertions =\page_mul_command_flush_bottom_insertions, + % \s!page_otr_command_set_float_hsize =\page_mul_command_set_float_hsize, + \s!page_otr_command_check_if_float_fits =\page_mul_command_check_if_float_fits, + \s!page_otr_command_flush_float_box =\page_mul_command_flush_float_box, + \s!page_otr_command_synchronize_side_floats =\page_mul_command_synchronize_side_floats, + \s!page_otr_command_side_float_output =\page_mul_command_side_float_output, + \s!page_otr_command_flush_floats =\page_mul_command_flush_floats, + \s!page_otr_command_flush_side_floats =\page_mul_command_flush_side_floats, + \s!page_otr_command_flush_saved_floats =\page_mul_command_flush_saved_floats + % \s!page_otr_command_flush_margin_blocks =\page_mul_command_flush_margin_blocks, % not used + ] + \protect \endinput |