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.tex553
1 files changed, 280 insertions, 273 deletions
diff --git a/tex/context/base/page-set.tex b/tex/context/base/page-set.tex
index c48c94b19..9dff9163a 100644
--- a/tex/context/base/page-set.tex
+++ b/tex/context/base/page-set.tex
@@ -11,6 +11,8 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
+% getnoflines vs getrawnoflines
+
\writestatus{loading}{Context OTR Macros / Column Sets}
% todo : last longer than previous
@@ -59,7 +61,7 @@
\beginETEX \ifcsname
-\def\columnerasegridboxes%
+\def\columnerasegridboxes
{\bgroup
\increment\columnmaxcells\relax
\ifodd\realpageno
@@ -111,7 +113,7 @@
\beginTEX
-\def\columnerasegridboxes%
+\def\columnerasegridboxes
{\bgroup
\increment\columnmaxcells\relax
\ifodd\realpageno \else % we are on the other page
@@ -245,50 +247,6 @@
\OTRSETdomakegridbox{\nofcolumns}{1}{-1}%
\fi}
-%\def\OTRSETdomakegridbox#1#2#3%
-% {\hbox\bgroup
-% % test first !
-% \hbox to \zetbreedte
-% {\dostepwiserecurse{#1}{#2}{#3}
-% {\mofcolumns=\recurselevel
-% \localcolumnwidth=\OTRSETlocalwidth\mofcolumns
-% \setbox\scratchbox=\hbox\localframed
-% [\??mc\OTRSETidentifier\number\mofcolumns]%
-% [\c!breedte=\localcolumnwidth,\c!hoogte=\teksthoogte]%
-% {}%
-% \ifcase\columndirection
-% \hskip\OTRSETgetparameter\c!afstand\recurselevel\box\scratchbox
-% \else
-% \box\scratchbox\hskip\OTRSETgetparameter\c!afstand\recurselevel
-% \fi}}%
-% \hskip-\zetbreedte
-% % main text
-% \hbox to \zetbreedte
-% {\dostepwiserecurse{#1}{#2}{#3}
-% {\mofcolumns=\recurselevel
-% \localcolumnwidth=\OTRSETlocalwidth\mofcolumns
-% \offinterlineskip
-% \setbox\scratchbox=\vbox to \teksthoogte
-% {\topskipcorrection
-% \dorecurse{\columnmaxcells}
-% {\setbox\scratchbox=\hbox{\OTRSETgetgridcell\mofcolumns\recurselevel}%
-% \ht\scratchbox=\ht\strutbox
-% \dp\scratchbox=\dp\strutbox
-% \ifcase\columndirection
-% \box\scratchbox
-% \else
-% \hbox to \localcolumnwidth
-% {\hskip\localcolumnwidth\llap{\box\scratchbox}}
-% \fi
-% \par}}%
-% \wd\scratchbox=\localcolumnwidth % \tekstbreedte
-% \ifcase\columndirection
-% \hskip\OTRSETgetparameter\c!afstand\recurselevel\box\scratchbox
-% \else
-% \box\scratchbox\hskip\OTRSETgetparameter\c!afstand\recurselevel
-% \fi}}%
-% \egroup}
-
\def\OTRSETdomakegridbox#1#2#3%
{\hbox\bgroup
%
@@ -353,7 +311,7 @@
\def\OTRSETflushfinalfootnotes
{\ifcase\lastcolumnlastcell \else
\setbox\scratchbox=\hbox
- {\placefootnotes}%
+ {\placebottomnotes}%
\ifdim\ht\scratchbox>\zeropoint
\setbox\scratchbox=\hbox
{\hbox to \zeropoint{\OTRSETgetgridcell\nofcolumns\lastcolumnlastcell}%
@@ -403,8 +361,11 @@
{\OTRSETflushfinalfootnotes
\placecolumntextareas
\OTRSETcentergridcells
- \OTRSETreducegridbox
- \global\setbox\OTRfinalpagebox=\OTRSETmakegridbox
+ \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 ?
\global\mofcolumns=\nofcolumns} % otherwise problems in finaloutput
\def\OTRSETdofinaloutput
@@ -423,8 +384,6 @@
\immediatewriteutilitycommand
{\twopassentry{\s!colset}{\the\scratchcounter}{##1}}}%
\processcommacommand[\OTRSETbalancinglist]\docommando}
-
-\let\OTRSETflushsavedfloats\relax
\definesystemvariable {mc}
\definesystemvariable {mt}
@@ -451,7 +410,7 @@
\dosynchronizeoutput
\allowbreak % hm
\fi
- \synchronizevsize
+ \synchronizenotes
\fi}
\def\OTRSETsethsize%
@@ -492,38 +451,36 @@
\def\OTRSETflushtextsofar
{\ifvoid\normalpagebox \else
\setbox\scratchbox=\vbox{\unvbox\normalpagebox}%
- \OTRSETsavefootnotes
+ \OTRSETsavenotes
\OTRSEThandleflushedtext0
\fi}
-\def\OTRSETplacefootnotes
+\def\OTRSETplacebottomnotes
{\iflastcolumnfootnotes
\ifnum\nofcolumns=\mofcolumns
- \ifintermediatefootnotes \placefootnotes \fi
+ \ifintermediatefootnotes \placebottomnotes \fi
\fi
\else
- \placefootnotes
+ \placebottomnotes
\fi}
-\def\OTRSETflushfootnotes
- {\ifvoid\OTRSETsavedfootnotes \else
- \iflastcolumnfootnotes
- \ifnum\nofcolumns=\mofcolumns
- \flushsavedcolumnfootnotes
- \fi
- \else
- \flushsavedcolumnfootnotes
+\def\OTRSETflushsavednotes
+ {\iflastcolumnfootnotes
+ \ifnum\nofcolumns=\mofcolumns
+ \flushsavednotes
\fi
+ \else
+ \flushsavednotes
\fi}
-\def\OTRSETsavefootnotes
+\def\OTRSETsavenotes
{\iflastcolumnfootnotes
\ifnum\nofcolumns=\mofcolumns \else
- \savecolumnfootnotes
+ \savenotes
\fi
\fi}
-\appendtoks \OTRSETflushfootnotes \to \OTRSETeverystartofcolumn
+\appendtoks \OTRSETflushsavednotes \to \OTRSETeverystartofcolumn
\def\OTRSETnaturalflush%
{\setbox0=\vbox to \columnfreecells\lineheight
@@ -533,7 +490,7 @@
\unvbox\normalpagebox
\vfill}%
\setbox2=\hbox
- {\OTRSETplacefootnotes}%
+ {\OTRSETplacebottomnotes}%
\setbox\scratchbox=\hbox
{\wd0=\zeropoint\box0\box2}%
\dp\scratchbox=\dp\strutbox
@@ -667,7 +624,8 @@
\fi}
\def\OTRSETstoreincolumnslotTOPS#1%
- {\OTRSETcheckcolumnslot{#1}%
+ {\OTRSETprepareforcolumnslot1{#1}%
+ \OTRSETcheckcolumnslot{#1}%
\ifenoughcolumncells
\OTRSETcheckcolumnspace\mofcolumns\columnfirstcell{#1}%
\fi
@@ -680,7 +638,8 @@
\fi}
\def\OTRSETstoreincolumnslotBOTS#1%
- {\edef\savedcolumnlastcell{\the\columnlastcell}%
+ {\OTRSETprepareforcolumnslot3{#1}%
+ \edef\savedcolumnlastcell{\the\columnlastcell}%
\OTRSETcheckcolumnslot{#1}%
\ifenoughcolumncells
\advance\columnlastcell -\columnvcells \advance\columnlastcell 1
@@ -782,72 +741,74 @@
\newif\ifquitincurrentcolumn
-\def\OTRSETstoreincolumnslotLRTB%
- {\OTRSETstoreincolumnslotindeed
- \mofcolumns\nofcolumns+\currenthcell1\columnmaxcells+\currentvcell}
+\def\OTRSETstoreincolumnslotLRTB#1%
+ {\OTRSETprepareforcolumnslot1{#1}%
+ \OTRSETstoreincolumnslotindeed
+ \mofcolumns\nofcolumns+\currenthcell
+ 1\columnmaxcells+\currentvcell{#1}}
-\def\OTRSETstoreincolumnslotLRBT%
- {\OTRSETstoreincolumnslotindeed
- \mofcolumns\nofcolumns+\currenthcell\columnmaxcells1-\currentvcell}
+\def\OTRSETstoreincolumnslotLRBT#1%
+ {\OTRSETprepareforcolumnslot3{#1}%
+ \OTRSETstoreincolumnslotindeed
+ \mofcolumns\nofcolumns+\currenthcell
+ \columnmaxcells1-\currentvcell{#1}}
-\def\OTRSETstoreincolumnslotRLTB%
- {\OTRSETstoreincolumnslotindeed
- \nofcolumns\qofcolumns-\currenthcell1\columnmaxcells+\currentvcell}
+\def\OTRSETstoreincolumnslotRLTB#1%
+ {\OTRSETprepareforcolumnslot1{#1}%
+ \OTRSETstoreincolumnslotindeed
+ \nofcolumns\qofcolumns-\currenthcell
+ 1\columnmaxcells+\currentvcell{#1}}
-\def\OTRSETstoreincolumnslotRLBT%
- {\OTRSETstoreincolumnslotindeed
- \nofcolumns\qofcolumns-\currenthcell\columnmaxcells1-\currentvcell}
+\def\OTRSETstoreincolumnslotRLBT#1%
+ {\OTRSETprepareforcolumnslot3{#1}%
+ \OTRSETstoreincolumnslotindeed
+ \nofcolumns\qofcolumns-\currenthcell
+ \columnmaxcells1-\currentvcell{#1}}
-\def\OTRSETstoreincolumnslotTBLR%
- {\OTRSETstoreincolumnslotindeed
- 1\columnmaxcells+\currentvcell\mofcolumns\nofcolumns+\currenthcell}
+\def\OTRSETstoreincolumnslotTBLR#1%
+ {\OTRSETprepareforcolumnslot1{#1}%
+ \OTRSETstoreincolumnslotindeed
+ 1\columnmaxcells+\currentvcell
+ \mofcolumns\nofcolumns+\currenthcell{#1}}
-\def\OTRSETstoreincolumnslotTBRL%
- {\OTRSETstoreincolumnslotindeed
- 1\columnmaxcells+\currentvcell\nofcolumns\qofcolumns-\currenthcell}
+\def\OTRSETstoreincolumnslotTBRL#1%
+ {\OTRSETprepareforcolumnslot1{#1}%
+ \OTRSETstoreincolumnslotindeed
+ 1\columnmaxcells+\currentvcell
+ \nofcolumns\qofcolumns-\currenthcell{#1}}
-\def\OTRSETstoreincolumnslotBTLR%
- {\OTRSETstoreincolumnslotindeed
- \columnmaxcells1-\currentvcell\mofcolumns\nofcolumns+\currenthcell}
+\def\OTRSETstoreincolumnslotBTLR#1%
+ {\OTRSETprepareforcolumnslot3{#1}%
+ \OTRSETstoreincolumnslotindeed
+ \columnmaxcells1-\currentvcell
+ \mofcolumns\nofcolumns+\currenthcell{#1}}
-\def\OTRSETstoreincolumnslotBTRL%
- {\OTRSETstoreincolumnslotindeed
- \columnmaxcells1-\currentvcell\nofcolumns\qofcolumns-\currenthcell}
+\def\OTRSETstoreincolumnslotBTRL#1%
+ {\OTRSETprepareforcolumnslot3{#1}%
+ \OTRSETstoreincolumnslotindeed
+ \columnmaxcells1-\currentvcell
+ \nofcolumns\qofcolumns-\currenthcell{#1}}
-\def\OTRSETstoreincolumnslotFXTB% fixed column
- {\OTRSETstoreincolumnslotindeed
+\def\OTRSETstoreincolumnslotFXTB#1% fixed column
+ {\OTRSETprepareforcolumnslot2{#1}% % 1/2 dependent of place, todo
+ \OTRSETstoreincolumnslotindeed
\pofcolumns\pofcolumns
+\currenthcell\preferedrow
- \columnmaxcells+\currentvcell}
+ \columnmaxcells+\currentvcell{#1}}
-\def\OTRSETstoreincolumnslotFXBT% fixed column
- {\OTRSETstoreincolumnslotindeed
- \pofcolumns\pofcolumns
- +\currenthcell\columnmaxcells
- \preferedrow-\currentvcell}
-
-%\def\OTRSETstoreincolumnslotHERE% fixed column
-% {\OTRSETflushtextsofar
-% \ifdim\pagetotal>\zeropoint
-% \@EA\OTRSETstoreincolumnslotEREH
-% \else
-% \@EA\OTRSETstoreincolumnslotTOPS
-% \fi}
-%
-%\def\OTRSETstoreincolumnslotEREH% fixed column
-% {\getnoflines\pagetotal
-% \OTRSETstoreincolumnslotindeed
-% \mofcolumns\mofcolumns
-% +\currenthcell\noflines
-% \columnmaxcells+\currentvcell}
+\def\OTRSETstoreincolumnslotFXBT#1% fixed column
+ {\OTRSETprepareforcolumnslot2{#1}% % 3/2 dependent on place, todo
+ \OTRSETstoreincolumnslotindeed
+ \pofcolumns\pofcolumns+\currenthcell
+ \columnmaxcells\preferedrow-\currentvcell{#1}}
\def\OTRSETstoreincolumnslotHERE#1% fixed column
- {\OTRSETflushtextsofar
+ {\OTRSETprepareforcolumnslot2{#1}%
+ \OTRSETflushtextsofar
\getnoflines\pagetotal \advance\noflines\columnfirstcell
\OTRSETstoreincolumnslotindeed
- \mofcolumns\mofcolumns
- +\currenthcell\noflines
- \columnmaxcells+\currentvcell{#1}%
+ \mofcolumns\mofcolumns+\currenthcell
+ \noflines\columnmaxcells+\currentvcell{#1}%
\OTRSETsetvsize}
\def\OTRSETstoreincolumnslotindeed#1#2#3#4#5#6#7#8#9%
@@ -923,26 +884,47 @@
\fi
\OTRSETsetvsize
%\message{[fnt]}% float
- %\OTRSETflushfootnotes % not here, better a hook into \everypar
\else
%\message{[rej]}% save box
\OTRSETsavebox{#9}%
\fi}
-% \appendtoks \OTRSETflushfootnotes \to \everypar
-
-\def\columnslotspacing{2}
+% \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
- %\dp#2=\zeropoint
+ {%\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}}
- {\copy#2}}
+ {\OTRSETstoreincolumnsloUNKNOWN{#1}}}
+
+\def\OTRSETstoreincolumnsloUNKNOWN#1%
+ {\OTRSETprepareforcolumnslot2{#1}\copy#1}
+
+\def\OTRSETprepareforcolumnslot#1#2% 1=hoog 2=midden 3=laag
+ {\dp#2\zeropoint
+ \ifcase\columnslotspacing\else
+ \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}%
+ \fi}
\def\OTRSETdocheckiffloatfits % eigenlijk moet else float anders
{\ifnofloatpermitted
@@ -1114,7 +1096,7 @@
[\c!offset=\v!overlay,
\c!kader=\v!uit,
\c!uitlijnen=,
- \c!afstand=1.5\bodyfontsize]}
+ \c!afstand=\getvalue{\??mc#1\c!afstand}]}
\def\setupcolumnset%
{\dotripleargument\dosetupcolumnset}
@@ -1158,28 +1140,34 @@
\newcounter\columnsetlevel
\let\currentcolumnset\empty
-\def\startcolumnset%
+\def\startcolumnset
{\dodoubleempty\dostartcolumnset}
\def\dostartcolumnset[#1][#2]%
{\increment\columnsetlevel\relax
+ \doglobal\newcounter\balancingpageno
+ \gdef\localcolumnmaxcells{0}%
\ifnum\columnsetlevel=1
- \OTRSETgetmanualbalance
- \savefootnotedimensions
+ %\OTRSETgetmanualbalance
\bgroup
\def\currentcolumnset{#2}%
- \binnenkolommentrue % will be different flag
- %\let\redofloatorder\gobbleoneargument % will also be a flag
+ %\doifelsenothing{#2}
+ % {\def\currentcolumnset{#1}}%
+ % {\def\currentcolumnset{#2}}%
+ %\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
+ \activateotr{SET}{ONE}% andere naam, activate or so
\xdef\OTRSETlist{#1}%
\OTRSETgotonextpage
+ \OTRSETgetmanualbalance % here
\OTRSETassignwidths
\else
- \bgroup
+ \bgroup
\fi}
-\def\stopcolumnset%
+\def\stopcolumnset
{\relax
\ifnum\columnsetlevel=1
\par
@@ -1187,14 +1175,15 @@
\dostopcolumnset
\egroup
\global\footnotelimittrue
- \restorefootnotedimensions
\setvsize
\sethsize
\ifvoid\OTRfinalpagebox\else
- \dp\OTRfinalpagebox\zeropoint
- \box\OTRfinalpagebox
- \nobreak\vbox{\strut}\vskip-\lineheight
- \prevdepth\dp\strutbox
+ % probably balanced
+ \ifdim\ht\OTRfinalpagebox<\teksthoogte
+ \snaptogrid[\v!pagina]\hbox{\box\OTRfinalpagebox}
+ \else
+ \box\OTRfinalpagebox
+ \fi
\fi
\ifsomefloatwaiting \setvsize \pagina \setvsize \fi
\else
@@ -1213,20 +1202,6 @@
\def\OTRSETdobalance
{\OTRSETnobalance}
-%\def\OTRSETmanualbalance
-% {\ifbalancecolumns
-% \ifnum\realpageno=\balancingpageno\relax
-% \ifnum\mofcolumns=1
-% \dorecurse\nofcolumns
-% {\!!counta=\recurselevel
-% \!!countb=\balancingcolumnmaxcells\!!counta
-% \advance\!!countb 1
-% \dostepwiserecurse\!!countb\columnmaxcells1
-% {\OTRSETsetgridcell\!!counta\recurselevel\copy\placeholderboxe}}%
-% \fi
-% \fi
-% \fi}
-
\def\localcolumnmaxcells{0}
\def\OTRSETmanualbalance
@@ -1247,11 +1222,11 @@
\fi
\fi}
-\def\balancingcolumnmaxcells#1%
- {\ifcsname\??mc\currentcolumnset\number#1\c!regels\endcsname
- \csname\??mc\currentcolumnset\number#1\c!regels\endcsname
- \else\ifcsname\??mc\currentcolumnset\c!regels\endcsname
- \csname\??mc\currentcolumnset\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}
@@ -1259,14 +1234,27 @@
\def\OTRSETsetmanualbalance
{\doglobal\addtocommalist{\realfolio}\OTRSETbalancinglist}
+\def\OTRSETpresetmanualbalance
+ {\doifdefined{\??mc\OTRSETidentifier\c!regels}
+ {\getcommacommandsize[\csname\??mc\OTRSETidentifier\c!regels\endcsname]%
+ \ifnum\commalistsize>1
+ \scratchcounter\zerocount
+ \def\docommando##1%
+ {\advance\scratchcounter1
+ \setvalue{\??mc\OTRSETidentifier\the\scratchcounter\c!regels}{##1}}%
+ \processcommacommand
+ [\csname\??mc\OTRSETidentifier\c!regels\endcsname]\docommando
+ \fi}}
+
\def\OTRSETgetmanualbalance
{\gettwopassdata\s!colset
\iftwopassdatafound
+ \OTRSETpresetmanualbalance
\global\let\balancingpageno\twopassdata
\else
\doglobal\newcounter\balancingpageno
\fi
- \global\balancingcolumnsfalse}
+ \global\balancingcolumnsfalse}
%\def\OTRSETnobalance
% {\iflastcolumnfootnotes % testen ! optie
@@ -1327,20 +1315,21 @@
\def\OTRSETinitializefeatures%
{% number of lines
- \getnoflines\teksthoogte\xdef\columnmaxcells{\the\noflines}%
+% new: raw
+ \getrawnoflines\teksthoogte\xdef\columnmaxcells{\the\noflines}%
% direction
- \doifelsevalue{\??mc\OTRSETidentifier\c!richting}{\v!rechts}
- {\chardef\columndirection=0}
- {\chardef\columndirection=1}%
+ \doifelsevalue{\??mc\OTRSETidentifier\c!richting}\v!rechts
+ {\chardef\columndirection0}
+ {\chardef\columndirection1}%
% balancing
- \doifelsevalue{\??mc\OTRSETidentifier\c!balanceren}{\v!ja}
+ \doifelsevalue{\??mc\OTRSETidentifier\c!balanceren}\v!ja
{\balancecolumnstrue}
{\balancecolumnsfalse}}
\installoutput\OTRSETflushpreposttext
- {\global\setbox\precolumnbox=\vbox{\unvbox\normalpagebox}%
+ {\global\setbox\precolumnbox\vbox{\unvbox\normalpagebox}%
\ifcarryoverfootnotes \else
- \global\setbox\postcolumnbox=\vbox{\placefootnotes}%
+ \global\setbox\postcolumnbox\vbox{\placebottomnotes}%
\fi}
\def\OTRSEThandlepreposttext%
@@ -1387,10 +1376,10 @@
\fi}
\def\OTRSETforceinserts%
- {\enablecolumnfootnotes}
+ {\enablenotes}
\def\OTRSETinhibitinserts%
- {\disablecolumnfootnotes}
+ {\disablenotes}
% interface to footnotes
@@ -1424,14 +1413,16 @@
% {#2=\OTRSETlocalwidth\mofcolumns}
\def\OTRSETassignwidths%
- {\scratchdimen=\zetbreedte
- \scratchcounter=0
+ {%\scratchdimen\zetbreedte
+ \freezetextwidth \scratchdimen\tekstbreedte
+ %
+ \scratchcounter0
\dorecurse\nofcolumns
{\doifelsevalue{\??mc\OTRSETidentifier\recurselevel\c!breedte}{\v!passend}
- {\advance\scratchcounter by 1 }
- {\advance\scratchdimen by -\getvalue{\??mc\OTRSETidentifier\recurselevel\c!breedte}}%
- \advance\scratchdimen by -\getvalue{\??mc\OTRSETidentifier\recurselevel\c!afstand}}%
- \divide\scratchdimen by \scratchcounter
+ {\advance\scratchcounter 1 }
+ {\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}
{\dimen0=\scratchdimen}
@@ -1441,13 +1432,6 @@
\def\OTRSETlocalwidth#1%
{\getvalue{\??mc\number#1\??mc\c!breedte}}
-\def\OTRSETsetfootnotehsize%
- {%\ifcarryoverfootnotes
- % \doifdefinedelse{\??mc\@@vnbreedte\c!n} % inherits from columnset
- % {\OTRSETassignwidth\@@vnbreedte\to\hsize}
- % {\hsize\@@vnbreedte}%
- }%\fi}
-
\newbox\placeholderboxa
\newbox\placeholderboxb
\newbox\placeholderboxc
@@ -1514,47 +1498,6 @@
\OTRSETstoreincolumnslot\floatmethod\floatbox
\doinsertfloatinfo}
-% \def\definecolumnsetarea%
-% {\doquadrupleempty\dodefinecolumnsetarea}
-%
-% \def\dodefinecolumnsetarea[#1][#2][#3][#4]% test top n source
-% {\ifsecondargument
-% \doifundefinedelse{#4box}
-% {\@EA\newbox\csname#4box\endcsname}
-% {\setbox\csname#4box\endcsname=\box\voidb@x}%
-% \setvalue{\??mc#1#2\v!tekst#3}{\OTRSETflusharea{#1}{#2}{#3}}%
-% \setxvalue{#1#2#3source}{#4}%
-% \setgvalue{#4setup}%
-% {\OTRSETassignwidth#1\to\tekstbreedte
-% \getcolumnsettextssize[#1][#2][#3]}%
-% \fi}
-%
-% \def\startcolumnsetarea[#1]%
-% {\doifdefinedelse{#1box}
-% {\scratchcounter=\getvalue{#1box}%
-% \global\setbox\scratchcounter=\vbox\bgroup
-% \unvbox\scratchcounter
-% \getvalue{#1setup}
-% \hsize\OTRSETtextswidth}
-% {\setbox\scratchbox=\vbox\bgroup}}
-%
-% \def\stopcolumnsetarea%
-% {\endgraf
-% \vfill
-% \egroup}
-%
-% \def\OTRSETflusharea#1#2#3%
-% {\doifdefined{#1#2#3source}
-% {\scratchcounter=\getvalue{\getvalue{#1#2#3source}box}\relax
-% \ifvoid\scratchcounter\else
-% \ifdim\ht\scratchcounter>\vsize
-% \setbox\scratchbox=\vsplit\scratchcounter to \vsize
-% \unvbox\scratchbox
-% \else
-% \unvbox\scratchcounter
-% \fi
-% \fi}}
-
% set ipv text
% left right 1 2 3 +1 +2 +3
@@ -1567,12 +1510,12 @@
\def\definecolumntextarea%
{\dotripleempty\dodefinecolumntextarea}
-\def\dodefinecolumntextarea[#1][#2][#3]%
+\def\dodefinecolumntextarea[#1][#2][#3]% y=0 is mogelijke en handig !
{\ifthirdargument
- \doifelse{#2}{\v!beide}
+ \doifelse{#2}\v!beide
{\definecolumntextarea[#1][\v!links ][#3]%
\definecolumntextarea[#1][\v!rechts][#3]}
- {\doifelse{#2}{\v!volgende}
+ {\doifelse{#2}\v!volgende
{\doifonevenpaginaelse
{\definecolumntextarea[#1][\v!rechts][#3]}
{\definecolumntextarea[#1][\v!links][#3]}}
@@ -1594,10 +1537,10 @@
\def\dosetupcolumntextarea[#1][#2][#3]%
{\ifthirdargument
- \doifelse{#2}{\v!beide}
+ \doifelse{#2}\v!beide
{\setupcolumntextarea[#1][\v!links ][#3]%
\setupcolumntextarea[#1][\v!rechts][#3]}
- {\doifelse{#2}{\v!volgende}
+ {\doifelse{#2}\v!volgende
{\doifonevenpaginaelse
{\setupcolumntextarea[#1][\v!rechts][#3]}
{\setupcolumntextarea[#1][\v!links][#3]}}
@@ -1615,9 +1558,9 @@
\def\doinitializecolumntextareas#1#2%
{\def\docommando##1%
- {\doifelsevalue{\??mt##1#2\c!status}{\v!start}
+ {\doifelsevalue{\??mt##1#2\c!status}\v!start
{\dodoinitializecolumntextareas{##1}{#2}}
- {\doifvalue{\??mt##1#2\c!status}{\v!herhaal}
+ {\doifvalue{\??mt##1#2\c!status}\v!herhaal
{\dodoinitializecolumntextareas{##1}{#2}}}}%
\processcommacommand[#1]\docommando}
@@ -1639,43 +1582,84 @@
{\bgroup
\forgetall
\def\docommando##1%
- {\doifelsevalue{\??mt##1#2\c!status}{\v!start}
+ {\doifelsevalue{\??mt##1#2\c!status}\v!start
{\doglobal\removefromcommalist{##1}#1%
\dodoplacecolumntextareas{##1}{#2}}
- {\doifvalue{\??mt##1#2\c!status}{\v!herhaal}
+ {\doifvalue{\??mt##1#2\c!status}\v!herhaal
{\dodoplacecolumntextareas{##1}{#2}}}}%
\processcommacommand[#1]\docommando
\egroup}
+\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}%
\docalculatecolumnsetspan
- \!!heighta=\getvalue{\??mt#1#2\c!ny}\lineheight
- % option
- \advance\!!heighta -\lineheight
- \setbox\scratchbox=\vbox
- {\localframed
+ \!!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
+ \setbox\scratchbox\ruledvbox
+ {\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}%
+ \!!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}
+ \!!counta\!!countb
\hbox{\clip
- [\c!breedte=\!!widthb,\c!hoogte=\!!heighta]
+ [\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}
+ \!!counta\!!countb
\hbox
- {\hskip-\rugwit
+ {\hskip-\namedlayoutparameter\v!oneven\c!rugwit
\clip
[\c!breedte=\!!widtha,\c!hoogte=\!!heighta,
\c!hoffset=\!!widthb]
@@ -1685,8 +1669,22 @@
\def\setupcolumntextareatext%
{\dotripleempty\dosetupcolumntextareatext}
-\def\dosetupcolumntextareatext[#1][#2][#3]%
- {\setvalue{\??mt#1#2}{#3}}
+%\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
+ {\setvalue{\??mt#1\v!rechts}{#3}}%
+ {\setvalue{\??mt#1\v!links }{#3}}}%
+ {\setvalue{\??mt#1#2}{#3}}}%
+ \else
+ \setupcolumntextareatext[#1][\v!volgende][{#2}]%
+ \fi}
\def\docalculatecolumnsetspan
{% \!!counta <= x
@@ -1694,25 +1692,27 @@
% \!!widtha => total width
% \!!widthb => left width
% \!!countc => left cols
- \!!widtha=\!!countb\hsize
+ \!!widtha\!!countb\hsize
\advance\!!countb \!!counta \advance\!!countb -1 \relax
\ifnum\!!countb>\nofcolumns
- \!!countc=\!!countb
+ \!!countc\!!countb
\advance\!!countc -\nofcolumns
- \!!countb=\nofcolumns
+ \!!countb\nofcolumns
\else
- \!!countc=0
+ \!!countc0
\fi
\advance\!!counta 1
- \dostepwiserecurse{\!!counta}{\!!countb}{1}
+ \dostepwiserecurse\!!counta\!!countb1
{\advance\!!widtha\OTRSETgetparameter\c!afstand\recurselevel}%
- \!!widthb=\!!widtha
+ \!!widthb\!!widtha
\advance\!!widthb -\!!countc\hsize
\ifodd\realpageno \else
\ifcase\!!countc\else
- \advance\!!widtha 2\rugwit
- \advance\!!widthb \rugwit
- \dorecurse{\!!countc}
+ % 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
+ \dorecurse\!!countc
{\advance\!!widtha\OTRSETgetparameter\c!afstand\recurselevel}%
\fi
\fi}
@@ -1727,7 +1727,7 @@
{\dodoubleempty\dodefinecolumnsetspan}
\def\dodefinecolumnsetspan[#1][#2]%
- {\ifsecondargument
+ {%\ifsecondargument
\defineframedtext
[cs:#1]
[\c!kader=\v!uit,
@@ -1735,22 +1735,23 @@
\c!na=,
\c!offset=\v!overlay,
\c!plaats=,
+ \c!regelcorrectie=\v!uit,
\c!dieptecorrectie=\v!uit,
\c!n=2,
#2]%
- \else
- \definecolumnspan[][#1]%
- \fi}
+ %\else
+ % \definecolumnspan[][#1]%
+ }%\fi}
\def\setupcolumnsetspan%
{\dodoubleempty\dosetupcolumnsetspan}
\def\dosetupcolumnsetspan[#1][#2]%
- {\ifsecondargument
+ {%\ifsecondargument
\setupframedtext[cs:#1][#2]%
- \else
- \setupcolumnsetspan[][#1]%
- \fi}
+ %\else
+ % \setupcolumnsetspan[][#1]%
+ }%\fi}
\def\startcolumnsetspan%
{\dotripleempty\dostartcolumnsetspan}
@@ -1759,7 +1760,7 @@
\def\dostartcolumnsetspan[#1][#2][#3]% [#3] gobbles space
{\bgroup
- \!!countc\getvalue{\??kd cs:#1\c!n} % \framedtextparameter{cs:\c!n}%
+ \!!countc\framedtextparameter{cs:#1}\c!n%
\!!countd\nofcolumns \advance\!!countd -\mofcolumns \advance\!!countd 1
\ifnum\!!countc>\!!countd \!!countc\!!countd \fi
\setcolumnsetspanhsize\mofcolumns\!!countc % a/b used
@@ -1767,11 +1768,17 @@
\setupframedtexts[cs:#1][\c!breedte=\columnsetspanhsize,#2]
\setbox\scratchbox\hbox \bgroup
\dostartframedtext[cs:#1][\v!geen]
- \vskip-\lineheight\par\strut\par}
-
-\def\stopcolumnsetspan%
- {\par\kern-\lineheight\prevdepth\dp\strutbox\strut
+ \vskip-\lineheight\par\strut\par
+ \framedtextparameter{cs:#1}\c!voor
+ \def\stopcolumnsetspan{\dostopcolumnsetspan{#1}}}
+
+\def\dostopcolumnsetspan#1%
+ {\par
+ \kern-\lineheight\prevdepth\dp\strutbox\strut
+ \framedtextparameter{cs:#1}\c!na
+ \kern\zeropoint
\dostopframedtext \egroup
+ \chardef\columnslotspacing0 % ! ! !
\OTRSETstoreincolumnslotHERE\scratchbox
\egroup}