summaryrefslogtreecommitdiff
path: root/tex/context/base/page-set.tex
diff options
context:
space:
mode:
Diffstat (limited to 'tex/context/base/page-set.tex')
-rw-r--r--tex/context/base/page-set.tex1527
1 files changed, 963 insertions, 564 deletions
diff --git a/tex/context/base/page-set.tex b/tex/context/base/page-set.tex
index 18c69b769..d7d4409c3 100644
--- a/tex/context/base/page-set.tex
+++ b/tex/context/base/page-set.tex
@@ -11,18 +11,18 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-% getnoflines vs getrawnoflines
+% getnoflines vs getrawnoflines
\writestatus{loading}{Context OTR Macros / Column Sets}
-% todo : last longer than previous
-% todo : block span over last column if footnotes
-% todo : diagnosis balancing run
-% todo : separate footnote placement
+% todo : last longer than previous
+% todo : block span over last column if footnotes
+% todo : diagnosis balancing run
+% todo : separate footnote placement
% todo : go on on same page with colset
-% todo : test page areas per page
+% todo : test page areas per page
-\unprotect
+\unprotect
\newcount\tofcolumns % total
\newcount\lofcolumns % left
@@ -64,16 +64,16 @@
\def\columnerasegridboxes
{\bgroup
\increment\columnmaxcells\relax
- \ifodd\realpageno
+ \ifodd\realpageno
\else % we are on the other page
\columnspreadfalse
\fi
\ifcolumnspread
\dorecurse\nofcolumns
{\let\!!stringa\recurselevel
- \scratchcounter=\recurselevel \advance\scratchcounter\lofcolumns
+ \scratchcounter\recurselevel \advance\scratchcounter\lofcolumns
\edef\!!stringb{\the\scratchcounter}%
- \dostepwiserecurse{0}{\columnmaxcells}{1}
+ \dostepwiserecurse \zerocount \columnmaxcells \plusone
{\ifcsname\@otr@:\!!stringa:\recurselevel\endcsname
\global\setbox\csname\@otr@:\!!stringa:\recurselevel\endcsname\box
\ifcsname\@otr@:\!!stringb:\recurselevel\endcsname
@@ -93,9 +93,9 @@
\fi
\fi}}%
\else
- \dorecurse\tofcolumns
+ \dorecurse \tofcolumns
{\let\!!stringa\recurselevel
- \dostepwiserecurse{0}{\columnmaxcells}{1}
+ \dostepwiserecurse \zerocount \columnmaxcells \plusone
{\ifcsname\@otr@:\!!stringa:\recurselevel\endcsname
\global\setbox\csname\@otr@:\!!stringa:\recurselevel\endcsname\box\voidb@x
\else
@@ -104,9 +104,9 @@
\fi
\dorecurse\tofcolumns
{\global\setbox\csname\@otr@:\recurselevel:\columnmaxcells\endcsname\copy\placeholderboxa}%
- \global\columnfirstcell=0
- \global\columnlastcell=\columnfirstcell
- \global\columnfreecells=\columnfirstcell
+ \global\columnfirstcell\zerocount
+ \global\columnlastcell\columnfirstcell
+ \global\columnfreecells\columnfirstcell
\egroup}
\endETEX
@@ -122,9 +122,9 @@
\ifcolumnspread
\dorecurse\nofcolumns
{\let\!!stringa\recurselevel
- \scratchcounter=\recurselevel \advance\scratchcounter\lofcolumns
+ \scratchcounter\recurselevel \advance\scratchcounter\lofcolumns
\edef\!!stringb{\the\scratchcounter}%
- \dostepwiserecurse{0}{\columnmaxcells}{1}
+ \dostepwiserecurse \zerocount \columnmaxcells \plusone
{\expandafter\ifx\csname\@otr@:\!!stringa:\recurselevel\endcsname\relax
\expandafter\newbox\csname\@otr@:\!!stringa:\recurselevel\endcsname
\expandafter\ifx\csname\@otr@:\!!stringb:\recurselevel\endcsname\relax
@@ -146,7 +146,7 @@
\else
\dorecurse\tofcolumns
{\let\!!stringa\recurselevel
- \dostepwiserecurse{0}{\columnmaxcells}{1}
+ \dostepwiserecurse \zerocount \columnmaxcells \plusone
{\expandafter\ifx\csname\@otr@:\!!stringa:\recurselevel\endcsname\relax
\expandafter\newbox\csname\@otr@:\!!stringa:\recurselevel\endcsname
\else
@@ -155,7 +155,7 @@
\fi
\dorecurse\tofcolumns
{\global\setbox\csname\@otr@:\recurselevel:\columnmaxcells\endcsname\copy\placeholderboxa}%
- \global\columnfirstcell=0
+ \global\columnfirstcell\zerocount
\global\columnlastcell\columnfirstcell
\global\columnfreecells\columnfirstcell
\egroup}
@@ -163,17 +163,17 @@
\endTEX
\def\doOTRSETsetgridcells#1#2#3#4#5#6% placeholder col row wid hei {data}
- {\!!countd#2\advance\!!countd#4\advance\!!countd-1
- \!!counte#3\advance\!!counte#5\advance\!!counte-1
- \dostepwiserecurse{#2}{\!!countd}{1}
+ {\!!countd#2\advance\!!countd#4\advance\!!countd\minusone
+ \!!counte#3\advance\!!counte#5\advance\!!counte\minusone
+ \dostepwiserecurse{#2}\!!countd\plusone
{\!!countf\recurselevel
- \dostepwiserecurse{#3}{\!!counte}{1}
+ \dostepwiserecurse{#3}\!!counte\plusone
{\OTRSETsetgridcell\!!countf\recurselevel#1}}%
- \dostepwiserecurse{#3}{\!!counte}{1}
- {\global\wd\OTRSETgridcell{#2}\recurselevel=\hsize}%
+ \dostepwiserecurse{#3}\!!counte\plusone
+ {\global\wd\OTRSETgridcell{#2}\recurselevel\hsize}%
\OTRSETsetgridcell{#2}\!!counte#6}
-\def\OTRSETsetgridcells%
+\def\OTRSETsetgridcells
{\doOTRSETsetgridcells{\copy\placeholderboxb}}
\def\OTRSETerasegridcells#1#2#3#4%
@@ -182,9 +182,9 @@
\def\OTRSETsetfreecells#1#2% col start
{\global\columnfirstcell\ifnum#2=0 1\else#2\fi\relax
\ifnum\columnfirstcell>\columnmaxcells
- \global\columnfreecells0
- \global\columnfirstcell1
- \global\columnlastcell 0
+ \global\columnfreecells\zerocount
+ \global\columnfirstcell\plusone
+ \global\columnlastcell \zerocount
\global\somefreecolumncellsfalse
%\message{no cells a}%
\else
@@ -193,7 +193,7 @@
\exitloop
\else
\OTRSETdoifcellelse{#1}\columnfirstcell
- {\global\advance\columnfirstcell 1 }
+ {\global\advance\columnfirstcell\plusone}
{\exitloop}%
\fi}%
\global\columnlastcell\columnfirstcell
@@ -202,13 +202,13 @@
\exitloop
\else
\OTRSETdoifcellelse{#1}\columnlastcell
- {\global\advance\columnlastcell -1 \exitloop}
- {\global\advance\columnlastcell 1 }%
+ {\global\advance\columnlastcell \minusone \exitloop}
+ {\global\advance\columnlastcell \plusone }%
\fi}%
\ifnum\columnfirstcell>\columnmaxcells
- \global\columnfreecells0
- \global\columnfirstcell1
- \global\columnlastcell 0
+ \global\columnfreecells\zerocount
+ \global\columnfirstcell\plusone
+ \global\columnlastcell \zerocount
\global\somefreecolumncellsfalse
%\message{no cells b}%
\else
@@ -217,44 +217,44 @@
\fi
\global\columnfreecells\columnlastcell
\global\advance\columnfreecells -\columnfirstcell
- \global\advance\columnfreecells 1
+ \global\advance\columnfreecells \plusone
\global\somefreecolumncellstrue
%\message{\number\columnfirstcell-\number\columnlastcell=\number\columnfreecells}%
\fi
\fi}
\def\OTRSETgetmaxfreecells#1#2% col start
- {\scratchcounter0
- \edef\columnmaxfreecells{0}%
- \edef\columnfrmfreecells{0}%
- \dostepwiserecurse{#2}{\columnmaxcells}{1}
- {\OTRSETdoifcellelse{#1}{\recurselevel}
+ {\scratchcounter\zerocount
+ \let\columnmaxfreecells\!!zerocount
+ \let\columnfrmfreecells\!!zerocount
+ \dostepwiserecurse{#2}\columnmaxcells\plusone
+ {\OTRSETdoifcellelse{#1}\recurselevel
{\ifnum\columnmaxfreecells<\scratchcounter
\edef\columnmaxfreecells{\the\scratchcounter}%
\let\columnfrmfreecells\recurselevel
\fi
- \scratchcounter0 }
- {\advance\scratchcounter 1 }}}
+ \scratchcounter\zerocount}
+ {\advance\scratchcounter\plusone}}}
\long\def\OTRSETrecurseRL#1%
- {\dostepwiserecurse{\nofcolumns}{1}{-1}
+ {\dostepwiserecurse\nofcolumns\plusone\minusone
{#1\hskip\OTRSETgetparameter\c!afstand\recurselevel}}
-\def\OTRSETmakegridbox%
- {\ifcase\columndirection
- \OTRSETdomakegridbox{1}{\nofcolumns}{+1}%
+\def\OTRSETmakegridbox
+ {\ifcase\columndirection
+ \OTRSETdomakegridbox\plusone\nofcolumns\plusone
\else
- \OTRSETdomakegridbox{\nofcolumns}{1}{-1}%
+ \OTRSETdomakegridbox\nofcolumns\plusone\minusone
\fi}
-
+
\def\OTRSETdomakegridbox#1#2#3%
{\hbox\bgroup
- %
-\forgetall % can go once in flush
- \ifbalancecolumns
+ \dontcomplain
+ \forgetall % can go once in flush
+ \ifbalancecolumns
\ifnum\realpageno=\balancingpageno\relax
- \!!heighta \localcolumnmaxcells\lineheight
- \xdef\localcolumnmaxcells{0}%
+ \!!heighta \localcolumnmaxcells\lineheight
+ \global\let\localcolumnmaxcells\!!zerocount
\else
\!!heighta \teksthoogte
\fi
@@ -262,17 +262,17 @@
\!!heighta \teksthoogte
\fi
%
- % test first !
+ % test first !
\hbox to \zetbreedte
{\dostepwiserecurse{#1}{#2}{#3}
- {\mofcolumns=\recurselevel
- \localcolumnwidth=\OTRSETlocalwidth\mofcolumns
- \setbox\scratchbox=\hbox\localframed
+ {\mofcolumns\recurselevel
+ \localcolumnwidth\OTRSETlocalwidth\mofcolumns
+ \setbox\scratchbox\hbox\localframed
[\??mc\OTRSETidentifier\number\mofcolumns]%
- [\c!breedte=\localcolumnwidth,\c!hoogte=\!!heighta]% \teksthoogte]%
+ [\c!breedte=\localcolumnwidth,\c!hoogte=\!!heighta,\c!regels=]%
{}%
-\wd\scratchbox\localcolumnwidth
-\ht\scratchbox\!!heighta
+ \wd\scratchbox\localcolumnwidth
+ \ht\scratchbox\!!heighta
\ifcase\columndirection
\hskip\OTRSETgetparameter\c!afstand\recurselevel
\box\scratchbox
@@ -281,18 +281,18 @@
\hskip\OTRSETgetparameter\c!afstand\recurselevel
\fi}}%
\hskip-\zetbreedte
- % main text
+ % main text
\hbox to \zetbreedte
{\dostepwiserecurse{#1}{#2}{#3}
- {\mofcolumns=\recurselevel
- \localcolumnwidth=\OTRSETlocalwidth\mofcolumns
+ {\mofcolumns\recurselevel
+ \localcolumnwidth\OTRSETlocalwidth\mofcolumns
\offinterlineskip
- \setbox\scratchbox=\vbox to \!!heighta % \teksthoogte
+ \setbox\scratchbox\vbox to \!!heighta % \teksthoogte
{\topskipcorrection
- \dorecurse{\columnmaxcells}
- {\setbox\scratchbox=\hbox{\OTRSETgetgridcell\mofcolumns\recurselevel}%
- \ht\scratchbox=\ht\strutbox
- \dp\scratchbox=\dp\strutbox
+ \dorecurse\columnmaxcells
+ {\setbox\scratchbox\hbox{\OTRSETgetgridcell\mofcolumns\recurselevel}%
+ \ht\scratchbox\ht\strutbox
+ \dp\scratchbox\dp\strutbox
\ifcase\columndirection
\box\scratchbox
\else
@@ -300,7 +300,7 @@
{\hskip\localcolumnwidth\llap{\box\scratchbox}}%
\fi
\par}}%
- \wd\scratchbox=\localcolumnwidth % \tekstbreedte
+ \wd\scratchbox\localcolumnwidth % \tekstbreedte
\ifcase\columndirection
\hskip\OTRSETgetparameter\c!afstand\recurselevel\box\scratchbox
\else
@@ -308,28 +308,8 @@
\fi}}%
\egroup}
-\ifx\registerMPtextarea\undefined
- \let\registerMPtextarea\firstofoneargument
-\fi
-
-\def\OTRSETregistergridbox#1#2%
- {\bgroup
- \setbox\nextbox\null
- \wd\nextbox\wd#2%
- \ht\nextbox\ht#2%
- \dp\nextbox\dp#2%
- \setbox\nextbox\hbox{\lower\dp\strutbox\box\nextbox}%
- \ifnum#1=1
- \setbox\nextbox\hbox{\raise\topskip\hbox{\lower\ht\strutbox\box\nextbox}}%
- \dp\nextbox\dp\strutbox
- \fi
- \setbox\nextbox\hbox{\registerMPtextarea{\box\nextbox}}%
- \smashbox\nextbox
- \box\nextbox\box#2%
- \egroup}
-
-\def\OTRSETreducegridbox%
- {\ifnum\localcolumnmaxcells>0
+\def\OTRSETreducegridbox
+ {\ifnum\localcolumnmaxcells>\zerocount
\let\columnmaxcells\localcolumnmaxcells
\fi}
@@ -344,8 +324,8 @@
\ht\scratchbox\ht\strutbox
\dp\scratchbox\dp\strutbox
\OTRSETsetgridcell\nofcolumns\lastcolumnlastcell\box\scratchbox
- \fi
- \global\lastcolumnlastcell=0
+ \fi
+ \global\lastcolumnlastcell\zerocount
\fi}
%\def\OTRSETdoflush
@@ -354,25 +334,25 @@
% \else
% \OTRSETdofinalflush
% \OTRSETinitializecolumns
-% \OTRSETmanualbalance % or after \gotonextpage
+% \OTRSETmanualbalance % or after \startnextpage
% %\OTRSETdoflushfloats
-% \OTRSETgotonextpage
+% \OTRSETstartnextpage
% \fi}
\def\OTRSETdoflush
{\ifcollectingcontent
- \global\mofcolumns1
+ \global\mofcolumns\plusone
\else
- \OTRSETdofinalflush
+ \OTRSETdofinalflush
\OTRSETdofinaloutput
\OTRSETinitializecolumns
- \OTRSETmanualbalance % or after \gotonextpage
+ \OTRSETmanualbalance % or after \startnextpage
%\OTRSETdoflushfloats
- \OTRSETgotonextpage
+ \OTRSETstartnextpage
\initializecolumntextareas
\fi}
-%\def\OTRSETdofinalflush % see \OTRSETdoflush
+%\def\OTRSETdofinalflush % see \OTRSETdoflush
% {\OTRSETflushfinalfootnotes
% \placecolumntextareas
% \OTRSETcentergridcells
@@ -382,15 +362,15 @@
\newbox\OTRfinalpagebox
-\def\OTRSETdofinalflush % see \OTRSETdoflush
+\def\OTRSETdofinalflush % see \OTRSETdoflush
{\OTRSETflushfinalfootnotes
\placecolumntextareas
\OTRSETcentergridcells
- \bgroup % we want to keep the reduction local
+ \bgroup % we want to keep the reduction local
\OTRSETreducegridbox
\global\setbox\OTRfinalpagebox\OTRSETmakegridbox
- \egroup % otherwise we get the wrong number of free cells
- %\gdef\localcolumnmaxcells{0}% here ?
+ \egroup % otherwise we get the wrong number of free cells
+ %\gdef\localcolumnmaxcells{0}% here ?
\global\mofcolumns\nofcolumns} % otherwise problems in finaloutput
\def\OTRSETdofinaloutput
@@ -402,10 +382,10 @@
\appendtoks \OTRSETflushbalancinglist \to \everystoptext
-\def\OTRSETflushbalancinglist%
- {\scratchcounter0
+\def\OTRSETflushbalancinglist
+ {\scratchcounter\zerocount
\def\docommando##1%
- {\advance\scratchcounter 1
+ {\advance\scratchcounter \plusone
\immediatewriteutilitycommand
{\twopassentry{\s!colset}{\the\scratchcounter}{##1}}}%
\processcommacommand[\OTRSETbalancinglist]\docommando}
@@ -425,38 +405,39 @@
\def\OTRSETgetparameter#1#2{\getvalue{\??mc\OTRSETidentifier\number#2#1}}
\def\OTRSETsetparameter#1#2{\setvalue{\??mc\OTRSETidentifier\number#2#1}}
-\def\OTRSETsetvsize% snap per sectie (gap here?)
+\def\OTRSETsetvsize % snap per sectie (gap here?)
{\ifcollectingcontent \else % can be assigndimen
- \OTRSETcheckinsert % added
+ \OTRSETcheckinsert % added
\OTRSETsetfreecells\mofcolumns\columnfirstcell
\ifsomefreecolumncells
- \global\vsize=\columnfreecells\lineheight
- %\global\pagegoal=\vsize % niet nodig, tenzij binnen otr
- \dosynchronizeoutput
- \allowbreak % hm
+ \global\vsize\columnfreecells\lineheight
+ \global\pagegoal\vsize % niet nodig, tenzij binnen otr
+ \synchronizeoutput % fails on example
+ % \allowbreak % hm
\fi
\synchronizenotes
\fi}
-\def\OTRSETsethsize%
+\def\OTRSETsethsize
{%\OTRSETassignwidth\OTRSETidentifier\to\localcolumnwidth
- \localcolumnwidth=\OTRSETlocalwidth\mofcolumns
+ \localcolumnwidth\OTRSETlocalwidth\mofcolumns
\tekstbreedte\localcolumnwidth
\hsize\localcolumnwidth}
-\def\OTRSETcheckfreelines%
+\def\OTRSETcheckfreelines
{\OTRSETsetvsize}
-\def\doOTRSETcolumnseparator%
+\def\doOTRSETcolumnseparator
{\hbox to \zeropoint{\hss\red\vl\hss}}
\let\OTRSETcolumnseparator\relax
-\def\showbreaks%
+\def\showbreaks
{\let\OTRSETcolumnseparator\doOTRSETcolumnseparator}
-\def\OTRSETnextcolumn%
- {\ifhmode
+\installcolumnbreakhandler {SET} \v!ja
+ {% hmmm:
+ \ifhmode
\bgroup
\removeunwantedspaces
\parfillskip\zeropoint
@@ -464,34 +445,114 @@
\par
\egroup
\fi
- \page\relax % hack. \page should be page
-}% \OTRSETsethsize} % no, can be mid smaller (like tabulate)
+ % brrr:
+ \ejectinsert
+ \ejectpage} % no \OTRSETsethsize, can be mid smaller (like tabulate)
+
+% \installcolumnbreakhandler {SET} \v!forceer
+% {\OTRSETgotocolumn[\v!forceer]}
+% \installcolumnbreakhandler {SET} \v!eerste
+% {\OTRSETgotocolumn[\v!eerste]}
+% \installcolumnbreakhandler {SET} \v!laatste
+% {\OTRSETgotocolumn[\v!laatste]}
+
+\installcolumnbreakhandler {SET} \s!unknown
+ {\expanded{\OTRSETgotocolumn[\@@columnspecification]}}
+
+% \installcolumnbreakhandler {SET} \v!pagina
+% {\simplepagebreak % \flushnotes \executepagebreakhandler\v!ja
+% \ifnum\mofcolumns>\plusone
+% \OTRSETgotocolumn[\v!laatste,\v!forceer]%
+% \fi}
+
+\installcolumnbreakhandler {SET} \v!pagina
+ {\vfill\eject % \doejectpage\eject
+ \OTRSETgotonextpage}
\newtoks\OTRSETeverystartofcolumn
\newbox\OTRSETsavedfootnotes
-% \installoutput\OTRSETflushtextsofar goes wrong
+% \installoutput\OTRSETflushtextsofar % spacing goes wrong
+
+%\def\OTRSETflushtextsofar
+% {\ifvoid\normalpagebox \else
+% \setbox\scratchbox\vbox{\unvbox\normalpagebox}%
+% \OTRSETsavenotes
+% \OTRSEThandleflushedtext0
+% \fi}
+
+% The complication is in the fact that when the HERE float
+% is placed, the otr is not invoked when there is not yet
+% enough content; this can lead to a change in order (turning
+% on the tracer with option 0 is very instructive, watch the
+% small numbers in the margin)
+%
+% 0 = no flushing, so no interference but user should handle
+% border cases of placement
+% 1 = the normal otr, rather untested
+% 2 = a solution that works ok, is experimental and above
+% all messy
+
+\chardef\OTRSETflushtextmode=0
\def\OTRSETflushtextsofar
- {\ifvoid\normalpagebox \else
- \setbox\scratchbox=\vbox{\unvbox\normalpagebox}%
+ {\ifcase\OTRSETflushtextmode
+ % don't mess around
+ \or
+ % the normal one
+ \ifvoid\normalpagebox\else
+ \OTRSETnaturalflush
+ \OTRSETcheckfreelines
+ \fi
+ \or
+ % way to complicated, but kind of ok
+ \doOTRSETflushtextsofar
+ \fi}
+
+\newskip\lastskipinotr
+
+\installoutput\doOTRSETflushtextsofar % experimental
+ {\ifvoid\normalpagebox\else
+ \scratchdimen\dp\normalpagebox
+ \setbox\scratchbox\vbox
+ {\forgetall
+ \unvbox\normalpagebox
+ \global\lastskipinotr\lastskip\relax
+ \ifdim\lastskipinotr>\zeropoint\relax
+ \removelastskip
+ \else
+ \kern-\scratchdimen % handle depth
+ \fi}%
+ \ifdim\lastskipinotr>\zeropoint
+ \scratchskip\ht\scratchbox
+ \setbox\scratchbox\hbox
+ {\lower\strutdepth\box\scratchbox}%
+ \dp\scratchbox\scratchdimen
+ \ht\scratchbox\scratchskip
+ \fi
\OTRSETsavenotes
\OTRSEThandleflushedtext0
+ \ifdim\lastskipinotr>\zeropoint
+ %\vskip \lastskipinotr % hm, gets lost anyway
+ \else
+ % we should not discard skips after here; tricky
+ \fi
+ \OTRSETsetvsize
\fi}
\def\OTRSETplacebottomnotes
{\iflastcolumnfootnotes
- \ifnum\nofcolumns=\mofcolumns
+ \ifnum\nofcolumns=\mofcolumns
\ifintermediatefootnotes \placebottomnotes \fi
\fi
\else
- \placebottomnotes
+ \placebottomnotes
\fi}
\def\OTRSETflushsavednotes
{\iflastcolumnfootnotes
- \ifnum\nofcolumns=\mofcolumns
+ \ifnum\nofcolumns=\mofcolumns
\flushsavednotes
\fi
\else
@@ -507,89 +568,92 @@
\appendtoks \OTRSETflushsavednotes \to \OTRSETeverystartofcolumn
-\def\OTRSETnaturalflush%
- {\setbox0=\vbox to \columnfreecells\lineheight
+\def\OTRSETnaturalflush
+ {\bgroup
+ \forgetall % new, needed !
+ \setbox0\vbox to \columnfreecells\lineheight
{\vskip-\topskip
\vskip\lineheight
\prevdepth\dp\strutbox
\unvbox\normalpagebox
\vfill}%
- \setbox2=\hbox
+ \setbox2\hbox
{\OTRSETplacebottomnotes}%
- \setbox\scratchbox=\hbox
- {\wd0=\zeropoint\box0\box2}%
- \dp\scratchbox=\dp\strutbox
- \OTRSEThandleflushedtext1}
+ \setbox\scratchbox\hbox
+ {\wd0\zeropoint\box0\box2}%
+ \dp\scratchbox\dp\strutbox
+ \OTRSEThandleflushedtext1
+ \egroup}
\newcount\lastcolumnlastcell
\def\OTRSEThandleflushedtext#1%
{\getnoflines{\ht\scratchbox}%
- \wd\scratchbox=\tekstbreedte % geen \hsize kan < zijn in bv split tabulate
+ %\wd\scratchbox\tekstbreedte % geen \hsize kan < zijn in bv split tabulate
+ \wd\scratchbox\OTRSETlocalwidth\mofcolumns
\doOTRSETsetgridcells
{\copy\placeholderboxf}
- {\mofcolumns}{\columnfirstcell}{1}{\noflines}
- %{\copy\scratchbox}% \box
- {\hbox{\OTRSETregistergridbox\columnfirstcell\scratchbox}}%
- \global\columnlastcell=\columnfirstcell
+ \mofcolumns\columnfirstcell\plusone\noflines
+ {\registeredtextarea1\columnfirstcell\scratchbox}% == \hbox
+ \global\columnlastcell\columnfirstcell
\global\advance\columnlastcell \noflines
-\global\lastcolumnlastcell\columnlastcell
-\global\advance\lastcolumnlastcell -1
- % find next (acceptable) gap, todo: deadcycle
-\ifcase#1\else
- \OTRSETfillgapsbetweencells\mofcolumns\columnlastcell
-\fi
+ \global\lastcolumnlastcell\columnlastcell
+ \global\advance\lastcolumnlastcell \minusone
+ % find next (acceptable) gap, todo: deadcycle
+ \ifcase#1\else
+ \OTRSETfillgapsbetweencells\mofcolumns\columnlastcell
+ \fi
\OTRSETfindnextgap
- %\message{\the\mofcolumns,\the\columnfirstcell,\the\columnfreecells}\wait
-% \OTRSETsethsize % no, can be mid smaller (like tabulate)
+ % \message{\the\mofcolumns,\the\columnfirstcell,\the\columnfreecells}\wait
+ % \OTRSETsethsize % no, can be mid smaller (like tabulate)
\OTRSETsetvsize}
-\def\OTRSETfindnextgap%
+\def\OTRSETfindnextgap
{\OTRSETsetfreecells\mofcolumns\columnlastcell
\ifsomefreecolumncells
- % okay
+ % okay
\else
- \global\advance\mofcolumns 1 \relax
+ \global\advance\mofcolumns \plusone
\ifnum\mofcolumns>\nofcolumns
\OTRSETdoflush
- \global\columnlastcell=1
- \global\columnfirstcell=0
+ \global\columnlastcell\plusone
+ \global\columnfirstcell\zerocount
\OTRSETdoflushfloats
\else
\the\OTRSETeverystartofcolumn
- \global\columnlastcell=1
- \global\columnfirstcell=0
+ \global\columnlastcell\plusone
+ \global\columnfirstcell\zerocount
\fi
\fi}
\def\OTRSETcheckfreelines{}
\def\OTRSETfillgapsbetweencells#1#2% col
- {\ifnum\columngaplimit>0
+ {\ifnum\columngaplimit>\zerocount
\donefalse
- \dostepwiserecurse{#2}{\columnmaxcells}{1}
- {\OTRSETdoifcellelse{#1}{\recurselevel}
+ \dostepwiserecurse{#2}\columnmaxcells\plusone
+ {\OTRSETdoifcellelse{#1}\recurselevel
{\ifdone
- \!!countb=\recurselevel \advance\!!countb -\!!counta\relax
- \ifnum\!!countb>1
- \advance\!!countb -1
+ \!!countb\recurselevel \advance\!!countb -\!!counta\relax
+ \ifnum\!!countb>\plusone
+ \advance\!!countb \minusone
\ifnum\!!countb<\columngaplimit\relax
- \!!countb=\recurselevel \advance\!!countb -1
- \dostepwiserecurse{\!!counta}{\!!countb}{1}
+ \!!countb\recurselevel \advance\!!countb \minusone
+ \dostepwiserecurse\!!counta\!!countb\plusone
{\OTRSETsetgridcell{#1}\recurselevel\copy\placeholderboxc}%
%\message{[gap]}%
- \fi
+ \fi
\fi
\fi
\donefalse}
{\ifdone \else
\donetrue
- \!!counta=\recurselevel
+ \!!counta\recurselevel
\fi}}%
\fi}
\appendtoks
- \OTRSETfillgapsbetweencells\mofcolumns1
+ \OTRSETfillgapsbetweencells\mofcolumns\plusone
\to \OTRSETeverystartofcolumn
%\def\OTRSETfreezeminimumgap#1%
@@ -623,25 +687,44 @@
% {\OTRSETfillgaps{#1}{1}{#2}}
\newif\ifspancolumnslots \spancolumnslotstrue
+\newif\ifcheckcolumnspan \checkcolumnspantrue
+
+\def\OTRSETcheckwidthgap#1#2% box size
+ {\ifcheckcolumnspan
+ \bgroup
+ \scratchdimen#2%
+ \advance\scratchdimen-\wd#1\relax
+ \ifdim-10\s!sp>\scratchdimen
+ \egroup
+ \else\ifdim10\s!sp<\scratchdimen
+ \egroup
+ \else
+ \egroup
+ \wd#1=#2%
+ \fi\fi
+ \fi}
\def\OTRSETcheckcolumnslot#1%
{\enoughcolumncellstrue
- \ifspancolumnslots \else \ifdim\wd#1>\hsize
- \enoughcolumncellsfalse
- \fi \fi
+ \ifspancolumnslots\else
+ \OTRSETcheckwidthgap#1\hsize
+ \ifdim\wd#1>\hsize
+ \enoughcolumncellsfalse
+ \fi
+ \fi
\ifenoughcolumncells
\getnoflines\pagetotal
- \scratchcounter=\noflines
+ \scratchcounter\noflines
\getnoflines{\ht#1}%
- \columnvcells=\noflines
- \columnhcells=1
+ \columnvcells\noflines
+ \columnhcells\plusone
\advance\scratchcounter \columnvcells \relax
\ifnum\scratchcounter>\columnfreecells
\enoughcolumncellsfalse
\fi
\fi}
-\def\OTRSETstoreincolumnslotPAGE#1%
+\def\OTRSETstoreincolumnslotPAGE#1%
{\ifenoughcolumncells
% to do
\OTRSETsavebox{#1}%
@@ -649,7 +732,7 @@
\OTRSETsavebox{#1}%
\fi}
-\def\OTRSETstoreincolumnslotTOPS#1%
+\def\OTRSETstoreincolumnslotTOPS#1%
{\OTRSETprepareforcolumnslot1{#1}%
\OTRSETcheckcolumnslot{#1}%
\ifenoughcolumncells
@@ -663,22 +746,22 @@
\OTRSETsavebox{#1}%
\fi}
-\def\OTRSETstoreincolumnslotBOTS#1%
+\def\OTRSETstoreincolumnslotBOTS#1%
{\OTRSETprepareforcolumnslot3{#1}%
\edef\savedcolumnlastcell{\the\columnlastcell}%
\OTRSETcheckcolumnslot{#1}%
\ifenoughcolumncells
- \advance\columnlastcell -\columnvcells \advance\columnlastcell 1
+ \advance\columnlastcell -\columnvcells \advance\columnlastcell \plusone
% \OTRSETcheckcolumnspace\mofcolumns\columnfirstcell{#1}%
\OTRSETcheckcolumnspace\mofcolumns\columnlastcell{#1}%
\fi
\ifenoughcolumncells
\OTRSETsetgridcells\mofcolumns\columnlastcell\columnhcells\columnvcells
{\copy#1}
- \OTRSETfillgapsbetweencells\mofcolumns\savedcolumnlastcell % -)
+ \OTRSETfillgapsbetweencells\mofcolumns\savedcolumnlastcell % -)
\OTRSETsetvsize
\else
- \columnlastcell=\savedcolumnlastcell
+ \columnlastcell\savedcolumnlastcell
\OTRSETsavebox{#1}%
\fi}
@@ -688,20 +771,20 @@
\def\columnspacebotoffset{0}
\def\OTRSETcheckcolumnspace#1#2#3% col row box
- {\columnhcells=1
- \totalcolumnspace=\zeropoint
- \scratchcounter=#1%
+ {\columnhcells\plusone
+ \totalcolumnspace\zeropoint
+ \scratchcounter#1%
\enoughcolumncellstrue
\doloop
-% {\advance\totalcolumnspace \hsize
{\advance\totalcolumnspace \OTRSETlocalwidth\scratchcounter\relax % needed
+\OTRSETcheckwidthgap#3\totalcolumnspace
\ifnum\wd#3>\totalcolumnspace\relax
\ifnum\scratchcounter=\nofcolumns
\enoughcolumncellsfalse
\exitloop
\else
- \advance\columnhcells 1
- \advance\scratchcounter 1
+ \advance\columnhcells \plusone
+ \advance\scratchcounter \plusone
\advance\totalcolumnspace \OTRSETgetparameter\c!afstand\scratchcounter
\fi
\else
@@ -709,50 +792,50 @@
\fi}%
\ifenoughcolumncells
\getnoflines{\ht#3}%
- \columnvcells=\noflines
+ \columnvcells\noflines
\OTRSETcheckcolumncells{#1}{#2}\columnhcells\columnvcells
\fi}
\def\OTRSETcheckcolumncells#1#2#3#4% col row wid hei
- {\!!countd=#1\advance\!!countd#3\advance\!!countd-1\relax
- \!!counte=#2\advance\!!counte#4\advance\!!counte-1\relax
+ {\!!countd#1\advance\!!countd#3\advance\!!countd\minusone
+ \!!counte#2\advance\!!counte#4\advance\!!counte\minusone
\ifnum\!!counte>\columnmaxcells\relax
\enoughcolumncellsfalse
\else
\enoughcolumncellstrue
-%\def\columnspacetopoffset{0}%
-%\scratchcounter=#2\advance\scratchcounter-1\relax
-%\ifnum\scratchcounter>0
-% \dostepwiserecurse{#1}{\!!countd}{1}
+%\let\columnspacetopoffset\zerocount
+%\scratchcounter#2\advance\scratchcounter\minusone
+%\ifnum\scratchcounter>0
+% \dostepwiserecurse{#1}\!!countd\plusone
% {\ifdim\wd\OTRSETgridcell\recurselevel\scratchcounter>\zeropoint
-% \def\columnspacetopoffset{1}%
+% \let\columnspacetopoffset\plusone
% \else\ifdim\dp\OTRSETgridcell\recurselevel\scratchcounter>\zeropoint
-% \def\columnspacetopoffset{1}%
-% \fi\fi}%
+% \let\columnspacetopoffset\plusone
+% \fi\fi}%
% \advance\!!counte \columnspacetopoffset \relax
% \advance\columnvcells \columnspacetopoffset \relax
%\fi
-%\def\columnspacebotoffset{0}%
-%\scratchcounter=\!!counte
+%\let\columnspacebotoffset\zerocount
+%\scratchcounter\!!counte
%\advance\scratchcounter \columnvcells \relax
%\ifnum\scratchcounter>\columnmaxcells\else
-% \dostepwiserecurse{#1}{\!!countd}{1}
+% \dostepwiserecurse{#1}\!!countd\plusone
% {\ifdim\wd\OTRSETgridcell\recurselevel\scratchcounter>\zeropoint
-% \def\columnspacebotoffset{1}%
+% \let\columnspacebotoffset\plusone
% \else\ifdim\dp\OTRSETgridcell\recurselevel\scratchcounter>\zeropoint
-% \def\columnspacebotoffset{1}%
-% \fi\fi}%
+% \let\columnspacebotoffset\plusone
+% \fi\fi}%
% \advance\!!counte \columnspacebotoffset \relax
% \advance\columnvcells \columnspacebotoffset \relax
%\fi
- \dostepwiserecurse{#1}{\!!countd}{1} % cols
+ \dostepwiserecurse{#1}\!!countd\plusone % cols
{\ifenoughcolumncells
- \!!countf=\recurselevel\relax
- \dostepwiserecurse{#2}{\!!counte}{1} % rows
+ \!!countf\recurselevel\relax
+ \dostepwiserecurse{#2}\!!counte\plusone % rows
{\ifenoughcolumncells
\OTRSETdoifcellelse\!!countf\recurselevel
{\enoughcolumncellsfalse}{}%
- \fi}%
+ \fi}%
\fi}%
\fi}
@@ -760,7 +843,7 @@
{\doifsomething{#1}{\edef\preferedcolumn{#1}}%
\doifsomething{#2}{\edef\preferedrow {#2}}}
-\OTRSETsetpreferedcolumnslot{\nofcolumns}{1} % default ?
+\OTRSETsetpreferedcolumnslot{\nofcolumns}{1} % default ?
\let\pofcolumns\mofcolumns
\let\qofcolumns\mofcolumns
@@ -769,77 +852,109 @@
\def\OTRSETstoreincolumnslotLRTB#1%
{\OTRSETprepareforcolumnslot1{#1}%
+\OTRSETflushtextsofar
\OTRSETstoreincolumnslotindeed
\mofcolumns\nofcolumns+\currenthcell
- 1\columnmaxcells+\currentvcell{#1}}
+ \plusone\columnmaxcells+\currentvcell{#1}}
\def\OTRSETstoreincolumnslotLRBT#1%
{\OTRSETprepareforcolumnslot3{#1}%
+\OTRSETflushtextsofar
\OTRSETstoreincolumnslotindeed
\mofcolumns\nofcolumns+\currenthcell
- \columnmaxcells1-\currentvcell{#1}}
+ \columnmaxcells\plusone-\currentvcell{#1}}
\def\OTRSETstoreincolumnslotRLTB#1%
{\OTRSETprepareforcolumnslot1{#1}%
+\OTRSETflushtextsofar
\OTRSETstoreincolumnslotindeed
\nofcolumns\qofcolumns-\currenthcell
- 1\columnmaxcells+\currentvcell{#1}}
+ \plusone\columnmaxcells+\currentvcell{#1}}
\def\OTRSETstoreincolumnslotRLBT#1%
{\OTRSETprepareforcolumnslot3{#1}%
+\OTRSETflushtextsofar
\OTRSETstoreincolumnslotindeed
\nofcolumns\qofcolumns-\currenthcell
- \columnmaxcells1-\currentvcell{#1}}
+ \columnmaxcells\plusone-\currentvcell{#1}}
\def\OTRSETstoreincolumnslotTBLR#1%
{\OTRSETprepareforcolumnslot1{#1}%
+\OTRSETflushtextsofar
\OTRSETstoreincolumnslotindeed
- 1\columnmaxcells+\currentvcell
+ \plusone\columnmaxcells+\currentvcell
\mofcolumns\nofcolumns+\currenthcell{#1}}
\def\OTRSETstoreincolumnslotTBRL#1%
{\OTRSETprepareforcolumnslot1{#1}%
+\OTRSETflushtextsofar
\OTRSETstoreincolumnslotindeed
- 1\columnmaxcells+\currentvcell
+ \plusone\columnmaxcells+\currentvcell
\nofcolumns\qofcolumns-\currenthcell{#1}}
\def\OTRSETstoreincolumnslotBTLR#1%
{\OTRSETprepareforcolumnslot3{#1}%
+\OTRSETflushtextsofar
\OTRSETstoreincolumnslotindeed
- \columnmaxcells1-\currentvcell
+ \columnmaxcells\plusone-\currentvcell
\mofcolumns\nofcolumns+\currenthcell{#1}}
\def\OTRSETstoreincolumnslotBTRL#1%
{\OTRSETprepareforcolumnslot3{#1}%
+\OTRSETflushtextsofar
\OTRSETstoreincolumnslotindeed
- \columnmaxcells1-\currentvcell
+ \columnmaxcells\plusone-\currentvcell
\nofcolumns\qofcolumns-\currenthcell{#1}}
\def\OTRSETstoreincolumnslotFXTB#1% fixed column
- {\OTRSETprepareforcolumnslot2{#1}% % 1/2 dependent of place, todo
+ {\OTRSETprepareforcolumnslot2{#1}% % 1/2 dependent of place, todo
+\OTRSETflushtextsofar
\OTRSETstoreincolumnslotindeed
- \pofcolumns\pofcolumns
- +\currenthcell\preferedrow
- \columnmaxcells+\currentvcell{#1}}
+ \pofcolumns\pofcolumns+\currenthcell
+ \preferedrow\columnmaxcells+\currentvcell{#1}}
\def\OTRSETstoreincolumnslotFXBT#1% fixed column
- {\OTRSETprepareforcolumnslot2{#1}% % 3/2 dependent on place, todo
+ {\OTRSETprepareforcolumnslot2{#1}% % 3/2 dependent on place, todo
+\OTRSETflushtextsofar
\OTRSETstoreincolumnslotindeed
\pofcolumns\pofcolumns+\currenthcell
\columnmaxcells\preferedrow-\currentvcell{#1}}
+% \def\OTRSETstoreincolumnslotHERE#1% fixed column
+% {\OTRSETprepareforcolumnslot2{#1}%
+% \OTRSETflushtextsofar
+% \getnoflines\pagetotal \advance\noflines\columnfirstcell
+% \OTRSETstoreincolumnslotindeed
+% \mofcolumns\mofcolumns+\currenthcell
+% \noflines\columnmaxcells+\currentvcell{#1}%
+% \OTRSETsetvsize}
+
+\chardef\OTRSETforcefixedfloats=0
+
\def\OTRSETstoreincolumnslotHERE#1% fixed column
+ {\ifcase\OTRSETforcefixedfloats
+ \OTRSETstoreincolumnslotSOMEWHERE2{#1}%
+ \else
+ \OTRSETstoreincolumnslotFIXD{#1}%
+ \fi}
+
+\def\OTRSETstoreincolumnslotFIXD#1% fixed column
{\OTRSETprepareforcolumnslot2{#1}%
- \OTRSETflushtextsofar
+ % no flush text sofar here
+ \snaptogrid\vbox{\box#1}}
+
+\def\OTRSETstoreincolumnslotSOMEWHERE#1#2%
+ {\OTRSETprepareforcolumnslot{#1}{#2}%
+ \OTRSETflushtextsofar
\getnoflines\pagetotal \advance\noflines\columnfirstcell
\OTRSETstoreincolumnslotindeed
\mofcolumns\mofcolumns+\currenthcell
- \noflines\columnmaxcells+\currentvcell{#1}%
+ \noflines\columnmaxcells+\currentvcell{#2}%
\OTRSETsetvsize}
\def\OTRSETstoreincolumnslotindeed#1#2#3#4#5#6#7#8#9%
- {\OTRSETflushtextsofar
- \ifnum\preferedcolumn<\mofcolumns
+ {%\OTRSETflushtextsofar
+ \ifnum\preferedcolumn<\mofcolumns
\let\pofcolumns\mofcolumns
\else
\let\pofcolumns\preferedcolumn
@@ -848,8 +963,8 @@
\ifnum\mofcolumns=\nofcolumns
\def\qofcolumns{\mofcolumns}%
\else
- \scratchcounter\mofcolumns
- \advance\scratchcounter 1
+ \scratchcounter\mofcolumns
+ \advance\scratchcounter \plusone
\edef\qofcolumns{\the\scratchcounter}%
\fi
\else
@@ -858,10 +973,14 @@
\enoughcolumncellsfalse
\donefalse
\dostepwiserecurse{#1}{#2}{#31}
- {\ifdone\else
+ {\ifdone
+ \exitloop
+ \else
#4=\recurselevel
\dostepwiserecurse{#5}{#6}{#71}
- {\ifdone\else
+ {\ifdone
+ \exitloop
+ \else
#8=\recurselevel
\OTRSETcheckcolumnspace\currenthcell\currentvcell{#9}%
\ifenoughcolumncells \donetrue \fi
@@ -886,8 +1005,7 @@
\ifdim\ht\OTRSETsavedfootnotes>\zeropoint
\OTRSETsetfreecells\mofcolumns\columnfirstcell
\ifsomefreecolumncells
- \getnoflines{\ht\OTRSETsavedfootnotes}%
-\relax
+ \getnoflines{\ht\OTRSETsavedfootnotes}\relax
\ifnum\columnfreecells<\noflines
\global\somefreecolumncellsfalse
\else
@@ -897,7 +1015,7 @@
\ifsomefreecolumncells
% ok, enough room for notes
%\message{[flt]}% float
- \else % ?
+ \else % ?
\OTRSETsavebox{#9}%
\OTRSETerasegridcells\currenthcell\currentvcell\columnhcells\columnvcells
%\message{[clr]}% save box
@@ -915,33 +1033,24 @@
\OTRSETsavebox{#9}%
\fi}
-% \def\columnslotspacing{2}
-%
-% \def\OTRSETstoreincolumnslot#1#2% {method} {box} % alleen last
-% {\dp#2=\zeropoint
-% \ifcase\columnslotspacing\else
-% \setbox#2=\vbox spread \columnslotspacing\lineheight
-% {\vss\box#2\vss}%
-% \fi
-% %\dp#2=\zeropoint
-% \doifdefinedelse{\strippedcsname\OTRSETstoreincolumnslot#1}
-% {\getvalue{\strippedcsname\OTRSETstoreincolumnslot#1}{#2}}
-% {\copy#2}}
-
-\def\columnslotspacing{1}
-
-\def\OTRSETstoreincolumnslot#1#2% {method} {box} % alleen last
- {%\dp#2=\zeropoint
- %\ifcase\columnslotspacing\else
- % \setbox#2=\vbox spread \columnslotspacing\lineheight
- % {\vss\box#2\vss}%
- %\fi
- \doifdefinedelse{\strippedcsname\OTRSETstoreincolumnslot#1}
- {\getvalue{\strippedcsname\OTRSETstoreincolumnslot#1}{#2}}
- {\OTRSETstoreincolumnsloUNKNOWN{#1}}}
-
-\def\OTRSETstoreincolumnsloUNKNOWN#1%
- {\OTRSETprepareforcolumnslot2{#1}\copy#1}
+\chardef\columnslotspacing \plusone
+
+\def\OTRSETstoreincolumnslot#1% #2 % {method} {box} % alleen last
+ {% no messing around here
+ % \dp#2=\zeropoint
+ % \ifcase\columnslotspacing\else
+ % \setbox#2=\vbox spread \columnslotspacing\lineheight
+ % {\vss\box#2\vss}%
+ % \fi
+ % and don't change this any more
+% \doifdefinedelse{\strippedcsname\OTRSETstoreincolumnslot#1}
+% {\getvalue{\strippedcsname\OTRSETstoreincolumnslot#1}{#2}}
+% {\OTRSETstoreincolumnslotUNKNOWN{#2}}}
+ \executeifdefined{\strippedcsname\OTRSETstoreincolumnslot#1}
+ \OTRSETstoreincolumnslotUNKNOWN} % {#2}}
+
+\def\OTRSETstoreincolumnslotUNKNOWN#1%
+ {\OTRSETprepareforcolumnslot2{#1}\copy#1} % {} ?
\def\OTRSETprepareforcolumnslot#1#2% 1=hoog 2=midden 3=laag
{\dp#2\zeropoint
@@ -949,34 +1058,26 @@
\scratchdimen\columnslotspacing\lineheight
\ifnum#1=2 \scratchdimen2\scratchdimen \fi
\setbox#2\vbox spread \scratchdimen
- {\ifnum#1>1\vss\fi\box#2\ifnum#1<3\vss\fi}%
+ {\ifnum#1>1\vss\fi\box#2\relax\ifnum#1<3\vss\fi}%
\fi}
\def\OTRSETdocheckiffloatfits % eigenlijk moet else float anders
- {\ifnofloatpermitted
- \global\roomforfloatfalse
- \else
- \global\roomforfloattrue
- \fi}
-
-%\def\OTRSETsavebox#1%
-% {\setbox\floatbox=\box#1\dosavefloat}
+ {\global\ifnofloatpermitted\roomforfloatfalse\else\roomforfloattrue\fi}
-\def\OTRSETsavebox#1% clean up the skips
- {\ifhbox#1% spans and so
- \global\setbox\floatbox=\vbox{\box#1}%
+\def\OTRSETsavebox#1% clean up the skips
+ {\ifhbox#1% spans and so
+ \global\setbox\floatbox\vbox{\box#1}%
\else
- \setbox\scratchbox=\vbox
+ \setbox\scratchbox\vbox
{\unvbox#1\unskip\unskip\unskip
- \global\setbox\floatbox\lastbox
- }%\unskip\unskip\unskip\box\floatbox}%
+ \global\setbox\floatbox\lastbox}%
\fi
\dosavefloat}
-\def\OTRSETflushfloatbox% nog verder doorvoeren en meer info in marge
+\def\OTRSETflushfloatbox % nog verder doorvoeren en meer info in marge
{\iftestfloatbox\ruledhbox\fi{\box\floatbox}}
-\def\OTRSETdoflushfloats%
+\def\OTRSETdoflushfloats
{\bgroup
\def\OTRSETsavebox##1{\!!doneafalse}%
\doloop
@@ -984,8 +1085,8 @@
\dogetfloat
\ifdim\wd\floatbox>\zeropoint
\!!doneatrue
- \dp\floatbox=\zeropoint
- \OTRSETstoreincolumnslot{TBLR}\floatbox
+ \dp\floatbox\zeropoint
+ \OTRSETstoreincolumnslot{TBLR}\floatbox
\if!!donea
%\message{[flu]}%
\else
@@ -1005,65 +1106,65 @@
\newif\ifcentergridcellonly \centergridcellonlyfalse
\newif\ifautocentergridcellonly \autocentergridcellonlytrue
-\def\OTRSETcentergridcells%
+\def\OTRSETcentergridcells
{\ifcentergridcells
- \dorecurse{\nofcolumns}
- {\currenthcell=\recurselevel
-\ifautocentergridcellonly
- % we prevent centering when the next column is empty
- % to be checked ! ! ! !
- \advance\currenthcell 1
- \centergridcellonlytrue
- \ifnum\currenthcell>\nofcolumns
- % ok already
- \else
- % only span if there is a next column with content
- \dorecurse{\columnmaxcells}
- {\ifdim\ht\OTRSETgridcell\currenthcell\currentvcell>\zeropoint
- \centergridcellonlyfalse
- \else\ifdim\dp\OTRSETgridcell\currenthcell\currentvcell>\zeropoint
- \centergridcellonlyfalse
- \fi\fi}%
- \fi
-\fi
- \currenthcell=\recurselevel
- \dorecurse{\columnmaxcells}
- {\currentvcell=\recurselevel\relax
+ \dorecurse\nofcolumns
+ {\currenthcell\recurselevel
+ \ifautocentergridcellonly
+ % we prevent centering when the next column is empty
+ % to be checked ! ! ! !
+ \advance\currenthcell \plusone
+ \centergridcellonlytrue
+ \ifnum\currenthcell>\nofcolumns
+ % ok already
+ \else
+ % only span if there is a next column with content
+ \dorecurse\columnmaxcells
+ {\ifdim\ht\OTRSETgridcell\currenthcell\currentvcell>\zeropoint
+ \centergridcellonlyfalse
+ \else\ifdim\dp\OTRSETgridcell\currenthcell\currentvcell>\zeropoint
+ \centergridcellonlyfalse
+ \fi\fi}%
+ \fi
+ \fi
+ \currenthcell\recurselevel
+ \dorecurse\columnmaxcells
+ {\currentvcell\recurselevel\relax
\ifdim\ht\OTRSETgridcell\currenthcell\currentvcell>\zeropoint
\ifdim\dp\OTRSETgridcell\currenthcell\currentvcell=\zeropoint
\bgroup
- \setbox\scratchbox=\OTRSETgetgridcell\currenthcell\currentvcell
+ \setbox\scratchbox\OTRSETgetgridcell\currenthcell\currentvcell
\getnoflines{\ht\scratchbox}%
- \!!counta=\currentvcell
+ \!!counta\currentvcell
\advance\!!counta -\noflines
- \advance\!!counta 1
- % first col always ok
- \!!countb=\currenthcell
- \!!countc=\currenthcell \advance\!!countc 1
+ \advance\!!counta \plusone
+ % first col always ok
+ \!!countb\currenthcell
+ \!!countc\currenthcell
+ \advance\!!countc \plusone
\!!donebtrue
-\ifcentergridcellonly \!!countc=\maxdimen \fi
- \dostepwiserecurse{\!!countc}{\nofcolumns}{1}
+ \ifcentergridcellonly
+ \!!countc\maxdimen
+ \fi
+ \dostepwiserecurse\!!countc\nofcolumns\plusone
{\if!!doneb
\let\xrecurselevel\recurselevel
- \dostepwiserecurse{\!!counta}{\currentvcell}{1}
+ \dostepwiserecurse\!!counta\currentvcell\plusone
{\ifdim\ht\OTRSETgridcell\xrecurselevel\recurselevel>\zeropoint
\!!donebfalse
\else\ifdim\wd\OTRSETgridcell\xrecurselevel\recurselevel>\zeropoint
\!!donebfalse
\fi\fi}%
\if!!doneb
- \!!countb=\xrecurselevel
+ \!!countb\xrecurselevel
\fi
\fi}%
-% \totalcolumnspace=\hsize
-\totalcolumnspace=\OTRSETlocalwidth\currenthcell
- \dostepwiserecurse{\!!countc}{\!!countb}{1}
-% {\advance\totalcolumnspace \hsize\relax
-{\advance\totalcolumnspace \OTRSETlocalwidth\recurselevel
+ \totalcolumnspace\OTRSETlocalwidth\currenthcell
+ \dostepwiserecurse\!!countc\!!countb\plusone
+ {\advance\totalcolumnspace \OTRSETlocalwidth\recurselevel
\advance\totalcolumnspace \OTRSETgetparameter\c!afstand\recurselevel}%
\ifdim\totalcolumnspace>\wd\scratchbox
- \setbox\scratchbox=\hbox to \totalcolumnspace{\hss\box\scratchbox\hss}%
- % \wd\scratchbox=\hsize
+ \setbox\scratchbox\hbox to \totalcolumnspace{\hss\box\scratchbox\hss}%
\fi
\OTRSETsetgridcell\currenthcell\currentvcell\box\scratchbox
\egroup
@@ -1071,31 +1172,31 @@
\fi}}%
\fi}
-\def\OTRSETinitializecolumns% once per page
+\def\OTRSETinitializecolumns% once per page
{\columnspreadtrue % todo
\ifcolumnspread
- \global\rofcolumns=\getvalue{\??mc\OTRSETidentifier\c!nrechts}%
- \global\lofcolumns=\getvalue{\??mc\OTRSETidentifier\c!nlinks}%
- \global\tofcolumns=\rofcolumns \relax
+ \global\rofcolumns\getvalue{\??mc\OTRSETidentifier\c!nrechts}%
+ \global\lofcolumns\getvalue{\??mc\OTRSETidentifier\c!nlinks}%
+ \global\tofcolumns\rofcolumns \relax
\ifodd\realpageno\relax
- \global\nofcolumns=\rofcolumns
+ \global\nofcolumns\rofcolumns
\else
\global\advance\tofcolumns\lofcolumns
- \global\nofcolumns=\lofcolumns
+ \global\nofcolumns\lofcolumns
\fi
\else
- \global\nofcolumns=\getvalue{\??mc\OTRSETidentifier\c!n}%
- \global\rofcolumns=\nofcolumns
- \global\lofcolumns=\nofcolumns
- \global\tofcolumns=\nofcolumns
+ \global\nofcolumns\getvalue{\??mc\OTRSETidentifier\c!n}%
+ \global\rofcolumns\nofcolumns
+ \global\lofcolumns\nofcolumns
+ \global\tofcolumns\nofcolumns
\fi
-\OTRSETassignwidths
- \global\mofcolumns=1
+ \OTRSETassignwidths
+ \global\mofcolumns\plusone
\columnerasegridboxes}
% vanaf hier:
-\def\definecolumnset%
+\def\definecolumnset
{\dodoubleargument\dodefinecolumnset}
\def\dodefinecolumnset[#1][#2]%
@@ -1108,7 +1209,10 @@
\c!nlinks=\getvalue{\??mc#1\c!n},
\c!nrechts=\getvalue{\??mc#1\c!n},
#2]%
- \dorecurse{\getvalue{\??mc#1\c!nlinks}} % todo
+ \redodefinecolumnset[#1]}
+
+\def\redodefinecolumnset[#1]%
+ {\dorecurse{\getvalue{\??mc#1\c!nlinks}} % todo
{\dododefinecolumnset[#1][\recurselevel]}%
\dorecurse{\getvalue{\??mc#1\c!nrechts}} % todo
{\dododefinecolumnset[#1][\recurselevel]}%
@@ -1124,43 +1228,111 @@
\c!uitlijnen=,
\c!afstand=\getvalue{\??mc#1\c!afstand}]}
-\def\setupcolumnset%
+\def\setupcolumnset
{\dotripleargument\dosetupcolumnset}
\def\dosetupcolumnset[#1][#2][#3]%
{\ifthirdargument
\def\docommando##1%
- {\doifelse{##1}{\v!elk}
- {\dorecurse{\getvalue{\??mc#1\c!n}}{\docommando{\recurselevel}}}
+ {\doifelse{##1}\v!elk
+ {\dorecurse{\getvalue{\??mc#1\c!n}}{\docommando\recurselevel}}
{\getparameters[\??mc#1##1][#3]}}%
\processcommalist[#2]\docommando
\else
\getparameters[\??mc#1][#2]%
\fi}
+
+\definecolumnset[\s!default][\c!n=2] % fallback
+
+\def\OTRSETgotonextpage
+ {\vfill\eject
+ \relax\ifnum\mofcolumns>\plusone
+ \OTRSETgotocolumn[\v!laatste]%
+ \ifnum\mofcolumns>\plusone
+ \OTRSETgotocolumn[\v!forceer]%
+ \fi
+ \fi}
-\def\OTRSETgotocolumn%
+\let\OTRSETgotonextpageX\OTRSETgotonextpage % will become obsolete
+
+\def\OTRSETgotocolumn
{\dosingleempty\doOTRSETgotocolumn}
+% \def\doOTRSETgotocolumn[#1]% first|last|yes|<number>
+% {\doifnumberelse{#1}
+% {\OTRSETdummycolumn
+% \doloop
+% {\ifnum\mofcolumns<#1\relax
+% \OTRSETdummycolumn
+% \else
+% \exitloop
+% \fi}}
+% {\processallactionsinset
+% [#1]
+% [ \v!ja=>\OTRSETdummycolumn,
+% \v!forceer=>\OTRSETdummycolumn,
+% \v!eerste=>{\doOTRSETgotocolumn[1]},
+% \v!laatste=>\expanded{\doOTRSETgotocolumn[\the\nofcolumns]},
+% \s!default=>\OTRSETdummycolumn]}}
+
\def\doOTRSETgotocolumn[#1]% first|last|yes|<number>
{\doifnumberelse{#1}
- {\OTRSETdummycolumn
- \doloop
- {\ifnum\mofcolumns<#1
- \OTRSETdummycolumn
- \else
- \exitloop
- \fi}}
- {\processaction
+ {\ifnum\mofcolumns<#1\relax
+ \vfill\eject % \doejectpage\eject
+ \doloop
+ {\ifnum\mofcolumns<#1\relax
+ \OTRSETdummycolumn \else \exitloop
+ \fi}%
+ \fi}
+ {\processallactionsinset
[#1]
- [ \v!ja=>\OTRSETdummycolumn,
+ [ \v!ja=>\OTRSETdummycolumn,
+ \v!forceer=>\OTRSETdummycolumn,
\v!eerste=>{\doOTRSETgotocolumn[1]},
- \v!laatste=>{\doOTRSETgotocolumn[\nofcolumns]},
- \v!default=>\OTRSETdummycolumn]}}
+ \v!laatste=>\expanded{\doOTRSETgotocolumn[\the\nofcolumns]},
+ \s!default=>\OTRSETdummycolumn]}}
+
+% to be documented and tested, not yet that robust
+\def\OTRSETgotocell#1#2%
+ {\endgraf
+ \gdef\gotocellcounter{0}%
+ \doloop
+ {\ifnum\mofcolumns<#1\relax
+ \doglobal\increment\gotocellcounter\relax
+ \ifnum\gotocellcounter>#1\relax
+ \line{\strut}\crlf
+ \line{\strut}\crlf
+ \column
+ \writestatus{columnset}{quitting goto cell}%
+ \exitloop
+ \else
+ \column
+ \fi
+ \else
+ \exitloop
+ \fi}%
+ \ifnum\mofcolumns=#1\relax
+ \ifnum#2>1
+ \scratchcounter\zerocount
+ \currenthcell\mofcolumns
+ \currentvcell#2\advance\currentvcell \minusone
+ \dorecurse\currentvcell
+ {\OTRSETdoifcellelse\mofcolumns\recurselevel\donothing
+ {\advance\scratchcounter\plusone}}
+ \getnoflines\pagetotal
+ \advance\scratchcounter-\noflines
+ \ifnum\scratchcounter>\zerocount
+ \dorecurse\scratchcounter{\line{\strut}}%
+ \fi
+ \fi
+ \fi
+ \OTRSETsetvsize}
+
\def\OTRSETdummycolumn
{\vbox{\strut}
- \vskip-\lineheight
- \vfill
+ \vskip-\lineheight
+ \vfill
\eject}
\newcounter\columnsetlevel
@@ -1172,8 +1344,8 @@
\def\dostartcolumnset[#1][#2]%
{\increment\columnsetlevel\relax
\doglobal\newcounter\balancingpageno
- \gdef\localcolumnmaxcells{0}%
- \ifnum\columnsetlevel=1
+ \globallet\localcolumnmaxcells\!!zerocount
+ \ifnum\columnsetlevel=\plusone
%\OTRSETgetmanualbalance
\bgroup
\def\currentcolumnset{#2}%
@@ -1183,29 +1355,54 @@
%\global\let\OTRSETidentifier\currentcolumnset
\binnenkolommentrue % will be different flag
%\let\redofloatorder\gobbleoneargument % will also be a flag
- \let\kolom\OTRSETgotocolumn%
\activateotr{SET}{ONE}% andere naam, activate or so
- \xdef\OTRSETlist{#1}%
- \OTRSETgotonextpage
- \OTRSETgetmanualbalance % here
+\doifelsenothing{#1}
+ {\globallet\OTRSETlist\s!default}
+ {\xdef\OTRSETlist{#1}}%
+ \OTRSETstartnextpage
+ \OTRSETgetmanualbalance % here
\OTRSETassignwidths
\OTRSETsethsize
\else
\bgroup
\fi}
+% \def\stopcolumnset
+% {\relax
+% \ifnum\columnsetlevel=\plusone
+% \par
+% \OTRSETsetmanualbalance
+% \dostopcolumnset
+% \egroup
+% \global\footnotelimittrue
+% \setvsize
+% \sethsize
+% \ifvoid\OTRfinalpagebox\else
+% % probably balanced
+% \ifdim\ht\OTRfinalpagebox<\teksthoogte
+% \snaptogrid[\v!pagina]\hbox{\box\OTRfinalpagebox}
+% \else
+% \box\OTRfinalpagebox
+% \fi
+% \fi
+% \ifsomefloatwaiting \setvsize \pagina \setvsize \fi
+% \else
+% \egroup
+% \fi
+% \decrement\columnsetlevel\relax}
+
\def\stopcolumnset
{\relax
- \ifnum\columnsetlevel=1
- \par
- \OTRSETsetmanualbalance
+ \ifnum\columnsetlevel=\plusone
+ \pagebreak
+ \OTRSETsetmanualbalance
\dostopcolumnset
\egroup
\global\footnotelimittrue
\setvsize
\sethsize
\ifvoid\OTRfinalpagebox\else
- % probably balanced
+ % probably balanced
\ifdim\ht\OTRfinalpagebox<\teksthoogte
\snaptogrid[\v!pagina]\hbox{\box\OTRfinalpagebox}
\else
@@ -1218,7 +1415,7 @@
\fi
\decrement\columnsetlevel\relax}
-\def\dostopcolumnset%
+\def\dostopcolumnset
{%\OTRSETdofinalflushfloats % yes/no
\ifbalancecolumns
\OTRSETdobalance
@@ -1231,91 +1428,93 @@
\def\localcolumnmaxcells{0}
-\def\OTRSETmanualbalance
- {\ifbalancecolumns
+\def\OTRSETmanualbalance
+ {\ifbalancecolumns
\let\savedcolumnmaxcells\columnmaxcells
\ifnum\realpageno=\balancingpageno\relax
- \ifnum\mofcolumns=1
+ \ifnum\mofcolumns=\plusone
\dorecurse\nofcolumns
- {\!!counta=\recurselevel
- \!!countb=\balancingcolumnmaxcells\!!counta\relax
+ {\!!counta\recurselevel
+ \!!countb\balancingcolumnmaxcells\!!counta\relax
\ifnum\!!countb>\localcolumnmaxcells
- \xdef\localcolumnmaxcells{\the\!!countb}%
+ \xdef\localcolumnmaxcells{\the\!!countb}%
\fi
- \advance\!!countb 1
- \dostepwiserecurse\!!countb\columnmaxcells1
+ \advance\!!countb \plusone
+ \dostepwiserecurse\!!countb\columnmaxcells\plusone
{\OTRSETsetgridcell\!!counta\recurselevel\copy\placeholderboxe}}%
\fi
\fi
\fi}
-\def\balancingcolumnmaxcells#1% pas op: etex
- {\ifcsname\??mc\OTRSETidentifier\number#1\c!regels\endcsname
- \csname\??mc\OTRSETidentifier\number#1\c!regels\endcsname
- \else\ifcsname\??mc\OTRSETidentifier\c!regels\endcsname
- \csname\??mc\OTRSETidentifier\c!regels\endcsname
+\def\balancingcolumnmaxcells#1% pas op: etex
+ {\ifcsname\??mc\OTRSETidentifier\number#1\c!regels\endcsname
+ \csname\??mc\OTRSETidentifier\number#1\c!regels\endcsname
+ \else\ifcsname\??mc\OTRSETidentifier\c!regels\endcsname
+ \csname\??mc\OTRSETidentifier\c!regels\endcsname
\else
\savedcolumnmaxcells
\fi\fi}
-\def\OTRSETsetmanualbalance
- {\doglobal\addtocommalist{\realfolio}\OTRSETbalancinglist}
+\def\OTRSETsetmanualbalance
+ {\doglobal\addtocommalist\realfolio\OTRSETbalancinglist}
-\def\OTRSETpresetmanualbalance
+\def\OTRSETpresetmanualbalance
{\doifdefined{\??mc\OTRSETidentifier\c!regels}
{\getcommacommandsize[\csname\??mc\OTRSETidentifier\c!regels\endcsname]%
- \ifnum\commalistsize>1
+ \ifnum\commalistsize>\plusone
\scratchcounter\zerocount
\def\docommando##1%
- {\advance\scratchcounter1
+ {\advance\scratchcounter\plusone
\setvalue{\??mc\OTRSETidentifier\the\scratchcounter\c!regels}{##1}}%
\processcommacommand
[\csname\??mc\OTRSETidentifier\c!regels\endcsname]\docommando
\fi}}
-\def\OTRSETgetmanualbalance
+\def\OTRSETgetmanualbalance
{\gettwopassdata\s!colset
\iftwopassdatafound
- \OTRSETpresetmanualbalance
+ \OTRSETpresetmanualbalance
\global\let\balancingpageno\twopassdata
\else
\doglobal\newcounter\balancingpageno
\fi
- \global\balancingcolumnsfalse}
+ \global\balancingcolumnsfalse}
%\def\OTRSETnobalance
-% {\iflastcolumnfootnotes % testen ! optie
+% {\iflastcolumnfootnotes % testen ! optie
% % inhibit flush of floats !
% \dostepwiserecurse{\mofcolumns}{\nofcolumns}{1}
% {\vskip-\lineheight\vbox{\strut}\vfill\eject}%
% \else
-% \ifdim\pagetotal>\zeropoint
-% \vfill \eject \OTRSETdofinalflush
-% \fi
+% \ifdim\pagetotal>\zeropoint
+% \vfill \eject \OTRSETdofinalflush
+% \fi
% \fi}
\def\OTRSETnobalance
- {\iflastcolumnfootnotes % testen ! optie
+ {\iflastcolumnfootnotes % testen ! optie
% inhibit flush of floats !
- \dostepwiserecurse{\mofcolumns}{\nofcolumns}{1}
+ \dostepwiserecurse\mofcolumns\nofcolumns\plusone
{\vskip-\lineheight\vbox{\strut}\vfill\eject}%
\else
- \ifdim\pagetotal>\zeropoint
-\ifnum\mofcolumns=\nofcolumns
- \OTRSETflushfinalfootnotes
- \vfill \eject
-\else
- \vfill \eject
- \OTRSETdofinalflush
- \OTRSETdofinaloutput
-\fi
- \fi
+ \ifdim\pagetotal>\zeropoint
+ \ifnum\mofcolumns=\nofcolumns
+ \OTRSETflushfinalfootnotes
+ \vfill \eject
+ \else
+ \vfill \eject
+ \OTRSETdofinalflush
+ \OTRSETdofinaloutput
+ \fi
+ \fi
\fi}
-\def\OTRSETgotonextpage%
- {\doifsomething{\OTRSETlist}
+\def\OTRSETstartnextpage
+ {\doifsomething\OTRSETlist
{\getfromcommacommand[\OTRSETlist][1]%
\global\let\OTRSETidentifier\commalistelement
+ \doifundefined{\??mc\OTRSETidentifier\c!n}
+ {\globallet\OTRSETidentifier\s!default}%
\let\newcommalistelement\empty
\doglobal\replaceincommalist\OTRSETlist1%
\OTRSETrestart}}
@@ -1330,82 +1529,110 @@
\OTRSETsethsize
\OTRSETsetplaceholders
\OTRSEThandlepreposttext
-\initializecolumntextareas % name !
+ \initializecolumntextareas % name !
\OTRSETsetvsize}
\OTRSEToutput
{\OTRSETnaturalflush
-% \OTRSETgotonextpage
-\OTRSETdoflushfloats % zou eigenlijk in \flushsavedfloats moeten (gaat fout)
+ %\OTRSETstartnextpage
+ \OTRSETdoflushfloats % zou eigenlijk in \flushsavedfloats moeten (gaat fout)
\OTRSETcheckfreelines
\OTRSETchecksidefloat}
-\def\OTRSETinitializefeatures%
+\def\OTRSETinitializefeatures
{% number of lines
-% new: raw
+ % new: raw
\getrawnoflines\teksthoogte\xdef\columnmaxcells{\the\noflines}%
% direction
\doifelsevalue{\??mc\OTRSETidentifier\c!richting}\v!rechts
- {\chardef\columndirection0}
- {\chardef\columndirection1}%
- % balancing
+ {\chardef\columndirection\zerocount}
+ {\chardef\columndirection\plusone}%
+ % balancing
\doifelsevalue{\??mc\OTRSETidentifier\c!balanceren}\v!ja
{\balancecolumnstrue}
{\balancecolumnsfalse}}
+% keep 'm for a while
+%
+% \installoutput\OTRSETflushpreposttext
+% {\global\setbox\precolumnbox\vbox{\unvbox\normalpagebox}%
+% \ifcarryoverfootnotes \else
+% \global\setbox\postcolumnbox\vbox{\placebottomnotes}%
+% \fi}
+%
+% to be tested on 'boekinhoud' in 'pascal/demo-bbi'
+%
+% junk ! ! ! ! !
+%
+%\installoutput\OTRSETflushpreposttext
+% {\global\setbox\precolumnbox\vbox
+% {\unvbox\normalpagebox
+% \strut\vskip-2\lineheight\strut}% we want a proper depth
+% \ifcarryoverfootnotes \else
+% \global\setbox\postcolumnbox\vbox{\placebottomnotes}%
+% \fi}
+%
+% \starttext
+% \definecolumnset[two][n=2]
+% \startcolumnset[two] \dorecurse{4}{\input tufte } \stopcolumnset
+% \input tufte
+% \startcolumnset[two] \input tufte \stopcolumnset
+% \stoptext
+
\installoutput\OTRSETflushpreposttext
{\global\setbox\precolumnbox\vbox{\unvbox\normalpagebox}%
+ \global\dp\precolumnbox\strutdepth
\ifcarryoverfootnotes \else
\global\setbox\postcolumnbox\vbox{\placebottomnotes}%
\fi}
-\def\OTRSEThandlepreposttext%
- {\ifdim\ht\precolumnbox>\zeropoint % new
+\def\OTRSEThandlepreposttext
+ {\ifdim\ht\precolumnbox>\zeropoint % new
\getnoflines{\ht\precolumnbox}%
\doOTRSETsetgridcells
{\copy\placeholderboxe}
- 11\nofcolumns\noflines
+ \plusone\plusone\nofcolumns\noflines
{\box\precolumnbox}%
\fi
\ifdim\ht\postcolumnbox>\zeropoint % new, otherwise empty bottom line
\getnoflines{\ht\postcolumnbox}%
\advance\columnfreecells -\noflines
- \advance\columnfreecells 1
+ \advance\columnfreecells \plusone
\doOTRSETsetgridcells
{\copy\placeholderboxe}
- 1\columnfreecells\nofcolumns\noflines
+ \plusone\columnfreecells\nofcolumns\noflines
{\box\postcolumnbox}%
\fi}
-\def\OTRSETchecksidefloat%
+\def\OTRSETchecksidefloat
{} % {\sidefloatoutput}
-\def\OTRSETfinalsidefloatoutput%
+\def\OTRSETfinalsidefloatoutput
{}
-\def\OTRSETcheckgrid%
- {\topskip=1\topskip
+\def\OTRSETcheckgrid
+ {\topskip1\topskip
\ifforcecolumngrid
- \widowpenalty=0
- \clubpenalty=0
- \brokenpenalty=0
+ \widowpenalty\zerocount
+ \clubpenalty\zerocount
+ \brokenpenalty\zerocount
\fi}
\def\OTRSETcheckinsert%
{\iflastcolumnfootnotes
- \ifnum\nofcolumns=\mofcolumns
- \OTRSETforceinserts
- \else
- \OTRSETinhibitinserts
+ \ifnum\nofcolumns=\mofcolumns
+ \OTRSETforceinserts
+ \else
+ \OTRSETinhibitinserts
\fi
\else
- \OTRSETforceinserts
+ \OTRSETforceinserts
\fi}
-\def\OTRSETforceinserts%
+\def\OTRSETforceinserts
{\enablenotes}
-\def\OTRSETinhibitinserts%
+\def\OTRSETinhibitinserts
{\disablenotes}
% interface to footnotes
@@ -1422,7 +1649,7 @@
% \divide#2 \scratchcounter}
% {#2=\getvalue{\??mc#1\c!breedte}}}
-%\def\OTRSETassignwidth#1\to#2% assumes mofcolumns
+%\def\OTRSETassignwidth#1\to#2% assumes mofcolumns
% {\doifelsevalue{\??mc#1\number\mofcolumns\c!breedte}{\v!passend}
% {#2=\zetbreedte
% \scratchcounter=0
@@ -1434,24 +1661,24 @@
% \divide#2 by \scratchcounter}
% {#2=\getvalue{\??mc#1\number\mofcolumns\c!breedte}}}
%
-% replaced by
+% replaced by
%
-%\def\OTRSETassignwidth#1\to#2% assumes mofcolumns
+%\def\OTRSETassignwidth#1\to#2% assumes mofcolumns
% {#2=\OTRSETlocalwidth\mofcolumns}
-\def\OTRSETassignwidths%
+\def\OTRSETassignwidths
{%\scratchdimen\zetbreedte
- \freezetextwidth \scratchdimen\tekstbreedte
+ \freezetextwidth \scratchdimen\tekstbreedte
%
- \scratchcounter0
+ \scratchcounter\zerocount
\dorecurse\nofcolumns
- {\doifelsevalue{\??mc\OTRSETidentifier\recurselevel\c!breedte}{\v!passend}
- {\advance\scratchcounter 1 }
+ {\doifelsevalue{\??mc\OTRSETidentifier\recurselevel\c!breedte}\v!passend
+ {\advance\scratchcounter \plusone }
{\advance\scratchdimen -\getvalue{\??mc\OTRSETidentifier\recurselevel\c!breedte}}%
\advance\scratchdimen -\getvalue{\??mc\OTRSETidentifier\recurselevel\c!afstand}}%
\divide\scratchdimen \scratchcounter
\dorecurse\nofcolumns
- {\doifelsevalue{\??mc\OTRSETidentifier\recurselevel\c!breedte}{\v!passend}
+ {\doifelsevalue{\??mc\OTRSETidentifier\recurselevel\c!breedte}\v!passend
{\dimen0=\scratchdimen}
{\dimen0=\getvalue{\??mc\OTRSETidentifier\recurselevel\c!breedte}}%
\setxvalue{\??mc\recurselevel\??mc\c!breedte}{\the\dimen0}}}
@@ -1468,24 +1695,24 @@
\def\columnplaceholder#1#2%
{\hbox
- {\localcolortrue
- \setbox\scratchbox\hbox to \hsize
- {\iftracecolumnset
- #2\hskip-.5ex\vrule\!!width1ex\!!height.5ex\!!depth.5ex\hss
- \fi
- \hss}%
- \ifcase#1\relax
- \ht\scratchbox\zeropoint
- \dp\scratchbox\zeropoint
- \wd\scratchbox\zeropoint
- \else
- \wd\scratchbox\hsize
- \ht\scratchbox\ht\strutbox
- \dp\scratchbox\dp\strutbox
- \fi
- \box\scratchbox}}
+ {\localcolortrue
+ \setbox\scratchbox\hbox to \hsize
+ {\iftracecolumnset
+ #2\hskip-.5ex\vrule\!!width1ex\!!height.5ex\!!depth.5ex\hss
+ \fi
+ \hss}%
+ \ifcase#1\relax
+ \ht\scratchbox\zeropoint
+ \dp\scratchbox\zeropoint
+ \wd\scratchbox\zeropoint
+ \else
+ \wd\scratchbox\hsize
+ \ht\scratchbox\ht\strutbox
+ \dp\scratchbox\dp\strutbox
+ \fi
+ \box\scratchbox}}
-\def\OTRSETsetplaceholders%
+\def\OTRSETsetplaceholders
{\global\setbox\placeholderboxa\columnplaceholder0\cyan
\global\setbox\placeholderboxb\columnplaceholder0\green
\global\setbox\placeholderboxc\columnplaceholder0\blue
@@ -1494,24 +1721,26 @@
\global\setbox\placeholderboxf\columnplaceholder1\darkgray}
\def\doOTRSETshowstatus
- {\llap{\tt\tfxx\blue(\number\columnfirstcell\#\number\columnfreecells)}}
+ {\llap{\tt\tfxx\blue
+ (\the\vsize->\number\columnfirstcell\#\number\columnfreecells)%
+ \hskip\leftskip}}
\def\OTRSETshowstatus
{\iftracecolumnset \doOTRSETshowstatus \fi}
-\appendtoks \OTRSETshowstatus \to \everypar
+\appendtoks \OTRSETshowstatus \to \everypar
% page contents
\def\OTRSETdopagecontents#1#2% takes two args: \box<n> \unvbox<n>
- {\vbox to \teksthoogte
- {\forgetall#1#2\pushcolor}}
+ {\vbox to \teksthoogte{\forgetall#1#2\pushcolor}}
-\def\OTRSETsomepagefloat {\def\floatmethod{PAGE}\OTRSETsomeslotfloat} % check
-\def\OTRSETsomeherefloat {\def\floatmethod{HERE}\OTRSETsomeslotfloat} % check
-\def\OTRSETsomeelsefloat {\def\floatmethod{HERE}\OTRSETsomeslotfloat} % check
-\def\OTRSETsometopfloat {\def\floatmethod{TOPS}\OTRSETsomeslotfloat} % check
-\def\OTRSETsomebottomfloat{\def\floatmethod{BOTS}\OTRSETsomeslotfloat} % check
+\def\OTRSETsomepagefloat {\def\floatmethod{PAGE}\OTRSETsomeslotfloat} % check
+\def\OTRSETsomeherefloat {\def\floatmethod{HERE}\OTRSETsomeslotfloat} % check
+\def\OTRSETsomeelsefloat {\def\floatmethod{HERE}\OTRSETsomeslotfloat} % check
+\def\OTRSETsomefixdfloat {\def\floatmethod{FIXD}\OTRSETsomeslotfloat} % check
+\def\OTRSETsometopfloat {\def\floatmethod{TOPS}\OTRSETsomeslotfloat} % check
+\def\OTRSETsomebottomfloat{\def\floatmethod{BOTS}\OTRSETsomeslotfloat} % check
% \def\OTRSETsomeslotfloat {\let\floatmethod\v!hier\OTRONEsomeelsefloat}
@@ -1519,36 +1748,169 @@
{\iftestfloatbox\ruledhbox\fi{\box\floatbox}}
\def\OTRSETsomeslotfloat[#1]%
- {\setbox\floatbox=\vbox{\flushfloatbox}%
- \dp\floatbox=\dp\strutbox
+ {\setbox\floatbox\vbox{\flushfloatbox}%
+ \dp\floatbox\dp\strutbox
\@EA\uppercasestring\floatmethod\to\floatmethod
\OTRSETstoreincolumnslot\floatmethod\floatbox
\doinsertfloatinfo}
+% kind of new, looks much like OTRONE, but not entirely
+
+\def\OTRSETdosettopinserts
+ {\bgroup
+ \ifsomefloatwaiting
+ \noffloatinserts\zerocount
+ \let\totaltopinserted\!!zeropoint
+ \OTRSETdodosettopinserts
+ \ifnum\@@bknonder=\zerocount
+ \ifnum\@@bknregels>\zerocount
+ \ifdim\totaltopinserted>\zeropoint\relax
+ \dimen0\lineheight
+ \dimen0=\@@bknregels\dimen0
+ \advance\dimen0 \totaltopinserted\relax
+ \ifdim\dimen0>\teksthoogte % \vsize %%%%%%%%% \teksthoogte
+ \showmessage\m!floatblocks8{\@@bknregels}%
+ \vfilll\eject
+ \fi
+ \fi
+ \fi
+ \fi
+ \fi
+ \egroup}
+
+\def\OTRSETdodosettopinserts
+ {\ifnum\noffloatinserts<\noftopfloats
+ \dogetfloat
+ \ifdim\topinserted=\zeropoint\relax
+ \topofinserttrue
+ \else
+ \topofinsertfalse
+ \fi
+ \setbox\scratchbox\vbox % kan beter !
+ {\forgetall
+ \iftopofinsert
+ \ifdim\OTRSETtopoffset=\zeropoint
+ \verplaatsopgrid[\v!boven]
+ \fi
+ \else
+ \betweenfloatblanko % inserts can't look back
+ \fi
+ \flushfloatbox
+ \blanko[\@@bknawit]}%
+ \global\advance\topinserted \ht\scratchbox\relax
+ \ifdim\topinserted>\vsize % was \teksthoogte\relax
+ \doresavefloat
+ \noffloatinserts\noftopfloats\relax
+ \global\advance\topinserted -\ht\scratchbox
+ \let\OTRSETdodosettopinserts\relax % to be tested
+ \else
+ \xdef\totaltopinserted{\the\topinserted}%
+ \insert\topins{\forgetall\box\scratchbox}% interlineskip ?
+ \ifsomefloatwaiting
+ \advance\noffloatinserts \plusone
+ \else
+ \noffloatinserts\noftopfloats\relax
+ \fi
+ \dofloatflushedinfo
+ \fi
+ \else
+ \ifsomefloatwaiting
+ \showmessage\m!floatblocks6{\the\noftopfloats}%
+ \fi
+ \let\OTRSETdodosettopinserts\relax
+ \fi
+ \OTRSETdodosettopinserts}
+
+\def\OTRSETdosetbotinserts
+ {\bgroup
+ \ifsomefloatwaiting
+ \noffloatinserts\zerocount
+ \OTRSETdodosetbotinserts
+ \fi
+ \egroup}
+
+\def\OTRSETdodosetbotinserts
+ {\ifnum\noffloatinserts<\nofbotfloats\relax
+ \dogetfloat
+ \global\advance\botinserted \ht\floatbox\relax
+ \global\advance\botinserted \dp\floatbox\relax
+ \global\advance\botinserted \floattopskip\relax
+ \ifdim\botinserted<\pagegoal\relax
+ \insert\botins
+ {\forgetall
+ \blanko[\@@bkvoorwit]%
+ \flushfloatbox}%
+ \ifsomefloatwaiting
+ \advance\noffloatinserts \plusone
+ \else
+ \noffloatinserts\nofbotfloats
+ \fi
+ \dofloatflushedinfo
+ \else
+ \doresavefloat
+ \noffloatinserts\nofbotfloats\relax
+ \fi
+ \global\nofloatpermittedtrue % vgl topfloats s!
+ \else
+ \ifsomefloatwaiting
+ \showmessage\m!floatblocks7{\the\nofbotfloats}%
+ \fi
+ \let\OTRSETdodosetbotinserts\relax
+ \fi
+ \OTRSETdodosetbotinserts}
+
+\let\OTRSETdosetbothinserts\relax
+
+\def\OTRSETdotopinsertions
+ {\ifvoid\topins\else
+ \ifvoid\columntopbox\mofcolumns
+ \columnsettopbox\mofcolumns\box\topins
+ \else
+ \columnsettopbox\mofcolumns\vbox % temp, must be better
+ {\forgetall
+ \offinterlineskip
+ \box\columntopbox\mofcolumns
+ \box\topins}
+ \fi
+ \fi
+ \global\topinserted\zeropoint\relax} % goes away
+
+\def\OTRSETdobotinsertions
+ {\ifvoid\botins \else
+ \columnsetbotbox\mofcolumns\box\botins
+% \else
+% \columnsetbotbox\mofcolumns\vbox % temp, must be better
+% {\forgetall
+% \offinterlineskip
+% \box\botins
+% \box\columnbotbox\mofcolumns}
+ \fi
+ \global\botinserted\zeropoint\relax} % goes away
+
% set ipv text
-% left right 1 2 3 +1 +2 +3
+% left right 1 2 3 +1 +2 +3
\let\columnleftareas \empty
\let\columnrightareas\empty
-% links rechts => odd, even, n, named
+% links rechts => odd, even, n, named
-\def\definecolumntextarea%
+\def\definecolumntextarea
{\dotripleempty\dodefinecolumntextarea}
-\def\dodefinecolumntextarea[#1][#2][#3]% y=0 is mogelijke en handig !
+\def\dodefinecolumntextarea[#1][#2][#3]% y=0 is mogelijke en handig !
{\ifthirdargument
\doifelse{#2}\v!beide
{\definecolumntextarea[#1][\v!links ][#3]%
\definecolumntextarea[#1][\v!rechts][#3]}
{\doifelse{#2}\v!volgende
- {\doifonevenpaginaelse
+ {\doifoddpageelse
{\definecolumntextarea[#1][\v!rechts][#3]}
{\definecolumntextarea[#1][\v!links][#3]}}
{\presetlocalframed
[\??mt#1#2]%
- \processaction[#2] % \doglobal voorkomt stack build up
+ \processaction[#2] % \doglobal voorkomt stack build up
[ \v!links=>\doglobal\addtocommalist{#1}\columnleftareas,
\v!rechts=>\doglobal\addtocommalist{#1}\columnrightareas]%
\getparameters[\??mt#1#2]
@@ -1559,7 +1921,7 @@
\definecolumntextarea[#1][\v!volgende][#2]%
\fi}
-\def\setupcolumntextarea%
+\def\setupcolumntextarea
{\dotripleempty\dosetupcolumntextarea}
\def\dosetupcolumntextarea[#1][#2][#3]%
@@ -1568,7 +1930,7 @@
{\setupcolumntextarea[#1][\v!links ][#3]%
\setupcolumntextarea[#1][\v!rechts][#3]}
{\doifelse{#2}\v!volgende
- {\doifonevenpaginaelse
+ {\doifoddpageelse
{\setupcolumntextarea[#1][\v!rechts][#3]}
{\setupcolumntextarea[#1][\v!links][#3]}}
{\getparameters[\??mt#1#2][#3]}}%
@@ -1576,7 +1938,7 @@
\setupcolumntextarea[#1][\v!volgende][#2]%
\fi}
-\def\initializecolumntextareas%
+\def\initializecolumntextareas
{\ifodd\realpageno
\doinitializecolumntextareas\columnrightareas\v!rechts
\else
@@ -1598,14 +1960,14 @@
{\getvalue{\??mt#1#2\c!nx}}{\getvalue{\??mt#1#2\c!ny}}
{\copy\placeholderboxd}}
-\def\placecolumntextareas%
+\def\placecolumntextareas
{\ifodd\realpageno
\doplacecolumntextareas\columnrightareas\v!rechts
\else
\doplacecolumntextareas\columnleftareas\v!links
\fi}
-\def\doplacecolumntextareas#1#2% global ?
+\def\doplacecolumntextareas#1#2% global ?
{\bgroup
\forgetall
\def\docommando##1%
@@ -1619,61 +1981,26 @@
\def\columntextlastbackspace{\rugwit}
-% \def\dodoplacecolumntextareas#1#2%
-% {\!!counta\getvalue{\??mt#1#2\c!x}%
-% \!!countb\getvalue{\??mt#1#2\c!nx}%
-% \docalculatecolumnsetspan
-% \!!heighta\getvalue{\??mt#1#2\c!ny}\lineheight
-% % option
-% \advance\!!heighta -\lineheight
-% \setbox\scratchbox\vbox
-% {\donetrue\localframed
-% [\??mt#1#2]
-% [\c!breedte=\!!widtha,\c!hoogte=\!!heighta]
-% {\getvalue{\??mt#1#2}}}%
-% \!!counta\getvalue{\??mt#1#2\c!x}%
-% \!!countb\getvalue{\??mt#1#2\c!y}%
-% \advance\!!countb \getvalue{\??mt#1#2\c!ny}%
-% \advance\!!countb -1
-% \OTRSETsetgridcell
-% \!!counta\!!countb
-% \hbox{\clip
-% [\c!breedte=\!!widthb,\c!hoogte=\!!heighta]%
-% {\copy\scratchbox}}%
-% \ifcase\!!countc\else
-% \advance\!!counta \getvalue{\??mt#1#2\c!nx}%
-% \advance\!!counta -\!!countc
-% \advance\!!widtha -\!!widthb
-% \OTRSETsetgridcell
-% \!!counta\!!countb
-% \hbox
-% {\hskip-\namedlayoutparameter\v!oneven\c!rugwit
-% \clip
-% [\c!breedte=\!!widtha,\c!hoogte=\!!heighta,
-% \c!hoffset=\!!widthb]
-% {\copy\scratchbox}}%
-% \fi}
-
\def\dodoplacecolumntextareas#1#2%
{\!!counta\getvalue{\??mt#1#2\c!x}%
- \!!countb\getvalue{\??mt#1#2\c!nx}%
+ \!!countb\getvalue{\??mt#1#2\c!nx}%
\docalculatecolumnsetspan
\!!heighta\getvalue{\??mt#1#2\c!ny}\lineheight
-% to do: met/zonder ht/dp
-\ifnum\getvalue{\??mt#1#2\c!y}=0
- \advance\!!heighta -\lineheight
- \advance\!!heighta \topskip
-\fi
- \advance\!!heighta -\lineheight % option
+ % to do: met/zonder ht/dp
+ \ifnum\getvalue{\??mt#1#2\c!y}=\zerocount
+ \advance\!!heighta -\lineheight
+ \advance\!!heighta \topskip
+ \fi
+ \advance\!!heighta -\lineheight % option
\setbox\scratchbox\vbox
{\donetrue\localframed
[\??mt#1#2]
- [\c!breedte=\!!widtha,\c!hoogte=\!!heighta]
+ [\c!breedte=\!!widtha,\c!hoogte=\!!heighta,\c!regels=]
{\getvalue{\??mt#1#2}}}%
\!!counta\getvalue{\??mt#1#2\c!x}%
\!!countb\getvalue{\??mt#1#2\c!y}%
\advance\!!countb \getvalue{\??mt#1#2\c!ny}%
- \advance\!!countb -1
+ \advance\!!countb \minusone
\OTRSETsetgridcell
\!!counta\!!countb
\hbox{\clip
@@ -1693,19 +2020,16 @@
{\copy\scratchbox}}%
\fi}
-\def\setupcolumntextareatext%
+\def\setupcolumntextareatext
{\dotripleempty\dosetupcolumntextareatext}
-%\def\dosetupcolumntextareatext[#1][#2][#3]%
-% {\setvalue{\??mt#1#2}{#3}}
-
\long\def\dosetupcolumntextareatext[#1][#2][#3]%
{\ifthirdargument
\doifelse{#2}\v!beide
{\setvalue{\??mt#1\v!links }{#3}%
\setvalue{\??mt#1\v!rechts}{#3}}
{\doifelse{#2}\v!volgende
- {\doifonevenpaginaelse
+ {\doifoddpageelse
{\setvalue{\??mt#1\v!rechts}{#3}}%
{\setvalue{\??mt#1\v!links }{#3}}}%
{\setvalue{\??mt#1#2}{#3}}}%
@@ -1714,43 +2038,44 @@
\fi}
\def\docalculatecolumnsetspan
- {% \!!counta <= x
- % \!!countb <= nx
+ {% \!!counta <= x
+ % \!!countb <= nx
% \!!widtha => total width
- % \!!widthb => left width
- % \!!countc => left cols
- \!!widtha\!!countb\hsize
- \advance\!!countb \!!counta \advance\!!countb -1 \relax
+ % \!!widthb => left width
+ % \!!countc => left cols
+ \!!widtha\!!countb\tekstbreedte % we assume equal widths
+ \advance\!!countb \!!counta
+ \advance\!!countb \minusone
\ifnum\!!countb>\nofcolumns
\!!countc\!!countb
\advance\!!countc -\nofcolumns
\!!countb\nofcolumns
\else
- \!!countc0
+ \!!countc\zerocount
\fi
- \advance\!!counta 1
- \dostepwiserecurse\!!counta\!!countb1
+ \advance\!!counta \plusone
+ \dostepwiserecurse\!!counta\!!countb\plusone
{\advance\!!widtha\OTRSETgetparameter\c!afstand\recurselevel}%
\!!widthb\!!widtha
- \advance\!!widthb -\!!countc\hsize
- \ifodd\realpageno \else
+ \advance\!!widthb -\!!countc\tekstbreedte
+ \ifodd\realpageno \else % tricky, assumes that we keep there
\ifcase\!!countc\else
- % nog niet ok voor enkel/dubbelzijdig
- \advance\!!widtha \namedlayoutparameter\v!even \c!rugwit
+ % nog niet ok voor enkel/dubbelzijdig
+ \advance\!!widtha \namedlayoutparameter\v!even \c!rugwit
\advance\!!widtha \namedlayoutparameter\v!oneven\c!rugwit
- \advance\!!widthb \namedlayoutparameter\v!even \c!rugwit
+ \advance\!!widthb \namedlayoutparameter\v!even \c!rugwit
\dorecurse\!!countc
{\advance\!!widtha\OTRSETgetparameter\c!afstand\recurselevel}%
\fi
\fi}
-\def\columnsetspanhsize{\hsize}
+\def\columnsetspanhsize{\tekstbreedte}
\def\setcolumnsetspanhsize#1#2% x nx / uses counta/b
- {\!!counta=#1\!!countb=#2\docalculatecolumnsetspan
+ {\!!counta#1\!!countb#2\docalculatecolumnsetspan
\edef\columnsetspanhsize{\the\!!widtha}}
-\def\definecolumnsetspan%
+\def\definecolumnsetspan
{\dodoubleempty\dodefinecolumnsetspan}
\def\dodefinecolumnsetspan[#1][#2]%
@@ -1761,55 +2086,129 @@
\c!voor=,
\c!na=,
\c!offset=\v!overlay,
- \c!plaats=,
+ \c!plaats=\v!links,
\c!regelcorrectie=\v!uit,
\c!dieptecorrectie=\v!uit,
\c!n=2,
+ \c!nregels=0,
+ \c!springvolgendein=\v!ja,
+ \c!default=HERE,
+ \c!variant=\v!a,
#2]%
%\else
% \definecolumnspan[][#1]%
}%\fi}
-\def\setupcolumnsetspan%
+\def\setupcolumnsetspan
{\dodoubleempty\dosetupcolumnsetspan}
\def\dosetupcolumnsetspan[#1][#2]%
{%\ifsecondargument
- \setupframedtext[cs:#1][#2]%
+ \setupframedtexts[cs:#1][#2]%
%\else
% \setupcolumnsetspan[][#1]%
}%\fi}
-\def\startcolumnsetspan%
+\def\startcolumnsetspan
{\dotripleempty\dostartcolumnsetspan}
-%%%%%%%%%%%%%%%% TODO
-
-\def\dostartcolumnsetspan[#1][#2][#3]% [#3] gobbles space
- {\bgroup
- \!!countc\framedtextparameter{cs:#1}\c!n%
- \!!countd\nofcolumns \advance\!!countd -\mofcolumns \advance\!!countd 1
- \ifnum\!!countc>\!!countd \!!countc\!!countd \fi
+%%%%%%%%%%%%%%%% TODO
+
+\def\dostartcolumnsetspan[#1][#2][#3]% [#3] gobbles space
+ {\endgraf % else rubish output if forgotten
+ \vskip \zeropoint % make sure otr is done, otherwise last line problems
+ \bgroup
+\forgetall
+ \setupframedtexts[cs:#1]
+ [\c!breedte=\columnsetspanhsize,
+ \c!regelcorrectie=\v!uit,
+ \c!dieptecorrectie=\v!uit,
+ #2]%
+ % determine widths
+ \!!countc\framedtextparameter{cs:#1}\c!n
+ % \!!countd\numexpr(\nofcolumns-\mofcolumns+\plusone)%
+ \!!countd\nofcolumns
+ % n <= n of columns
+ \ifnum\!!countc>\!!countd \!!countc\!!countd \fi
+ \advance\!!countd -\mofcolumns
+ \advance\!!countd \plusone
+ % n <= n of available columns (alternative a)
+ \doif{\framedtextparameter{cs:#1}\c!variant}\v!a
+ {\ifnum\!!countc>\!!countd \!!countc\!!countd \fi}%
+ % here it all starts
\setcolumnsetspanhsize\mofcolumns\!!countc % a/b used
\hsize\columnsetspanhsize
- \setupframedtexts[cs:#1][\c!breedte=\columnsetspanhsize,
-\c!regelcorrectie=\v!uit,\c!dieptecorrectie=\v!uit,#2]
-\setbox\scratchbox\vbox\bgroup
- \dostartframedtext[cs:#1][\v!geen]
- \vskip-\lineheight\par\strut\par
- \framedtextparameter{cs:#1}\c!voor
- \def\stopcolumnsetspan{\dostopcolumnsetspan{#1}}}
+ \setbox\scratchbox\vbox\bgroup
+ \dostartframedtext[cs:#1][\v!geen]% geen nils placement
+ \vskip-\lineheight\par\strut\par
+ \framedtextparameter{cs:#1}\c!voor
+ \def\stopcolumnsetspan{\dostopcolumnsetspan{#1}}}
+
+% \chardef\columnslotlocation2
+
+% \def\dostopcolumnsetspan#1%
+% {\par
+% \vbox{\strut}
+% \kern-2\lineheight
+% \vbox{\strut}
+% \doifsomething{\framedtextparameter{cs:#1}\c!na}
+% {\framedtextparameter{cs:#1}\c!na
+% \kern\zeropoint}% otherwise blanks disappear, better be a switch
+% \dostopframedtext
+% \egroup
+% \setbox\scratchbox\frozenhbox % keeps grid snapping okay
+% {\lower\strutdepth\box\scratchbox}%
+% %todo: nboven/onder\chardef\columnslotlocation2
+% %\OTRSETstoreincolumnslotSOMEWHERE\columnslotlocation\scratchbox
+% \chardef\columnslotspacing\framedtextparameter{cs:#1}\c!nregels\relax
+% \OTRSETstoreincolumnslotSOMEWHERE2\scratchbox
+% \doif{\framedtextparameter{cs:#1}\c!springvolgendein}\v!nee
+% \noindentation
+% \egroup
+% \endgraf}
\def\dostopcolumnsetspan#1%
{\par
- \kern-\lineheight\prevdepth\dp\strutbox\strut
- \framedtextparameter{cs:#1}\c!na
- \kern\zeropoint % needed ?
+ \vbox{\strut}
+ \kern-2\lineheight
+ \vbox{\strut}
+ \doifsomething{\framedtextparameter{cs:#1}\c!na}
+ {\framedtextparameter{cs:#1}\c!na
+ \kern\zeropoint}% otherwise blanks disappear, better be a switch
\dostopframedtext
-\vskip-\strutdepth % awful hack
\egroup
- \chardef\columnslotspacing0 % ! ! !
- \OTRSETstoreincolumnslotHERE\scratchbox
- \egroup}
+ % frozen keeps grid snapping okay
+ \setbox\scratchbox\frozenhbox to \hsize
+ {\dontcomplain
+ \doregelplaats{\framedtextparameter{cs:#1}\c!plaats}%
+ {\lower\strutdepth\box\scratchbox}}%
+ \dp\scratchbox\zeropoint % else wrong snap insidefloat
+ \ifinsidefloat
+ \box\scratchbox
+ \else
+ % we only set \columnsetspacing when asked for, else bottom problems
+ \scratchcounter\framedtextparameter{cs:#1}\c!nregels\relax
+ \ifcase\scratchcounter\else\chardef\columnslotspacing\scratchcounter\fi
+ % todo: nboven/onder & \chardef\columnslotlocation2
+ %\OTRSETstoreincolumnslotHERE\scratchbox
+ \edef\floatmethod{\framedtextparameter{cs:#1}\c!default}%
+ \@EA\uppercasestring\floatmethod\to\floatmethod
+ % todo : \v!hier -> here enzovoorts
+ \OTRSETstoreincolumnslot\floatmethod\scratchbox
+ \doif{\framedtextparameter{cs:#1}\c!springvolgendein}\v!nee
+ \noindentation
+ \fi
+ \egroup
+ \endgraf}
+
+% \startcolumnset[two]
+% \input tufte
+% \startcolumnsetspan[two][width=20cm,location=middle] \input tufte \stopcolumnsetspan
+% \startcolumnsetspan[two][default=btlr] \input tufte \stopcolumnsetspan
+% \input tufte \par
+% \input tufte \par
+% \startcolumnsetspan[two] \emptylines[5] \stopcolumnsetspan
+% \startcolumnsetspan[two] \input tufte \stopcolumnsetspan
+% \stopcolumnset
-\protect \endinput
+\protect \endinput