[NTG-context] Different text versions in columns?

Wolfgang Schuster schuster.wolfgang at gmail.com
Sun Nov 27 14:13:57 CET 2016


> Arthur Reutenauer <mailto:arthur.reutenauer at normalesup.org>
> 26. November 2016 um 00:14
>> 1. Streams work in MkIV
>> 2. The MkIV version has a command to set sync points.
>
>    That’s \pushoutputstreams, I presume.
Yes, you can use it to create paragraphs of equal height in different 
streams.

\setupbodyfont[tt]

\starttext

\startoutputstream[one]
     \setupalign[flushleft]
     \dorecurse{3}{Line \recurselevel\par}\pushoutputstream
     \blank
     \dorecurse{6}{Line \recurselevel\par}\pushoutputstream
     \blank
     \dorecurse{4}{Line \recurselevel\par}\pushoutputstream
\stopoutputstream

\startoutputstream[two]
     \setupalign[flushright]
     \dorecurse{5}{Line \recurselevel\par}\pushoutputstream
     \blank
     \dorecurse{2}{Line \recurselevel\par}\pushoutputstream
     \blank
     \dorecurse{7}{Line \recurselevel\par}\pushoutputstream
\stopoutputstream

\synchronizestreams[one,two]

\startoverlay
     {\outputstreambox[one]}
     {\raise2\strutdp\outputstreambox[two]}
\stopoverlay

\stoptext

>> Only the mechanism to create pages/columns for the stream content is
>> missing.
>
>    Can you elaborate a bit?  I’m having the following use case in mind:
> exactly two streams, one on even-numbered pages, the other on the
> odd-numbered ones, with infrequent synchronisations.  The two streams
> could run in parallel, facing each other on the spread, and only be
> resynchronised every 5 or 10 pages, say.  Is that currently not
> possible?
You can save text and flush it afterwards but there is no command which
places the content side by side (or in columns). Below is a simple example
but I had to write the splitter myself.

\starttext

\startoutputstream[one]
     \startcolor[red]
     \dorecurse{10}{\input knuth\par}
     \stopcolor
\stopoutputstream

\startoutputstream[two]
     \startcolor[green]
     \dorecurse{10}{\input zapf\par}
     \stopcolor
\stopoutputstream

\synchronizestreams[one,two]

\setbox\scratchboxone\outputstreambox[one]
\setbox\scratchboxtwo\outputstreambox[two]

\doloop
   {\ifvoid\scratchboxone
      \exitloop
    \else
      \setbox\scratchboxfour\vsplit\scratchboxone to \textheight
      \vbox to \vsize{\box\scratchboxfour\vss}%
      \setbox\scratchboxfive\vsplit\scratchboxtwo to \textheight
      \vbox to \vsize{\box\scratchboxfive\vss}%
    \fi}

\stoptext

Wolfgang


More information about the ntg-context mailing list