summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tex/context/base/cont-new.tex2
-rw-r--r--tex/context/base/context.tex2
-rw-r--r--tex/context/base/core-des.tex2
-rw-r--r--tex/context/base/core-spa.tex28
-rw-r--r--tex/context/base/m-streams.tex357
-rw-r--r--tex/context/base/page-ini.tex11
-rw-r--r--tex/context/base/page-lyr.tex13
-rw-r--r--tex/context/base/page-mul.tex19
-rw-r--r--tex/context/base/page-str.tex359
-rw-r--r--tex/context/interface/keys-cz.xml2
-rw-r--r--tex/context/interface/keys-de.xml2
-rw-r--r--tex/context/interface/keys-en.xml2
-rw-r--r--tex/context/interface/keys-fr.xml2
-rw-r--r--tex/context/interface/keys-it.xml2
-rw-r--r--tex/context/interface/keys-nl.xml2
-rw-r--r--tex/context/interface/keys-ro.xml2
16 files changed, 771 insertions, 36 deletions
diff --git a/tex/context/base/cont-new.tex b/tex/context/base/cont-new.tex
index 8900aa624..1c91e92f6 100644
--- a/tex/context/base/cont-new.tex
+++ b/tex/context/base/cont-new.tex
@@ -24,7 +24,7 @@
\normalend}}
\fi
-\newcontextversion{2006.03.23 09:57}
+\newcontextversion{2006.03.24 09:16}
%D This file is loaded at runtime, thereby providing an
%D excellent place for hacks, patches, extensions and new
diff --git a/tex/context/base/context.tex b/tex/context/base/context.tex
index e229669ba..4bf41a16a 100644
--- a/tex/context/base/context.tex
+++ b/tex/context/base/context.tex
@@ -31,7 +31,7 @@
%D 2004.8.30 the low level interface is english. Watch out and adapt
%D your styles an modules.
-\def\contextversion{2006.03.23 09:57}
+\def\contextversion{2006.03.24 09:16}
%D For those who want to use this:
diff --git a/tex/context/base/core-des.tex b/tex/context/base/core-des.tex
index 0b8a0d1cd..c38a6b8c0 100644
--- a/tex/context/base/core-des.tex
+++ b/tex/context/base/core-des.tex
@@ -415,7 +415,7 @@
\def\dodefinedescription[#1][#2]%
{\copyparameters[\??dd#1][\??dd]
- [\c!location,\c!headstyle,\c!style,\c!color,\c!headcolor,
+ [\c!location,\c!headstyle,\c!style,\c!color,\c!headcolor,\c!title,
\c!width,\c!hang,\c!sample,\c!before,\c!inbetween,\c!after,\c!margin,
\c!indenting,\c!indentnext,\c!align,\c!text,\c!distance,\c!titledistance,\c!command]%
\getparameters[\??dd#1]
diff --git a/tex/context/base/core-spa.tex b/tex/context/base/core-spa.tex
index 229f47598..f726174cd 100644
--- a/tex/context/base/core-spa.tex
+++ b/tex/context/base/core-spa.tex
@@ -1621,9 +1621,9 @@
\ifx\allowbreak\undefined
- \def\break {\penalty-\@M}
- \def\nobreak {\penalty \@M}
- \def\allowbreak{\penalty \z@}
+ \def\break {\penalty\ifhmode-\plustenthousand\else\ejectpenalty\fi}
+ \def\nobreak {\penalty \plustenthousand}
+ \def\allowbreak{\penalty \zeropoint}
\def\filbreak {\par\vfil\penalty-200\vfilneg}
\def\goodbreak {\par\penalty-500 }
@@ -1661,7 +1661,7 @@
\ifx\supereject\undefined
- \def\supereject{\par\penalty-\@MM}
+ \def\supereject{\par\penalty\superpenalty}
\fi
@@ -2398,7 +2398,7 @@
% \def\begstrut
% {\relax\ifcase\strutht\else
% \strut
-% \normalpenalty\@M % \!!tenthousand
+% \normalpenalty\plustenthousand
% \normalhskip\zeropoint
% \ignorespaces
% \fi}
@@ -2406,7 +2406,7 @@
% \def\endstrut
% {\relax\ifhmode\ifcase\strutht\else
% \removeunwantedspaces
-% \normalpenalty\@M % \!!tenthousand
+% \normalpenalty\plustenthousand
% \normalhskip\zeropoint
% \strut
% \fi\fi}
@@ -2420,12 +2420,12 @@
{\relax\ifcase\strutht\else
\ifconditional\sigstruts
\noindent\horizontalstrut
- \normalpenalty\@M % \!!tenthousand
+ \normalpenalty\plustenthousand
\normalhskip-\strutsignal
\normalhskip\strutsignal
\else
\strut
- \normalpenalty\@M % \!!tenthousand
+ \normalpenalty\plustenthousand
\normalhskip\zeropoint
\fi
\ignorespaces
@@ -2437,13 +2437,13 @@
\ifdim\lastskip=\strutsignal
\unskip\unskip\unpenalty\setbox\scratchbox\lastbox
\else
- \normalpenalty\@M % \!!tenthousand
+ \normalpenalty\plustenthousand
\normalhskip\zeropoint
\strut
\fi
\else
\removeunwantedspaces
- \normalpenalty\@M % \!!tenthousand
+ \normalpenalty\plustenthousand
\normalhskip\zeropoint
\strut
\fi
@@ -2592,7 +2592,7 @@
\def\keeplinestogether#1%
{\xdef\restoreinterlinepenalty{\global\resetpenalties\interlinepenalties}%
- \global\setpenalties\interlinepenalties{#1}\!!tenthousand}
+ \global\setpenalties\interlinepenalties{#1}\plustenthousand}
\endETEX
@@ -2602,7 +2602,7 @@
{\xdef\restoreinterlinepenalty
{\global\let\restoreinterlinepenalty\relax
\global\interlinepenalty=\the\interlinepenalty}% keep = here
- \global\interlinepenalty\!!tenthousand}
+ \global\interlinepenalty\plustenthousand}
\endTEX
@@ -3672,8 +3672,8 @@
{\hyphenpenalty\the\hyphenpenalty
\exhyphenpenalty\the\exhyphenpenalty\relax}%
\fi
- \hyphenpenalty\@M
- \exhyphenpenalty\@M}
+ \hyphenpenalty\plustenthousand
+ \exhyphenpenalty\plustenthousand}
\let\dohyphens\relax
diff --git a/tex/context/base/m-streams.tex b/tex/context/base/m-streams.tex
new file mode 100644
index 000000000..847f250e9
--- /dev/null
+++ b/tex/context/base/m-streams.tex
@@ -0,0 +1,357 @@
+\ifx\definestreamlayer\undefined \input page-str \fi
+
+%D First we implement a simple left||right synchronization
+%D mechanism, which we may perfect and extend over time.
+
+\unprotect
+
+\defineoutputstream [\v!left]
+\defineoutputstream [\v!right]
+
+\definemarknote[\v!left]
+\definemarknote[\v!right]
+
+\startsetups stream:\v!left:bottom
+ \flushmarknotes[\v!left]
+\stopsetups
+\startsetups stream:\v!right:bottom
+ \flushmarknotes[\v!right]
+\stopsetups
+\startsetups stream:\v!left:reset
+ \erasemarknotes[\v!left]
+\stopsetups
+\startsetups stream:\v!right:reset
+ \erasemarknotes[\v!right]
+\stopsetups
+
+\def\LeftNote {\setmarknote [\v!left]} % {#1}
+\def\RightNote {\setmarknote [\v!right]} % {#1}
+\def\SwitchToLeft {\enableoutputstream [\v!left]}
+\def\SwitchToRight {\enableoutputstream [\v!right]}
+\def\SwitchToNormal {\enableoutputstream [\s!default]}
+\def\SynchronizeLeftAndRight{\synchronizeoutputstreams[\v!left,\v!right]}
+\def\FlushLeftAndRight {\flushoutputstreampages [\v!left,\v!right]}
+
+\protect
+
+% \topskip \strutheight
+% \splittopskip\strutheight
+
+%D Example of usage:
+%D
+%D \starttyping
+%D \nopenalties \setupinterlinespace[top=height] \setupcolors[state=start]
+%D
+%D \showgrid \showstruts
+%D
+%D \starttext
+%D
+%D \title{Whatever} \page
+%D
+%D \dorecurse {5} {
+%D \let\RecurseLevel\recurselevel
+%D \SwitchToLeft \dorecurse{10}{\dontleavehmode{\tf\RecurseLevel:l \begstrut \input tufte \endstrut \endgraf}}
+%D \SwitchToRight \dorecurse{10}{\dontleavehmode{\sl\RecurseLevel:r \begstrut \input knuth \endstrut \endgraf}}
+%D \SwitchToNormal \SynchronizeLeftAndRight
+%D \SwitchToLeft \dorecurse{10}{\dontleavehmode{\bf\RecurseLevel:l \begstrut \input zapf \endstrut \endgraf}}
+%D \SwitchToRight \dorecurse{10}{\dontleavehmode{\bs\RecurseLevel:r \begstrut \input davis \endstrut \endgraf}}
+%D \SwitchToNormal \SynchronizeLeftAndRight
+%D }
+%D \stoptext
+%D \stoptyping
+%D
+%D Another example:
+%D
+%D \starttyping
+%D \nopenalties \setupinterlinespace[top=height] \setupcolors[state=start]
+%D
+%D \showgrid \showstruts
+%D
+%D \starttext
+%D
+%D \SwitchToNormal \FlushLeftAndRight \page
+%D
+%D \def\StartCouple{\page\SwitchToNormal}
+%D \def\StopCouple {\SwitchToNormal \SynchronizeLeftAndRight \FlushLeftAndRight}
+%D
+%D \def\Original {\SwitchToNormal\SynchronizeLeftAndRight\SwitchToLeft}
+%D \def\Translation{\SwitchToRight}
+%D
+%D \StartCouple
+%D \dorecurse{10} {
+%D \Original o: \begstrut \inright{\blackrule}\input tufte \endstrut \LeftNote {tufte} \endgraf
+%D \Translation t: \begstrut \inleft {\blackrule}\input zapf \endstrut \RightNote{zapf} \endgraf
+%D \Original o: \begstrut \inright{\blackrule}\input knuth \endstrut \LeftNote {knuth} \endgraf
+%D \Translation t: \begstrut \inleft {\blackrule}\input davis \endstrut \RightNote{davis} \endgraf
+%D \Original o: \begstrut \inright{\blackrule}\input douglas \endstrut \LeftNote {douglas} \endgraf
+%D \Translation t: \begstrut \inleft {\blackrule}\input bryson \endstrut \RightNote{bryson} \endgraf
+%D }
+%D \StopCouple
+%D \stoptext
+%D \stoptyping
+
+%D Next we implement stream layers.
+
+\unprotect
+
+\startsetups streamlayer:default:settings
+ % set hsize etc
+\stopsetups
+
+\startsetups streamlayer:default:extras
+ % flush goodies, like local floats
+\stopsetups
+
+\startsetups streamlayer:default:place
+ \setlayer
+ [\currentstreamlayer]
+ [\c!preset=\v!left\v!top]
+ {\outputstreambox[\currentstreamlayer]}%
+\stopsetups
+
+\startsetups streamlayer:default:flush
+ \tightlayer[\currentstreamlayer]
+\stopsetups
+
+\def\definestreamlayer
+ {\dodoubleempty\dodefinestreamlayer}
+
+\def\dodefinestreamlayer[#1][#2]%
+ {\defineoutputstream[#1]%
+ \defineoutputstream[main]%
+ \definelayer[#1][\c!method=\v!fit,\c!width=\textwidth,#2]}
+
+\def\dostreamsetups#1%
+ {\doifsetupselse{streamlayer:\currentstreamlayer:#1}
+ {\directsetup{streamlayer:\currentstreamlayer:#1}}
+ {\directsetup{streamlayer:\s!default:#1}}}
+
+\def\startstreamlayer[#1]%
+ {\bgroup
+ \edef\currentstreamlayer{#1}%
+ \enableoutputstream[main]%
+ \synchronizeoutput
+ \enableoutputstream[\currentstreamlayer]%
+ \bgroup
+ \dostreamsetups{settings}}
+
+\def\stopstreamlayer
+ {\endgraf
+ \egroup
+ \disableoutputstream % \enableoutputstream[\s!default]%
+ \outputstreambox[main]%
+ \dostreamsetups{place}%
+ \dostreamsetups{extras}%
+ \dostreamsetups{flush}%
+ \egroup}
+
+\def\flushstreamlayer
+ {\dosingleempty\doflushstreamlayer}
+
+\def\doflushstreamlayer[#1]%
+ {\expanded{\tightlayer[\iffirstargument#1\else\currentstreamlayer\fi]}}
+
+\protect
+
+%D Usage:
+
+%D \starttyping
+%D \setupinterlinespace[top=height]
+%D
+%D \setupcolors[state=start]
+%D
+%D \definestreamlayer[block]
+%D
+%D \definemeasure[localtextwidth] [\dimexpr.7\textwidth\relax]
+%D \definemeasure[localfloatwidth][\dimexpr.3\textwidth-2\bodyfontsize\relax]
+%D
+%D \startsetups streamlayer:block:settings
+%D \hsize=\measure{localtextwidth}
+%D \setupfloat[figure][maxwidth=\measure{localfloatwidth}]
+%D \stopsetups
+%D
+%D \startsetups streamlayer:block:extras
+%D \setuplocalfloats
+%D [before=\blank,
+%D after=\blank,
+%D inbetween=\blank]
+%D \setbox\scratchbox\vbox{\hsize\measure{localfloatwidth}\getlocalfloats}
+%D \ifdim\ht\scratchbox>\thelayerheight\currentstreamlayer\relax
+%D % more float than text
+%D \setlayerframed
+%D [\currentstreamlayer]
+%D [preset=righttop]
+%D [frame=off,
+%D offset=overlay]
+%D {\box\scratchbox}
+%D \else
+%D % more text than float
+%D \setuplocalfloats
+%D [before=\vfill,
+%D after=\removedepth\vfill,
+%D inbetween=\removedepth\vfill]
+%D \setlayerframed
+%D [\currentstreamlayer]
+%D [preset=righttop]
+%D [frame=off,
+%D offset=overlay]
+%D {\vbox to \thelayerheight\currentstreamlayer {\hsize\measure{localfloatwidth}\getlocalfloats}}
+%D \fi
+%D \resetlocalfloats
+%D \stopsetups
+%D
+%D \startsetups streamlayer:block:place
+%D \setlayerframed
+%D [\currentstreamlayer]
+%D [preset=lefttop]
+%D [frame=off,
+%D offset=overlay]
+%D {\outputstreambox[\currentstreamlayer]}%
+%D \stopsetups
+%D
+%D \startsetups streamlayer:block:flush
+%D \framed
+%D [offset=overlay,
+%D frame=off,
+%D background=color,
+%D backgroundcolor=red]
+%D {\tightlayer[\currentstreamlayer]}
+%D \stopsetups
+%D
+%D \setupbodyfont[small]
+%D
+%D \starttext
+%D
+%D \dorecurse {10} {
+%D \startstreamlayer[block]
+%D \title{Sample \recurselevel}
+%D \input tufte \endgraf
+%D \placefigure[local]{}{}
+%D \placefigure[local]{}{}
+%D \ifodd\recurselevel\relax \placefigure[local]{}{} \fi
+%D \startitemize[columns]
+%D \item xxx
+%D \item xxx
+%D \item xxx
+%D \item xxx
+%D \item xxx
+%D \stopitemize
+%D \stopstreamlayer
+%D }
+%D
+%D \dorecurse {10} {
+%D \startstreamlayer[block]
+%D \title{Sample \recurselevel}
+%D \startcolumns
+%D \input tufte
+%D \stopcolumns
+%D \stopstreamlayer
+%D }
+%D
+%D \stoptext
+%D \stoptyping
+
+\endinput
+
+\setupinterlinespace[top=height]
+
+\setupcolors[state=start]
+
+\definestreamlayer[block]
+
+\definemeasure[localtextwidth] [\dimexpr.7\textwidth\relax]
+\definemeasure[localfloatwidth][\dimexpr.3\textwidth-2\bodyfontsize\relax]
+
+\startsetups streamlayer:block:settings
+ \hsize=\measure{localtextwidth}
+ \setupfloat[figure][maxwidth=\measure{localfloatwidth}]
+\stopsetups
+
+\startsetups streamlayer:block:extras
+ \setuplocalfloats
+ [before=\whitespace\blank,
+ after=\whitespace\blank,
+ inbetween=\whitespace\blank]
+ \setbox\scratchbox\vbox{\hsize\measure{localfloatwidth}\getlocalfloats}
+ \ifdim\ht\scratchbox>\thelayerheight\currentstreamlayer\relax
+ % more float than text
+ \setlayerframed
+ [\currentstreamlayer]
+ [preset=righttop]
+ [frame=off,
+ offset=overlay]
+ {\box\scratchbox}
+ \else
+ % more text than float
+ \setuplocalfloats
+ [before=\vfill,
+ after=\removedepth\vfill,
+ inbetween=\removedepth\vfill]
+ \setlayerframed
+ [\currentstreamlayer]
+ [preset=righttop]
+ [frame=off,
+ offset=overlay]
+ {\vbox to \thelayerheight\currentstreamlayer {\hsize\measure{localfloatwidth}\getlocalfloats}}
+ \fi
+ \resetlocalfloats
+\stopsetups
+
+\startsetups streamlayer:block:place
+ \setlayerframed
+ [\currentstreamlayer]
+ [preset=lefttop]
+ [frame=off,
+ offset=overlay]
+ {\outputstreambox[\currentstreamlayer]}%
+\stopsetups
+
+\startsetups streamlayer:block:flush
+ \framed
+ [offset=overlay,
+ frame=off,
+ background=color,
+ backgroundcolor=red]
+ {\tightlayer[\currentstreamlayer]}
+\stopsetups
+
+\setupbodyfont[small]
+
+\starttext
+
+ \startstreamlayer[block]
+ \title{Sample \recurselevel}
+ \startcolumns
+ \dorecurse{4}{\input tufte \par}
+ \stopcolumns
+ \stopstreamlayer
+
+% \stoptext
+
+\dorecurse {10} {
+ \startstreamlayer[block]
+ \title{Sample \recurselevel}
+ \input tufte \endgraf
+ \placefigure[local]{}{}
+ \placefigure[local]{}{}
+ \ifodd\recurselevel\relax \placefigure[local]{}{} \fi
+ \startitemize[columns]
+ \item xxx
+ \item xxx
+ \item xxx
+ \item xxx
+ \item xxx
+ \stopitemize
+ \stopstreamlayer
+}
+
+\dorecurse {10} {
+ \startstreamlayer[block]
+ \title{Sample \recurselevel}
+ \startcolumns
+ \input tufte
+ \stopcolumns
+ \stopstreamlayer
+}
+
+\stoptext
diff --git a/tex/context/base/page-ini.tex b/tex/context/base/page-ini.tex
index 55442fd5e..c41019232 100644
--- a/tex/context/base/page-ini.tex
+++ b/tex/context/base/page-ini.tex
@@ -630,6 +630,9 @@
\fi
+\def\normalejectpenalty{-\@M} \let\ejectpenalty\normalejectpenalty
+\def\normalsuperpenalty{-\@MM} \let\superpenalty\normalsuperpenalty
+
%D In case we're not running \ETEX, we need to bypass a
%D couple of primitives.
@@ -930,8 +933,8 @@
% \def\eject {\par\penalty-\@M } % == {\par\break} % plain
% \def\supereject {\par\penalty-\@MM} % also plain
-\def\eject {\par\ifvmode\penalty-\@M \fi\resetpagebreak} % == {\par\break} % plain
-\def\supereject {\par\ifvmode\penalty-\@MM\fi\resetpagebreak} % also plain
+\def\eject {\par\ifvmode\penalty\ejectpenalty\fi\resetpagebreak} % == {\par\break} % plain
+\def\supereject {\par\ifvmode\penalty\superpenalty\fi\resetpagebreak} % also plain
\def\doejectpage {\par\ifvmode\ifdim\pagetotal>\pagegoal\else\normalvfil\fi\fi}
\def\ejectpage {\doejectpage\eject}
@@ -980,7 +983,7 @@
\penalty\outputpenalty
\fi
% not really needed, replaced by \flushsavedfloats
- \ifnum\outputpenalty>-\@MM \else % better use a proper otr signal
+ \ifnum\outputpenalty>\superpenalty \else % better use a proper otr signal
\dosupereject
\fi
% but does not hurt either (we're still in the otr!)
@@ -1051,7 +1054,7 @@
\resetselectiepagina
\verhoogpaginanummer
\checkpagedimensions
- \ifnum\outputpenalty>-\@MM \else
+ \ifnum\outputpenalty>\superpenalty \else
\dosupereject
\fi
\doflushspread
diff --git a/tex/context/base/page-lyr.tex b/tex/context/base/page-lyr.tex
index 727bbec3f..8c93fe034 100644
--- a/tex/context/base/page-lyr.tex
+++ b/tex/context/base/page-lyr.tex
@@ -130,6 +130,19 @@
\def\currentlayerdata{0}
+\let\currentlayerwidth \!!zeropoint
+\let\currentlayerheight\!!zeropoint
+
+\def\setcurrentlayerdimensions
+ {\dodoubleempty\dosetcurrentlayerdimensions}
+
+\def\dosetcurrentlayerdimensions[#1][#2]% name left|right
+ {\edef\currentlayerwidth {\thelayerwidth {#2#1}}%
+ \edef\currentlayerheight{\thelayerheight{#2#1}}}
+
+\def\thelayerwidth #1{\the\wd\executeifdefined{\@@layerbox#1}\voidbox}
+\def\thelayerheight#1{\the\ht\executeifdefined{\@@layerbox#1}\voidbox}
+
\def\setlayer
{\dotripleempty\dosetlayer}
diff --git a/tex/context/base/page-mul.tex b/tex/context/base/page-mul.tex
index 803392566..1eb1a4e81 100644
--- a/tex/context/base/page-mul.tex
+++ b/tex/context/base/page-mul.tex
@@ -479,7 +479,7 @@
\fi
\appendtoks\topskip1\topskip\to\everybodyfont
\the\everybodyfont % ugly here
-\saveinterlinespace % ugly here
+ \saveinterlinespace % ugly here
\initializecolumns\nofcolumns
\hangafter\zerocount
\hangindent\zeropoint
@@ -1203,13 +1203,16 @@
\global\output{\balancingerror}%
\b@selinebottomtrue % forces depth in separation rule
\flushcolumnedpage
-\ifdim\pagetotal>\textheight
- \eject % new
-\else
- \allowbreak
-\fi
+ \multicolumnseject
\egroup}
+\def\multicolumnseject
+ {\ifdim\pagetotal>\textheight
+ \eject % new
+ \else
+ \allowbreak
+ \fi}
+
%D The multicolumn mechanism is incorporated in a \CONTEXT\
%D interface, which acts like:
%D
@@ -1560,8 +1563,8 @@
% \stopcolumns
\newif\ifinsidecolumns
-\newif\if@@klbalanceren
-\newif\if@@kluitlijnen
+% \newif\if@@klbalanceren
+% \newif\if@@kluitlijnen
\insidecolumnsfalse
diff --git a/tex/context/base/page-str.tex b/tex/context/base/page-str.tex
new file mode 100644
index 000000000..340b1bae6
--- /dev/null
+++ b/tex/context/base/page-str.tex
@@ -0,0 +1,359 @@
+%D \module
+%D [ file=page-str,
+%D version=2006.03.21,
+%D title=\CONTEXT\ Core Macros,
+%D subtitle=Page Streams,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright=PRAGMA-ADE]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+\writestatus{loading}{Context Page Macros / Page Streams}
+
+%D The first version of this component of \CONTEXT\ was written
+%D for Thomas Schmitz who asked for parallel page streams. While
+%D playing with the code, I decided to make it into a component
+%D that can be used to construct all kind of stream related
+%D mechanisms. Because I could apply this feature in a project,
+%D there is some additional code here (related to graphics).
+%D
+%D These macros were written while listening to and watching the DVD
+%D \quotation {Rush In Rio}.
+
+\unprotect
+
+% taco, what is the best way to append a otr chunk (insert pagediscards?)
+
+\let\currentoutputstream\s!default
+
+\newtoks\defaultstreamoutput \defaultstreamoutput=\OTRONEoutput
+
+\newtoks\normalstreamoutput \normalstreamoutput={\saveoutputstream[\currentoutputstream]}
+
+\newcount\streampenalty \streampenalty=-101010101
+
+\ifx\multicolumnseject\undefined \else
+ \let\normalmulticolumnseject\multicolumnseject
+ \def\multicolumnseject{\ifinoutputstream\else\normalmulticolumnseject\fi}
+\fi
+
+\newif\ifinoutputstream
+
+\def\enableoutputstream[#1]%
+ {\finishoutputstream
+ \writestatus{otr}{switching to output stream #1}%
+ \inoutputstreamtrue
+ \xdef\currentoutputstream{#1}}
+
+\def\disableoutputstream
+ {\finishoutputstream
+ \writestatus{otr}{switching to default output stream}%
+ \inoutputstreamfalse
+ \global\let\currentoutputstream\s!default}
+
+\def\useoutputstream[#1]%
+ {\writestatus{otr}{using output stream #1}%
+ \xdef\currentoutputstream{#1}}
+
+\def\handlestreamoutput
+ {\doifelse\currentoutputstream\s!default
+ {\ifnum\outputpenalty=\streampenalty
+ \ifvoid\normalpagebox \else
+ \unvbox\normalpagebox
+ \fi
+ \else
+ \the\defaultstreamoutput
+ \fi}
+ {\the\normalstreamoutput}}
+
+\OTRONEoutput{\handlestreamoutput}
+
+\def\defineoutputstream[#1]%
+ {\doifundefined{otrs:#1}{\expandafter\newbox\csname otrs:#1\endcsname}}
+
+\def\outputstreamtag#1%
+ {\csname otrs:#1\endcsname}
+
+\def\finishoutputstream % todo: installoutput
+ {\endgraf
+ \penalty\streampenalty
+ \endgraf}
+
+\def\saveoutputstream[#1]%
+ {\writestatus{otr}{saving otr stream #1}%
+ \ifvoid\normalpagebox
+ \global\setbox\outputstreamtag{#1}\voidbox
+ \else
+ \global\setbox\outputstreamtag{#1}\vbox
+ {\presetoutputstream
+ \ifvoid\outputstreamtag{#1}\else\unvbox\outputstreamtag{#1}\fi
+ \scratchdimen\dp\normalpagebox
+ \unvbox\normalpagebox
+ \vskip-\scratchdimen
+ \kern\strutdepth}%
+ \fi}
+
+% \def\presetoutputstream
+% {\pdffirstlineheight\strutheight
+% \pdflastlinedepth \strutdepth
+% \pdfeachlineheight \strutheight
+% \pdfeachlinedepth \strutdepth}
+
+\let\presetoutputstream\relax
+
+\def\outputstreambox [#1]{\ifvoid\outputstreamtag{#1}\else\box \outputstreamtag{#1}\fi}
+\def\outputstreamcopy[#1]{\ifvoid\outputstreamtag{#1}\else\copy\outputstreamtag{#1}\fi}
+\def\outputstreamht [#1]{\ht\outputstreamtag{#1}}
+\def\outputstreamdp [#1]{\dp\outputstreamtag{#1}}
+\def\outputstreamwd [#1]{\wd\outputstreamtag{#1}}
+
+%D Footnotes don't go along with streams, simply because there is no
+%D way to re-split inserts. A dirty way out is to use marks and store
+%D notes that way.
+
+\def\definemarknote
+ {\dodoubleempty\dodefinemarknote}
+
+\def\dodefinemarknote[#1][#2]%
+ {\definemarking[mn:#1]%
+ \setvalue{mn:#1:n}{0}%
+ \getparameters
+ [mn:#1]
+ [\c!before=,
+ \c!after=,
+ \c!inbetween=\endgraf,
+ \c!command=\firstofoneargument,
+ #2]}
+
+\def\setmarknote[#1]#2%
+ {\doglobal\incrementvalue{mn:#1:n}%
+ \setgvalue{mn:#1:t:\getvalue{mn:#1:n}}{#1}%
+ \expanded{\marking[#1]{\getvalue{mn:#1:n}}}}
+
+\def\flushmarknotes[#1]% assumes split
+ {\begingroup
+ \edef\firstmarknote{0\fetchmark[mn:#1][column:first]}%
+ \edef\lastmarknote {0\fetchmark[mn:#1][column:last]}%
+ \ifnum\firstmarknote<\lastmarknote\relax
+ \getvalue{mn:#1\c!before}%
+ \dostepwiserecurse\firstmarknote\lastmarknote\plusone
+ {\ifnum\recurselevel>\firstmarknote\relax
+ \ifnum\recurselevel<\lastmarknote\relax
+ \getvalue{mn:#1\c!inbetween}%
+ \fi
+ \fi
+ \getvalue{mn:#1\c!command}{\getvalue{mn:#1:t:\recurselevel}}}%
+ \getvalue{mn:#1\c!after}%
+ \fi
+ \endgroup}
+
+\def\erasemarknotes[#1]%
+ {\begingroup
+ \edef\firstmarknote{0\fetchmark[mn:#1][column:first]}%
+ \edef\lastmarknote {0\fetchmark[mn:#1][column:last]}%
+ \dostepwiserecurse\firstmarknote\lastmarknote\plusone
+ {\global\letvalue{mn:#1:t:\recurselevel}\empty}%
+ \endgroup}
+
+%D The next section implements synchronization of (currently
+%D two) output streams. In due time we will implement both a
+%D vertical and horizontal system, as well as alternative
+%D splitters (firstpagevsize, succesivevsize etc).
+
+\def\synchronizeoutputstreams[#1]% [one,two] [left,right]
+ {\bgroup
+ \getfromcommalist[#1][\plusone]\let\firstoutputstream \commalistelement
+ \getfromcommalist[#1][\plustwo]\let\secondoutputstream\commalistelement
+ \forgeteverypar
+ \def\roundingeps{50sp}%
+ \getboxheight\dimen0\of\box\outputstreamtag\firstoutputstream
+ \getboxheight\dimen2\of\box\outputstreamtag\secondoutputstream
+ \scratchdimen\dimexpr\dimen0-\dimen2\relax
+ \ifdim\scratchdimen<-\roundingeps\relax
+ \scratchdimen-\scratchdimen
+ \writestatus{sync}{compensating first stream: \the\scratchdimen/\number\scratchdimen}%
+ \getroundednoflines\scratchdimen
+ \global\setbox\outputstreamtag\firstoutputstream\vbox
+ {\presetoutputstream
+ \unvbox\outputstreamtag\firstoutputstream\dorecurse\noflines\crlf}%
+ \else\ifdim\scratchdimen>\roundingeps\relax
+ \writestatus{sync}{compensating second stream: \the\scratchdimen/\number\scratchdimen}%
+ \getroundednoflines\scratchdimen
+ \global\setbox\outputstreamtag\secondoutputstream\vbox
+ {\presetoutputstream
+ \unvbox\outputstreamtag\secondoutputstream\dorecurse\noflines\crlf}%
+ \else
+ \writestatus{sync}{no need to compensate streams: \the\scratchdimen/\number\scratchdimen}%
+ \fi\fi
+ \egroup}
+
+\def\nofoutputstreamsplitlines {\v!auto} % {40}
+\def\outputstreamsplittolerance {-5}
+
+\def\flushoutputstreampages[#1]%
+ {\bgroup
+ \getfromcommalist[#1][\plusone]\let\firstoutputstream \commalistelement
+ \getfromcommalist[#1][\plustwo]\let\secondoutputstream\commalistelement
+ \doloop
+ {\flushoutputstreams[#1]%
+ \ifvoid\outputstreamtag\firstoutputstream
+ \ifvoid\outputstreamtag\secondoutputstream
+ \exitloop
+ \else
+ \global\setbox\outputstreamtag\firstoutputstream\vbox{\strut}%
+ \fi
+ \else
+ \ifvoid\outputstreamtag\secondoutputstream
+ \global\setbox\outputstreamtag\secondoutputstream\vbox{\strut}%
+ \else
+ % okay
+ \fi
+ \fi}%
+ \egroup}
+
+\def\flushoutputstreams[#1]%
+ {\bgroup
+ \getfromcommalist[#1][\plusone]\let\firstoutputstream \commalistelement
+ \getfromcommalist[#1][\plustwo]\let\secondoutputstream\commalistelement
+ \doif\nofoutputstreamsplitlines\v!auto
+ {\getrawnoflines\textheight
+ \edef\nofoutputstreamsplitlines{\the\noflines}}%
+ \splittopskip\strutheight
+ \scratchdimen\nofoutputstreamsplitlines\lineheight\relax
+ \unless\iffalse
+ \dimen0\scratchdimen
+ \doloop
+ {\setbox4\copy\outputstreamtag\firstoutputstream
+ \setbox0\vsplit4 to \dimen0
+ \setbox0\vbox
+ {\directsetup{stream:\firstoutputstream:top}%
+ \unvbox0
+ \directsetup{stream:\firstoutputstream:bottom}}%
+ \ifdim\ht0>\scratchdimen
+ \advance\dimen0-\lineheight
+ \else
+ \exitloop
+ \fi}%
+ \scratchdimen\dimen0
+ \dimen2\scratchdimen
+ \doloop
+ {\setbox6\copy\outputstreamtag\secondoutputstream
+ \setbox2\vsplit6 to \dimen2
+ \setbox2\vbox
+ {\directsetup{stream:\secondoutputstream:top}%
+ \unvbox0
+ \directsetup{stream:\secondoutputstream:bottom}}%
+ \ifdim\ht2>\scratchdimen
+ \advance\dimen2-\lineheight
+ \else
+ \exitloop
+ \fi}%
+ \scratchdimen\dimen2
+ \fi
+ \setbox4\copy\outputstreamtag\firstoutputstream
+ \setbox6\copy\outputstreamtag\secondoutputstream
+ \scratchcounter\zerocount
+ \doloop
+ {\setbox0\vsplit4 to \scratchdimen
+ \setbox0\vbox{\unvbox0}%
+ \setbox2\vsplit6 to \scratchdimen
+ \setbox2\vbox{\unvbox2}%
+ \ifvoid4
+ \exitloop
+ \else\ifvoid6
+ \exitloop
+ \else
+ \dimen8=\dimexpr\ht4-\ht6\relax
+ \ifdim\dimen8<\zeropoint\dimen8=-\dimen8\relax\fi
+ \advance\scratchcounter\plusone
+ \ifdim\dimen8<.5\lineheight
+ \exitloop
+ \else\ifnum\outputstreamsplittolerance>\zeropoint
+ \ifnum\scratchcounter>\outputstreamsplittolerance\relax
+ \exitloop
+ \else
+ \advance\scratchdimen\lineheight
+ \fi
+ \else\ifnum\outputstreamsplittolerance<\zeropoint
+ \ifnum-\scratchcounter<\outputstreamsplittolerance\relax
+ \exitloop
+ \else
+ \advance\scratchdimen-\lineheight
+ \fi
+ \else\ifnum\outputstreamsplittolerance=\zeropoint
+ \exitloop
+ \fi\fi\fi\fi
+ \fi\fi}%
+ \setbox0\vsplit\outputstreamtag\firstoutputstream to \scratchdimen
+ \setbox0\vbox to \textheight
+ {\presetoutputstream
+ \directsetup{stream:\firstoutputstream:top}%
+ \unvbox0
+ \vfill
+ \directsetup{stream:\firstoutputstream:bottom}}%
+ \setbox2\vsplit\outputstreamtag\secondoutputstream to \scratchdimen
+ \setbox2\vbox to \textheight
+ {\presetoutputstream
+ \directsetup{stream:\secondoutputstream:top}%
+ \unvbox2
+ \vfill
+ \directsetup{stream:\secondoutputstream:bottom}}%
+ \directsetup{stream:\firstoutputstream:reset}%
+ \directsetup{stream:\secondoutputstream:reset}%
+ \page[even]
+ \box0\vfill\page
+ \box2\vfill\page
+ \egroup}
+
+%D Although one can put floats in a stream, it sometimes makes sense
+%D to keep them apart and this is what local floats do.
+
+\definesystemvariable{lf}
+
+\def\setuplocalfloats
+ {\getparameters[\??lf]}
+
+\setuplocalfloats
+ [%before=\blank,
+ %after=\blank,
+ inbetween=\blank]
+
+\installfloathandler \v!local \somelocalfloat
+
+\initializeboxstack{localfloats}
+
+\newcounter\noflocalfloats
+
+\def\resetlocalfloats
+ {\doglobal\newcounter\noflocalfloats
+ \initializeboxstack{localfloats}}
+
+\def\somelocalfloat[#1]%
+ {\doglobal\increment\noflocalfloats
+ \savebox{localfloats}{\noflocalfloats}{\box\floatbox}}
+
+\def\getlocalfloats
+ {\dorecurse\noflocalfloats
+ {\ifnum\recurselevel=1\relax
+ \getvalue{\??lf\c!before}%
+ \else
+ \getvalue{\??lf\c!inbetween}%
+ \fi
+ \dontleavehmode\hbox{\foundbox{localfloats}\recurselevel}%
+ \ifnum\recurselevel=\noflocalfloats\relax
+ \getvalue{\??lf\c!after}%
+ \fi}}
+
+\def\flushlocalfloats
+ {\getlocalfloats
+ \resetlocalfloats}
+
+\def\getlocalfloat#1{\foundbox{localfloats}{\number#1}}
+
+%D Because many arrangements are possible, we will implement
+%D some examples in a runtime loadable module \type {m-streams}.
+
+\protect \endinput
diff --git a/tex/context/interface/keys-cz.xml b/tex/context/interface/keys-cz.xml
index c728aa677..82044a5d2 100644
--- a/tex/context/interface/keys-cz.xml
+++ b/tex/context/interface/keys-cz.xml
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
-<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="cz" version="2006.03.23 09:57">
+<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="cz" version="2006.03.24 09:16">
<cd:variables>
<cd:variable name="one" value="jedna"/>
diff --git a/tex/context/interface/keys-de.xml b/tex/context/interface/keys-de.xml
index 61c97c2bf..d8511eb20 100644
--- a/tex/context/interface/keys-de.xml
+++ b/tex/context/interface/keys-de.xml
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
-<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="de" version="2006.03.23 09:57">
+<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="de" version="2006.03.24 09:16">
<cd:variables>
<cd:variable name="one" value="eins"/>
diff --git a/tex/context/interface/keys-en.xml b/tex/context/interface/keys-en.xml
index cc667b859..cda8069ed 100644
--- a/tex/context/interface/keys-en.xml
+++ b/tex/context/interface/keys-en.xml
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
-<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="en" version="2006.03.23 09:57">
+<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="en" version="2006.03.24 09:16">
<cd:variables>
<cd:variable name="one" value="one"/>
diff --git a/tex/context/interface/keys-fr.xml b/tex/context/interface/keys-fr.xml
index 016c8f0d8..1d2f336c0 100644
--- a/tex/context/interface/keys-fr.xml
+++ b/tex/context/interface/keys-fr.xml
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
-<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="fr" version="2006.03.23 09:57">
+<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="fr" version="2006.03.24 09:16">
<cd:variables>
<cd:variable name="one" value="un"/>
diff --git a/tex/context/interface/keys-it.xml b/tex/context/interface/keys-it.xml
index d9ba609a7..5b0641029 100644
--- a/tex/context/interface/keys-it.xml
+++ b/tex/context/interface/keys-it.xml
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
-<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="it" version="2006.03.23 09:57">
+<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="it" version="2006.03.24 09:16">
<cd:variables>
<cd:variable name="one" value="uno"/>
diff --git a/tex/context/interface/keys-nl.xml b/tex/context/interface/keys-nl.xml
index 8a13deae5..ed62a3ab7 100644
--- a/tex/context/interface/keys-nl.xml
+++ b/tex/context/interface/keys-nl.xml
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
-<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="nl" version="2006.03.23 09:57">
+<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="nl" version="2006.03.24 09:16">
<cd:variables>
<cd:variable name="one" value="een"/>
diff --git a/tex/context/interface/keys-ro.xml b/tex/context/interface/keys-ro.xml
index 090826724..ad67bf3aa 100644
--- a/tex/context/interface/keys-ro.xml
+++ b/tex/context/interface/keys-ro.xml
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
-<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="ro" version="2006.03.23 09:57">
+<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="ro" version="2006.03.24 09:16">
<cd:variables>
<cd:variable name="one" value="unu"/>