summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/page-set.tex
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/context/base/page-set.tex')
-rw-r--r--Master/texmf-dist/tex/context/base/page-set.tex138
1 files changed, 127 insertions, 11 deletions
diff --git a/Master/texmf-dist/tex/context/base/page-set.tex b/Master/texmf-dist/tex/context/base/page-set.tex
index 76866c563d5..be744b2a184 100644
--- a/Master/texmf-dist/tex/context/base/page-set.tex
+++ b/Master/texmf-dist/tex/context/base/page-set.tex
@@ -52,6 +52,9 @@
\def\@otr@{otr}
+\let\OTRSETflushsidefloats \forgetsidefloats % \relax
+\let\OTRSETsynchronizesidefloats\forgetsidefloats % \relax
+
\def\OTRSETgridcell #1#2{\csname \@otr@:\number#1:\number#2\endcsname}
\def\OTRSETgetgridcell#1#2{\box\csname \@otr@:\number#1:\number#2\endcsname}
\def\OTRSETsetgridcell#1#2{\global\setbox\csname\@otr@:\number#1:\number#2\endcsname}
@@ -84,6 +87,72 @@
% \startcolumnset [three] \dorecurse {1}{\input tufte \par} \stopcolumnset
% \stoptext
+%D Marks in columnsets:
+%D
+%D \starttyping
+%D \definemarking[M]
+%D \setupheadertexts[\setups{show-M-marks}]
+%D \definecolumnset[test][n=3]
+%D
+%D \startsetups show-M-marks
+%D \getmarking[M][1][previous]/\getmarking[M][1][first]/\getmarking[M][1][last]\quad
+%D \getmarking[M][2][previous]/\getmarking[M][2][first]/\getmarking[M][2][last]\quad
+%D \getmarking[M][3][previous]/\getmarking[M][3][first]/\getmarking[M][3][last]\quad
+%D \getmarking[M][1][previous]/\getmarking[M][1][first]/\getmarking[M][last]\quad
+%D \getsavedmarking[M][previous]/\getsavedmarking[M][first]/\getsavedmarking[M][last]
+%D \stopsetups
+%D
+%D \startbuffer
+%D \section{Knuth} [K1]\marking[M]{k1} [K2]\marking[M]{k2} \input knuth
+%D \section{Zapf} [Z]\marking[M]{z} \input zapf
+%D \stopbuffer
+%D
+%D \startbuffer
+%D \section{Ward} [W]\marking[M]{w} \input ward
+%D \placefigure[here]{none}{\externalfigure[a][height=2cm]}
+%D \section{Davis} [D]\marking[M]{d} \input davis
+%D \section{Zapf} [Z]\marking[M]{z} \input zapf
+%D \stopbuffer
+%D
+%D \startbuffer
+%D \section{Ward} [W]\marking[M]{w} \input ward
+%D \placefigure[here]{none}{\externalfigure[a][height=2cm]}
+%D \section{Davis} [D]\marking[M]{d} \input davis
+%D \section{Zapf} [Z]\marking[M]{z} \input zapf
+%D \section{Douglas} [O]\marking[M]{o} \input douglas
+%D \stopbuffer
+%D
+%D \starttext
+%D \startcolumnset[test]
+%D \dorecurse{5}{\getbuffer}
+%D \placefigure[here]{none}{\externalfigure[a][height=2cm]}
+%D % \column % sometimes needed
+%D \stopcolumnset
+%D \stoptext
+%D \stoptyping
+
+% not ok yet, for column sets we need a special case: within a column we
+% need to bubble-up the marks; the indirectness permits overloading here
+
+\let\saveOTRSETmark \refreshsavedmark
+\let\bubbleOTRSETmark\bubblesavedmark
+\let\resetOTRSETmark \resetsavedmark
+\let\presetOTRSETmark\presetsavedmark
+
+\def\doregisterOTRSETmarks#1{\saveOTRSETmark [#1][\number\mofcolumns]}
+\def\dobubbleOTRSETmarks #1{\bubbleOTRSETmark[#1][\number\mofcolumns]}
+\def\doresetOTRSETmarks #1{\resetOTRSETmark [#1][\recurselevel]}
+\def\dopresetOTRSETmarks #1{\presetOTRSETmark[#1][\recurselevel]}
+
+\def\registerOTRSETmarks
+ {\processcommacommand[\alldefinedmarks]\doregisterOTRSETmarks}
+\def\bubbleOTRSETmarks
+ {\processcommacommand[\alldefinedmarks]\dobubbleOTRSETmarks}
+\def\resetOTRSETmarks
+ {\dorecurse\nofcolumns{\processcommacommand[\alldefinedmarks]\doresetOTRSETmarks}}
+\def\presetOTRSETmarks
+ {\dorecurse\nofcolumns{\processcommacommand[\alldefinedmarks]\dopresetOTRSETmarks}}
+
%D test case of Vit Zika (context list):
%D
%D \starttyping
@@ -529,17 +598,19 @@
\def\OTRSETdoflush
{\ifcollectingcontent
+ \registerOTRSETmarks
\global\mofcolumns\plusone
\else
\OTRSETdofinalflush
\OTRSETdofinaloutput
-\ifnum\columnsetpage>0
- \dorecurse\nofcolumns{\doresetcolumnsetlines\recurselevel}%
-\fi
-\doglobal\increment\columnsetpage
+ \ifnum\columnsetpage>0
+ \dorecurse\nofcolumns{\doresetcolumnsetlines\recurselevel}%
+ \fi
+ \doglobal\increment\columnsetpage
\OTRSETinitializecolumns
%\OTRSETdoflushfloats
\OTRSETstartnextpage
+\presetOTRSETmarks
\initializecolumntextareas
\fi}
@@ -893,7 +964,9 @@
{\OTRSETsetfreecells\mofcolumns\columnlastcell
\ifsomefreecolumncells
% okay
+ \bubbleOTRSETmarks % not robust because we reenter
\else
+ \registerOTRSETmarks % not robust because we reenter
\global\advance\mofcolumns \plusone
\ifnum\mofcolumns>\nofcolumns
\OTRSETdoflush
@@ -1708,6 +1781,7 @@
{\increment\columnsetlevel\relax
\globallet\localcolumnmaxcells\!!zerocount
\global\chardef\OTRSETfinish\zerocount
+ \resetOTRSETmarks
\ifnum\columnsetlevel=\plusone
\bgroup
\saveinterlinespace
@@ -1725,6 +1799,31 @@
\bgroup
\fi}
+% \setuplayout[grid=yes] \definecolumnset[example] \showgrid
+
+% \starttext
+% \startcolumnset[example]
+% \input knuth \endgraf \input knuth
+% \placetable{table}{\framed[width=\makeupwidth,height=4cm]{Hello}}
+% \input knuth \endgraf \input knuth
+% \stopcolumnset
+% \input knuth \endgraf \input knuth
+% \stoptext
+
+
+\def\OTRSETflushleftovers % new per 13/4/2006
+ {\OTRSETdoifcellelse{1}{1}
+ {\bgroup
+ \OTRSETcentergridcells
+ \chardef\OTRSETbalancemethod\plusone
+ \OTRSETreducegridbox
+ \global\setbox\OTRfinalpagebox\OTRSETmakegridbox
+ \global\ht\OTRfinalpagebox\textheight % signals output that there is content
+ \OTRSETdofinaloutput
+ \globallet\OTRSETbalht\zeropoint
+ \egroup}
+ {}}
+
\def\stopcolumnset
{\relax
\ifnum\columnsetlevel=\plusone
@@ -1746,6 +1845,7 @@
\fi
\global\chardef\OTRSETfinish\zerocount
\ifsomefloatwaiting \setvsize \pagebreak \setvsize \fi
+ \OTRSETflushleftovers
\else
\egroup
\fi
@@ -1875,7 +1975,7 @@
{\vskip-\struttotal\verticalstrut\vfill\eject}%
\else
\ifnum\mofcolumns>\plusone
- \donetrue
+ \donetrue
\else\ifdim\pagetotal>\zeropoint % too dangerous, we loose data
\donetrue
\else
@@ -1889,6 +1989,7 @@
\fi
\vfill
\eject
+\registerOTRSETmarks
% brr, may result in empty page after nicely fit text
% or if left, then lost of first column only text
\ifnum\mofcolumns>\plusone
@@ -1944,12 +2045,26 @@
\donothing{\OTRSETsetgridcell\mofcolumns\recurselevel\copy\placeholderboxe}}%
\egroup}}
+% \OTRSEToutput
+% {\dontcomplain % new, get rid of overfull message (to be sorted out)
+% \OTRSETnaturalflush
+% %\OTRSETstartnextpage
+% \OTRSETdoflushfloats % actually belongs in \flushsavedfloats (but goes wrong)
+% \OTRSETcheckfreelines
+% \OTRSETchecksidefloat}
+
\OTRSEToutput
{\dontcomplain % new, get rid of overfull message (to be sorted out)
- \OTRSETnaturalflush
- %\OTRSETstartnextpage
- \OTRSETdoflushfloats % actually belongs in \flushsavedfloats (but goes wrong)
- \OTRSETcheckfreelines
+ \doloop
+ {\OTRSETnaturalflush
+ %\OTRSETstartnextpage % no
+ \OTRSETdoflushfloats % actually belongs in \flushsavedfloats (but goes wrong)
+ \OTRSETcheckfreelines
+ \ifsomefreecolumncells
+ \exitloop
+ \else
+ % flush page and get rid of more floats if present
+ \fi}%
\OTRSETchecksidefloat}
\def\OTRSETinitializefeatures
@@ -2596,7 +2711,7 @@
\advance\!!widthb -\!!countc\textwidth
\ifodd\realpageno \else % tricky, assumes that we keep there
\ifcase\!!countc\else
- % nog niet ok voor enkel/dubbelzijdig
+ % nog niet ok voor enkel/doublesided
\advance\!!widtha \namedlayoutparameter\v!even\c!backspace
\advance\!!widtha \namedlayoutparameter\v!odd \c!backspace
\advance\!!widthb \namedlayoutparameter\v!even\c!backspace
@@ -2627,6 +2742,7 @@
\c!depthcorrection=\v!off,
\c!n=2,
\c!nlines=0,
+ \c!indenting=,
\c!indentnext=\v!yes,
\c!default=HERE,
\c!alternative=\v!a,
@@ -2732,7 +2848,7 @@
% todo : \v!here -> here enzovoorts
\OTRSETstoreincolumnslot\floatmethod\scratchbox
% watch out: no \dochecknextindentation{tag}
- \checknextindentation[\framedtextparameter{cs:#1}\c!indentnext]
+ \checknextindentation[\framedtextparameter{cs:#1}\c!indentnext]%
\else
% of course we needed a one-column fall back for tm; brrr, the box has now too
% much height (try \ruledvbox); don't change this without testing techniek