* [NTG-context] streams reversed?
@ 2023-09-13 6:47 jbf
2023-09-14 10:14 ` [NTG-context] " Bruce Horrocks
0 siblings, 1 reply; 7+ messages in thread
From: jbf @ 2023-09-13 6:47 UTC (permalink / raw)
To: mailing list for ConTeXt users
[-- Attachment #1.1: Type: text/plain, Size: 1920 bytes --]
I am making some progress with a bilingual text using the streams
mechanism suggested by Wolfgang: https://wiki.contextgarden.net/Columns,
but see below.
The aim has been to have en and vi on facing pages (en left, vi right).
It works correctly for the Foreword in two languages (en, vi) in
frontmatter.
When I come to bodymatter and Chapter 1, again it works, except that the
positions of the languages are reversed, so I end up with vi on the left
and en on the right. By Chapter 2 we are back to the correct position
once more (en left and vi right).
I want to know why this is happening, and if I can prevent it happening.
I am using the code you can see below, except that instead of
\startoutputstream[one] and \startoutputstream[two] etc. I am using
[en-front][vi-front], and then in bodymatter [en-chap1][vi-chap1] etc.
etc. with the relevant repetitions of these identifiers where needed. I
assume that to get a degree of synchronization I need to use this
approach for each set of chapters. But I cannot understand why the
languages alternate their starting page positions each chapter.
There are other issues I have to solve, but first of all I wish to
resolve this one.
Julian
The original (Wolfgang) code is as follows:
\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
[-- Attachment #1.2: Type: text/html, Size: 4908 bytes --]
[-- Attachment #2: Type: text/plain, Size: 495 bytes --]
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage : https://www.pragma-ade.nl / http://context.aanhet.net
archive : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 7+ messages in thread
* [NTG-context] Re: streams reversed?
2023-09-13 6:47 [NTG-context] streams reversed? jbf
@ 2023-09-14 10:14 ` Bruce Horrocks
2023-09-14 22:04 ` jbf
0 siblings, 1 reply; 7+ messages in thread
From: Bruce Horrocks @ 2023-09-14 10:14 UTC (permalink / raw)
To: ntg-context mailing list
On 13 Sep 2023, at 07:47, jbf <roma83537@gmail.com> wrote:
>
> When I come to bodymatter and Chapter 1, again it works, except that the positions of the languages are reversed, so I end up with vi on the left and en on the right. By Chapter 2 we are back to the correct position once more (en left and vi right).
> I want to know why this is happening, and if I can prevent it happening.
I've modified the sample code you got from Wolfgang to include chapter headings and it all looks fine to me[1] - the red text is all on the right hand side and the greeen text is all on the left. If this doesn't help and you still have problems then you'll need to post a sample that actually shows the problem. I'm using ConTeXt ver: 2023.09.04 19:15.
\starttext
\startoutputstream[one]
\startcolor[red]
\dorecurse{5}{\chapter{Stream One}
\dorecurse{10}{\input knuth\par}
}
\stopcolor
\stopoutputstream
\startoutputstream[two]
\startcolor[green]
\dorecurse{5}{\chapter{Stream Two}
\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
[1] Apart from unnecessary blank pages at the beginning but that's a different problem so I'm not addressing that for now.
—
Bruce Horrocks
Hampshire, UK
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage : https://www.pragma-ade.nl / http://context.aanhet.net
archive : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 7+ messages in thread
* [NTG-context] Re: streams reversed?
2023-09-14 10:14 ` [NTG-context] " Bruce Horrocks
@ 2023-09-14 22:04 ` jbf
2023-09-15 12:43 ` Hamid,Idris
[not found] ` <611158B6-83A3-424A-823C-78CA3C3EAFAD@scorecrow.com>
0 siblings, 2 replies; 7+ messages in thread
From: jbf @ 2023-09-14 22:04 UTC (permalink / raw)
To: Bruce Horrocks, mailing list for ConTeXt users
Bruce, that was kind of you to reply. I think we both know that the
streams mechanism, while 'workable' for the most part, is still in need
of refinement.
It is quite possible that what is causing my problem has less to do with
'streams' per se, and more to do with the use of this mechanism in a
'real book' using frontmatter, bodymatter etc. etc.
Since it would be too long and complicated an MWE to place here in the
list to demonstrate my problem, I will send you the file separately so
you can see the issue: effectively, the streams have worked for
frontmatter (Foreword), but when I get to Chapter 1 in bodymatter, they
are reversed. You will see that. I can't work out why, but you might be
able to see what is causing that.
And of course, I have two other problems to work out before I could use
this in a real production scenario: there is the one you have already
alluded to of extra pages occasionally beforehand (hopefully easily
solvable) but I can see another problem when the text is a lengthy
one... and this is the result of synchronization: when one language (vi)
takes up more space than the other (en), we get an awkward break at the
end of the chapter in en, so that the last line can 'catch up' with the
last paragraph (in vi). Maybe this one will be harder to solve!
Julian
On 14/9/23 20:14, Bruce Horrocks wrote:
> On 13 Sep 2023, at 07:47, jbf <roma83537@gmail.com> wrote:
>> When I come to bodymatter and Chapter 1, again it works, except that the positions of the languages are reversed, so I end up with vi on the left and en on the right. By Chapter 2 we are back to the correct position once more (en left and vi right).
>> I want to know why this is happening, and if I can prevent it happening.
>
> I've modified the sample code you got from Wolfgang to include chapter headings and it all looks fine to me[1] - the red text is all on the right hand side and the greeen text is all on the left. If this doesn't help and you still have problems then you'll need to post a sample that actually shows the problem. I'm using ConTeXt ver: 2023.09.04 19:15.
>
> \starttext
>
> \startoutputstream[one]
> \startcolor[red]
> \dorecurse{5}{\chapter{Stream One}
> \dorecurse{10}{\input knuth\par}
> }
> \stopcolor
> \stopoutputstream
>
> \startoutputstream[two]
> \startcolor[green]
> \dorecurse{5}{\chapter{Stream Two}
> \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
>
>
> [1] Apart from unnecessary blank pages at the beginning but that's a different problem so I'm not addressing that for now.
>
> —
> Bruce Horrocks
> Hampshire, UK
>
>
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to the Wiki!
>
> maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
> webpage : https://www.pragma-ade.nl / http://context.aanhet.net
> archive : https://bitbucket.org/phg/context-mirror/commits/
> wiki : https://contextgarden.net
> ___________________________________________________________________________________
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage : https://www.pragma-ade.nl / http://context.aanhet.net
archive : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 7+ messages in thread
* [NTG-context] Re: streams reversed?
2023-09-14 22:04 ` jbf
@ 2023-09-15 12:43 ` Hamid,Idris
2023-09-15 22:57 ` jbf
[not found] ` <611158B6-83A3-424A-823C-78CA3C3EAFAD@scorecrow.com>
1 sibling, 1 reply; 7+ messages in thread
From: Hamid,Idris @ 2023-09-15 12:43 UTC (permalink / raw)
To: mailing list for ConTeXt users
[-- Attachment #1.1: Type: text/plain, Size: 4025 bytes --]
Hi Julian,
Am also interested in this matter (and played a bit with the code you provided); one suspects that others are as well.
Based on past experience, can affirm that it's sometimes time-consuming, even a pain, to produce an MWE to reproduce the relevant behavior. But it would be well worth the effort for the sake of improving the streams mechanism and clarifying its ultimate limitations.
Even if the final MWE seems too bulky, you could post cloud links to the source and pdf files. Thank you for your contribution.
Best wishes
Idris
------ Original Message ------
From "jbf" <roma83537@gmail.com<mailto:roma83537@gmail.com>>
To "Bruce Horrocks" <ntg@scorecrow.com<mailto:ntg@scorecrow.com>>; "mailing list for ConTeXt users" <ntg-context@ntg.nl<mailto:ntg-context@ntg.nl>>
Date 9/14/2023 4:04:27 PM
Subject [NTG-context] Re: streams reversed?
** Caution: EXTERNAL Sender **
Bruce, that was kind of you to reply. I think we both know that the
streams mechanism, while 'workable' for the most part, is still in need
of refinement.
It is quite possible that what is causing my problem has less to do with
'streams' per se, and more to do with the use of this mechanism in a
'real book' using frontmatter, bodymatter etc. etc.
Since it would be too long and complicated an MWE to place here in the
list to demonstrate my problem, I will send you the file separately so
you can see the issue: effectively, the streams have worked for
frontmatter (Foreword), but when I get to Chapter 1 in bodymatter, they
are reversed. You will see that. I can't work out why, but you might be
able to see what is causing that.
And of course, I have two other problems to work out before I could use
this in a real production scenario: there is the one you have already
alluded to of extra pages occasionally beforehand (hopefully easily
solvable) but I can see another problem when the text is a lengthy
one... and this is the result of synchronization: when one language (vi)
takes up more space than the other (en), we get an awkward break at the
end of the chapter in en, so that the last line can 'catch up' with the
last paragraph (in vi). Maybe this one will be harder to solve!
Julian
On 14/9/23 20:14, Bruce Horrocks wrote:
On 13 Sep 2023, at 07:47, jbf <roma83537@gmail.com<mailto:roma83537@gmail.com>> wrote:
When I come to bodymatter and Chapter 1, again it works, except that the positions of the languages are reversed, so I end up with vi on the left and en on the right. By Chapter 2 we are back to the correct position once more (en left and vi right).
I want to know why this is happening, and if I can prevent it happening.
I've modified the sample code you got from Wolfgang to include chapter headings and it all looks fine to me[1] - the red text is all on the right hand side and the greeen text is all on the left. If this doesn't help and you still have problems then you'll need to post a sample that actually shows the problem. I'm using ConTeXt ver: 2023.09.04 19:15.
\starttext
\startoutputstream[one]
\startcolor[red]
\dorecurse{5}{\chapter{Stream One}
\dorecurse{10}{\input knuth\par}
}
\stopcolor
\stopoutputstream
\startoutputstream[two]
\startcolor[green]
\dorecurse{5}{\chapter{Stream Two}
\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
[1] Apart from unnecessary blank pages at the beginning but that's a different problem so I'm not addressing that for now.
—
Bruce Horrocks
--
Idris Samawi Hamid, Professor
Department of Philosophy
Colorado State University
Fort Collins, CO 80523
[-- Attachment #1.2: Type: text/html, Size: 8205 bytes --]
[-- Attachment #2: Type: text/plain, Size: 495 bytes --]
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage : https://www.pragma-ade.nl / http://context.aanhet.net
archive : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 7+ messages in thread
* [NTG-context] Re: streams reversed?
[not found] ` <611158B6-83A3-424A-823C-78CA3C3EAFAD@scorecrow.com>
@ 2023-09-15 22:55 ` jbf
0 siblings, 0 replies; 7+ messages in thread
From: jbf @ 2023-09-15 22:55 UTC (permalink / raw)
To: Bruce Horrocks; +Cc: mailing list for ConTeXt users
My feeling at the moment is that this might be about the only way one
could go ahead in a production situation, and yes, I am familiar with
PDF tools that can achieve this, though it is effectively stepping aside
from ConTeXt and working with PDF. For that matter I can easily go ahead
with a commercial program that solves all the problems thus far
indicated. I think it is true to say that at the moment, the streams
mechanism is far too klunky to be able to use it extensively. For a
handful of pages (and especially if the two streams re absolutely equal
in length) it is workable. Beyond that, at least for the moment, it is
not, and I am afraid I do not have the luxury of time to try to refine
it. Your efforts, Bruce, are hugely appreciated, but also confirm the
difficulties faced thus far.
Julian
On 15/9/23 22:44, Bruce Horrocks wrote:
> An alternate option, might be to consider producing the body matter as two 'independent' books, one with the pages on the left and page numbered 1,3,5 and the other numbered 2,4,6 and then merge them as PDF pages into the final book. Then merge frontmatter and back matter. If you are reasonably familiar with PDF splitting / joing tools then this might be the simplest solution.
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage : https://www.pragma-ade.nl / http://context.aanhet.net
archive : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 7+ messages in thread
* [NTG-context] Re: streams reversed?
2023-09-15 12:43 ` Hamid,Idris
@ 2023-09-15 22:57 ` jbf
2023-09-17 8:01 ` Hans Hagen via ntg-context
0 siblings, 1 reply; 7+ messages in thread
From: jbf @ 2023-09-15 22:57 UTC (permalink / raw)
To: Hamid,Idris; +Cc: mailing list for ConTeXt users
[-- Attachment #1.1: Type: text/plain, Size: 4327 bytes --]
Thanks Idris.
See my response to Bruce, and indeed his response to mine earlier. I'll
have to leave it at that for now. Too many other matters pressing.
Julian
On 15/9/23 22:43, Hamid,Idris wrote:
> Hi Julian,
>
> Am also interested in this matter (and played a bit with the code you
> provided); one suspects that others are as well.
>
> Based on past experience, can affirm that it's sometimes
> time-consuming, even a pain, to produce an MWE to reproduce the
> relevant behavior. But it would be well worth the effort for the sake
> of improving the streams mechanism and clarifying its ultimate
> limitations.
>
> Even if the final MWE seems too bulky, you could post cloud links to
> the source and pdf files. Thank you for your contribution.
>
> Best wishes
> Idris
>
> ------ Original Message ------
> From "jbf" <roma83537@gmail.com>
> To "Bruce Horrocks" <ntg@scorecrow.com>; "mailing list for ConTeXt
> users" <ntg-context@ntg.nl>
> Date 9/14/2023 4:04:27 PM
> Subject [NTG-context] Re: streams reversed?
>
>> ** Caution: EXTERNAL Sender **
>> Bruce, that was kind of you to reply. I think we both know that the
>> streams mechanism, while 'workable' for the most part, is still in need
>> of refinement.
>> It is quite possible that what is causing my problem has less to do with
>> 'streams' per se, and more to do with the use of this mechanism in a
>> 'real book' using frontmatter, bodymatter etc. etc.
>> Since it would be too long and complicated an MWE to place here in the
>> list to demonstrate my problem, I will send you the file separately so
>> you can see the issue: effectively, the streams have worked for
>> frontmatter (Foreword), but when I get to Chapter 1 in bodymatter, they
>> are reversed. You will see that. I can't work out why, but you might be
>> able to see what is causing that.
>> And of course, I have two other problems to work out before I could use
>> this in a real production scenario: there is the one you have already
>> alluded to of extra pages occasionally beforehand (hopefully easily
>> solvable) but I can see another problem when the text is a lengthy
>> one... and this is the result of synchronization: when one language (vi)
>> takes up more space than the other (en), we get an awkward break at the
>> end of the chapter in en, so that the last line can 'catch up' with the
>> last paragraph (in vi). Maybe this one will be harder to solve!
>> Julian
>> On 14/9/23 20:14, Bruce Horrocks wrote:
>>> On 13 Sep 2023, at 07:47, jbf <roma83537@gmail.com> wrote:
>>>> When I come to bodymatter and Chapter 1, again it works, except
>>>> that the positions of the languages are reversed, so I end up with
>>>> vi on the left and en on the right. By Chapter 2 we are back to the
>>>> correct position once more (en left and vi right).
>>>> I want to know why this is happening, and if I can prevent it
>>>> happening.
>>> I've modified the sample code you got from Wolfgang to include
>>> chapter headings and it all looks fine to me[1] - the red text is
>>> all on the right hand side and the greeen text is all on the left.
>>> If this doesn't help and you still have problems then you'll need to
>>> post a sample that actually shows the problem. I'm using ConTeXt
>>> ver: 2023.09.04 19:15.
>>> \starttext
>>> \startoutputstream[one]
>>> \startcolor[red]
>>> \dorecurse{5}{\chapter{Stream One}
>>> \dorecurse{10}{\input knuth\par}
>>> }
>>> \stopcolor
>>> \stopoutputstream
>>> \startoutputstream[two]
>>> \startcolor[green]
>>> \dorecurse{5}{\chapter{Stream Two}
>>> \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
>>> [1] Apart from unnecessary blank pages at the beginning but that's a
>>> different problem so I'm not addressing that for now.
>>> —
>>> Bruce Horrocks
> --
> Idris Samawi Hamid, Professor
> Department of Philosophy
> Colorado State University
> Fort Collins, CO 80523
[-- Attachment #1.2: Type: text/html, Size: 10550 bytes --]
[-- Attachment #2: Type: text/plain, Size: 495 bytes --]
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage : https://www.pragma-ade.nl / http://context.aanhet.net
archive : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 7+ messages in thread
* [NTG-context] Re: streams reversed?
2023-09-15 22:57 ` jbf
@ 2023-09-17 8:01 ` Hans Hagen via ntg-context
0 siblings, 0 replies; 7+ messages in thread
From: Hans Hagen via ntg-context @ 2023-09-17 8:01 UTC (permalink / raw)
To: ntg-context; +Cc: Hans Hagen
On 9/16/2023 12:57 AM, jbf wrote:
> Thanks Idris.
>
> See my response to Bruce, and indeed his response to mine earlier. I'll
> have to leave it at that for now. Too many other matters pressing.
>
> Julian
This is why mechanism like these never come to completion: it takes
times, experimenting, documenting, basically a cycle that can take a
while. Quite often it stops when some (intermediate) goal is reached and
no more time is available. That lowers the priority.
Hans
-----------------------------------------------------------------
Hans Hagen | PRAGMA ADE
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage : https://www.pragma-ade.nl / http://context.aanhet.net
archive : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2023-09-17 8:08 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-13 6:47 [NTG-context] streams reversed? jbf
2023-09-14 10:14 ` [NTG-context] " Bruce Horrocks
2023-09-14 22:04 ` jbf
2023-09-15 12:43 ` Hamid,Idris
2023-09-15 22:57 ` jbf
2023-09-17 8:01 ` Hans Hagen via ntg-context
[not found] ` <611158B6-83A3-424A-823C-78CA3C3EAFAD@scorecrow.com>
2023-09-15 22:55 ` jbf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).