Re: [NTG-context] Parallel texts: verse with blanks between stanzas via tabulate
> -Ursprüngliche Nachricht- > Von: Hans Hagen > Gesendet: Dienstag, 30. August 2022 14:31 > An: Maier, Denis Christian (UB) ; mailing list for > ConTeXt users > Betreff: Re: AW: [NTG-context] Parallel texts: verse with blanks between > stanzas via tabulate > > On 8/30/2022 1:40 PM, denis.ma...@unibe.ch wrote: > > > Thanks for the updated version. So, that means the basic restriction > > is that blanks will need to be inserted between rows, right? We cannot > > have to two completely independent formatted poems, right? (For > > reference, see the attached PNG. This was done with paragraphs, and > > works as longs as this stays on a single page. One is one long stanza, > > the other one consists of multiple smaller stanzas.) > You need to be more prececise in defining what you want .. this example is not > a parallel obe right? Just two columns. > Sorry for not being precise enough. I'm not sure I understand. This example shows two poems side by side. Both are totally different in structure. One has a heading, and consists of multiple paragraphs. The other is just one long stanza. Until now, I've used tabulate for these kind of sidebyside texts. Usually there are not poems, just regular paragraphs, but with poems I've realized that blanks seem not be supported in individual table cells. Denis \startbuffer[lines1] \startlines[inbetween={\blank}] this is a poem with one longer stanza \stoplines \stopbuffer \startbuffer[lines2] \startlines[inbetween={\blank}] this is a poem with some stanzas here is another one and another one \stoplines \stopbuffer \starttext Just the buffers. One: \getbuffer[lines1] Two: \getbuffer[lines2] Via paragraphs \defineparagraphs[paraverse][n=2 ] \setupparagraphs[paraverse][1][ width=.45\textwidth, distance=2em, align={verytolerant,stretch}] \startparaverse \getbuffer[lines1] \nextparaverse \getbuffer[lines2] \stopparaverse Via tabulate \starttabulate[|p|p|] \NC \getbuffer[lines1] \NC \getbuffer[lines2] \NC\NR \stoptabulate \stoptext ___ 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 ___
Re: [NTG-context] Parallel texts: verse with blanks between stanzas via tabulate
On 8/30/2022 1:40 PM, denis.ma...@unibe.ch wrote: Thanks for the updated version. So, that means the basic restriction is that blanks will need to be inserted between rows, right? We cannot have to two completely independent formatted poems, right? (For reference, see the attached PNG. This was done with paragraphs, and works as longs as this stays on a single page. One is one long stanza, the other one consists of multiple smaller stanzas.) You need to be more prececise in defining what you want .. this example is not a parallel obe right? Just two columns. 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 ___
Re: [NTG-context] Parallel texts: verse with blanks between stanzas via tabulate
> -Ursprüngliche Nachricht- > Von: ntg-context > mailto:ntg-context-boun...@ntg.nl>> Im Auftrag > von Hans Hagen > via ntg-context > Gesendet: Montag, 29. August 2022 13:58 > An: ntg-context@ntg.nl<mailto:ntg-context@ntg.nl> > Cc: Hans Hagen mailto:j.ha...@xs4all.nl>> > Betreff: Re: [NTG-context] Parallel texts: verse with blanks between stanzas > via tabulate > > On 8/29/2022 1:31 PM, Denis Maier via ntg-context wrote: > >> -Ursprüngliche Nachricht- > >> Von: Hans Hagen mailto:j.ha...@freedom.nl>> > >> Gesendet: Sonntag, 28. August 2022 10:41 > >> An: mailing list for ConTeXt users > >> mailto:ntg-context@ntg.nl>> > >> Cc: Maier, Denis Christian (UB) > >> mailto:denis.ma...@unibe.ch>> > >> Betreff: Re: [NTG-context] Parallel texts: verse with blanks between > >> stanzas via tabulate > >> > >> On 8/27/2022 11:25 PM, Denis Maier via ntg-context wrote: > >>> Thanks, Wolfgang. That gives me a blank between the verses. However > >>> the > >> blank is rather huge and I don't see how I could make it smaller? Is > >> it possible to do this? > >> morning exercise attached (you can run the file) > >> > >> Hans > > > > Another, more general question on this: why is the function > poetry.sidebyside defined twice? If I understand correctly, depending on the > input one or the other will be used, but I don't see where that happens... > the first can be commented as it is the first simple variant > I see. Thanks for the updated version. So, that means the basic restriction is that blanks will need to be inserted between rows, right? We cannot have to two completely independent formatted poems, right? (For reference, see the attached PNG. This was done with paragraphs, and works as longs as this stays on a single page. One is one long stanza, the other one consists of multiple smaller stanzas.) Denis ___ 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 ___
Re: [NTG-context] Parallel texts: verse with blanks between stanzas via tabulate
On 8/29/2022 1:31 PM, Denis Maier via ntg-context wrote: -Ursprüngliche Nachricht- Von: Hans Hagen Gesendet: Sonntag, 28. August 2022 10:41 An: mailing list for ConTeXt users Cc: Maier, Denis Christian (UB) Betreff: Re: [NTG-context] Parallel texts: verse with blanks between stanzas via tabulate On 8/27/2022 11:25 PM, Denis Maier via ntg-context wrote: Thanks, Wolfgang. That gives me a blank between the verses. However the blank is rather huge and I don't see how I could make it smaller? Is it possible to do this? morning exercise attached (you can run the file) Hans Another, more general question on this: why is the function poetry.sidebyside defined twice? If I understand correctly, depending on the input one or the other will be used, but I don't see where that happens... the first can be commented as it is the first simple variant 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 -%D \module %D [ file=m-poetry, %Dversion=2022.08.28 %D title=\CONTEXT\ Extra Modules, %D subtitle=Whatever comes up, %D author=Hans Hagen, %D date=\currentdate, %D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] %C %C This module is part of the \CONTEXT\ macro||package and is %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. % For Denis Maier (see mails to list end of August 2022) \startluacode local poetry = moduledata.poetry or { } moduledata.poetry = poetry -- function poetry.sidebyside(specification) -- local first = string.splitlines(buffers.getcontent(specification.left)) -- local second = string.splitlines(buffers.getcontent(specification.right)) -- local template = specification.template or "|||" -- context.starttabulate { template } -- for i=1,#first do -- local f = first [i] or "" -- local s = second[i] or "" -- if f == "" and s == "" then -- context.TB { "medium" } -- else -- context.NC() context(f) -- context.NC() context(s) -- context.NC() context.NR() -- end -- end -- context.stoptabulate() -- end function poetry.sidebyside(specification) local left= specification.left local right = specification.right local first = left and string.splitlines(buffers.getcontent(left )) or { } local second = right and string.splitlines(buffers.getcontent(right)) or { } if #first > 0 and #second == 0 then for i=1,#first do local t = string.split(first[i], "|") first[i] = string.strip(t[1] or "") second[i] = string.strip(t[2] or "") end end local template = specification.template or "|||" context.starttabulate { template } local fi = 1 local si = 1 local n = #first > #second and #first or #second local function flush(f,s) context.NC() context(f) context.NC() context(s) context.NC() context.NR() if f ~= "" then fi = fi + 1 end if s ~= "" then si = si + 1 end end while fi <= n and si <= n do local f = first [fi] or "" local s = second[si] or "" if f ~= "" and s ~= "" then flush(f,s) else while true do if f ~= "" or s ~= "" then flush(f,s) else while f == "" do fi = fi + 1 f = first [fi] or "" end while s == "" do si = si + 1 s = second[si] or "" end break end f = first [fi] or "" s = second[si] or "" end -- context.HL() context.TB { "medium" } end end context.stoptabulate() end interfaces.implement { name = "poetrysidebyside", protected = true, public= true, actions = poetry.sidebyside, arguments = "hash", } \stopluacode \continueifinputfile{m-poetry.mkxl} \starttext \starttext \startbuffer
Re: [NTG-context] Parallel texts: verse with blanks between stanzas via tabulate
> -Ursprüngliche Nachricht- > Von: Hans Hagen > Gesendet: Sonntag, 28. August 2022 10:41 > An: mailing list for ConTeXt users > Cc: Maier, Denis Christian (UB) > Betreff: Re: [NTG-context] Parallel texts: verse with blanks between stanzas > via tabulate > > On 8/27/2022 11:25 PM, Denis Maier via ntg-context wrote: > > Thanks, Wolfgang. That gives me a blank between the verses. However the > blank is rather huge and I don't see how I could make it smaller? Is it > possible > to do this? > morning exercise attached (you can run the file) > > Hans Another, more general question on this: why is the function poetry.sidebyside defined twice? If I understand correctly, depending on the input one or the other will be used, but I don't see where that happens... Best, Denis ___ 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 ___
Re: [NTG-context] Parallel texts: verse with blanks between stanzas via tabulate
Thanks Hans, that's very nice indeed. Looks like I really need to dive into CLD. There seem to be so many possibilies... However, the major pitfall seems to be that this assumes stanzas of equal length (as it relies on \TB to produce the blanks), which does not apply to my situation. (Modfied version attached.) Do you see any way to support this kind of situation? Best, Denis > -Ursprüngliche Nachricht- > Von: Hans Hagen > Gesendet: Sonntag, 28. August 2022 10:41 > An: mailing list for ConTeXt users > Cc: Maier, Denis Christian (UB) > Betreff: Re: [NTG-context] Parallel texts: verse with blanks between stanzas > via tabulate > > On 8/27/2022 11:25 PM, Denis Maier via ntg-context wrote: > > Thanks, Wolfgang. That gives me a blank between the verses. However the > blank is rather huge and I don't see how I could make it smaller? Is it > possible > to do this? > morning exercise attached (you can run the file) > > 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 > - m-poetry.mkxl Description: m-poetry.mkxl ___ 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 ___
Re: [NTG-context] Parallel texts: verse with blanks between stanzas via tabulate
On 8/27/2022 11:25 PM, Denis Maier via ntg-context wrote: Thanks, Wolfgang. That gives me a blank between the verses. However the blank is rather huge and I don't see how I could make it smaller? Is it possible to do this? morning exercise attached (you can run the file) 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 -%D \module %D [ file=m-poetry, %Dversion=2022.08.28 %D title=\CONTEXT\ Extra Modules, %D subtitle=Whatever comes up, %D author=Hans Hagen, %D date=\currentdate, %D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] %C %C This module is part of the \CONTEXT\ macro||package and is %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. % For Denis Maier (see mails to list end of August 2022) \startluacode local poetry = moduledata.poetry or { } moduledata.poetry = poetry function poetry.sidebyside(specification) local first = string.splitlines(buffers.getcontent(specification.left)) local second = string.splitlines(buffers.getcontent(specification.right)) local template = specification.template or "|||" context.starttabulate { template } for i=1,#first do local f = first [i] or "" local s = second[i] or "" if f == "" and s == "" then context.TB { "medium" } else context.NC() context(f) context.NC() context(s) context.NC() context.NR() end end context.stoptabulate() end function poetry.sidebyside(specification) local left= specification.left local right = specification.right local first = left and string.splitlines(buffers.getcontent(left )) or { } local second = right and string.splitlines(buffers.getcontent(right)) or { } if #first > 0 and #second == 0 then for i=1,#first do local t = string.split(first[i], "|") first[i] = string.strip(t[1] or "") second[i] = string.strip(t[2] or "") end end local template = specification.template or "|||" context.starttabulate { template } for i=1,#first do local f = first [i] or "" local s = second[i] or "" if f == "" and s == "" then context.TB { "medium" } else context.NC() context(f) context.NC() context(s) context.NC() context.NR() end end context.stoptabulate() end interfaces.implement { name = "poetrysidebyside", protected = true, public= true, actions = poetry.sidebyside, arguments = "hash", } \stopluacode \continueifinputfile{m-poetry.mkxl} \starttext \startbuffer[lines-1] THIS IS A POEM WITH TWO STANZAS \stopbuffer \startbuffer[lines-2] this is a poem with two stanzas \stopbuffer \startbuffer[lines-3] this | THIS is | IS a| A poem | POEM | with | WITH two | TWO stanzas | STANZAS \stopbuffer \ctxlua { moduledata.poetry.sidebyside { left = "lines-1", right= "lines-2", template = "|l|i2r|" } } \ctxlua { moduledata.poetry.sidebyside { left = "lines-3", template = "|r|il|" } } \poetrysidebyside [left=lines-3, template={|r|il|}] \stoptext ___ 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 ___
Re: [NTG-context] Parallel texts: verse with blanks between stanzas via tabulate
Thanks, Wolfgang. That gives me a blank between the verses. However the blank is rather huge and I don't see how I could make it smaller? Is it possible to do this? Denis > -Ursprüngliche Nachricht- > Von: ntg-context Im Auftrag von Wolfgang > Schuster via ntg-context > Gesendet: Samstag, 27. August 2022 09:27 > An: mailing list for ConTeXt users > Cc: Wolfgang Schuster > Betreff: Re: [NTG-context] Parallel texts: verse with blanks between stanzas > via tabulate > > Denis Maier via ntg-context schrieb am 27.08.2022 um 09:17: > > Thanks. I'll try that. But, iirc, these had some other drawbacks I'll > > check > if it works for my use case. > > > > Is there a way to have blanks in the tabulate? > > \startlines[inbetween={\dontleavehmode\crlf}] > ... > > Wolfgang > > __ > _ > 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 ___
Re: [NTG-context] Parallel texts: verse with blanks between stanzas via tabulate
> -Ursprüngliche Nachricht- > Von: ntg-context Im Auftrag von Henning > Hraban Ramm via ntg-context > Gesendet: Freitag, 26. August 2022 23:27 > An: Denis Maier via ntg-context > Cc: Henning Hraban Ramm > Betreff: Re: [NTG-context] Parallel texts: verse with blanks between stanzas > via tabulate > > Am 26.08.22 um 22:00 schrieb Denis Maier via ntg-context: > > Hi, > > > > I need to typeset two poems side by side. Usually, I use the tabulate > > environment for typesetting parallel texts. However, for poems this > > does not quite work as tabulate does not seem to allow blanks between > > the stanzas. See MWE below. Am I missing someting? Is there a better > > way to achieve this? > > How about columnsets or paragraphs? > > \definecolumnset[Zwei][n=2] > \startcolumnset[Zwei] > \startlines > Starlight, star bright, > first star I see tonight; > \stoplines > \column > \startlines > I wish I may, I wish I might > have the wish I wish tonight. > \stoplines > \stopcolumnset > > > \defineparagraphs[Zwei][n=2] > \setupparagraphs[Zwei][1][ >width=.45\textwidth, distance=2em, >align={verytolerant,stretch}] > % width of 2nd column is calculated automatically > > \startZwei > ... > \nextZwei > ... > \stopZwei > > Ok, I've had a chance to look into this. Maybe I'm missing something, but paragraphs cannot be split across pages. Is that correct? That's a bit of a problem. As for columnsets, they seem to change the output routine for the entire page. Also not ideal in this case. Denis ___ 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 ___
Re: [NTG-context] Parallel texts: verse with blanks between stanzas via tabulate
Denis Maier via ntg-context schrieb am 27.08.2022 um 09:17: Thanks. I'll try that. But, iirc, these had some other drawbacks I'll check if it works for my use case. Is there a way to have blanks in the tabulate? \startlines[inbetween={\dontleavehmode\crlf}] ... Wolfgang ___ 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 ___
Re: [NTG-context] Parallel texts: verse with blanks between stanzas via tabulate
Thanks. I'll try that. But, iirc, these had some other drawbacks I'll check if it works for my use case. Is there a way to have blanks in the tabulate? Denis Von: ntg-context im Auftrag von Henning Hraban Ramm via ntg-context Gesendet: Freitag, 26. August 2022 23:26:56 An: Denis Maier via ntg-context Cc: Henning Hraban Ramm Betreff: Re: [NTG-context] Parallel texts: verse with blanks between stanzas via tabulate Am 26.08.22 um 22:00 schrieb Denis Maier via ntg-context: > Hi, > > I need to typeset two poems side by side. Usually, I use the tabulate > environment for typesetting parallel texts. However, for poems this does > not quite work as tabulate does not seem to allow blanks between the > stanzas. See MWE below. Am I missing someting? Is there a better way to > achieve this? How about columnsets or paragraphs? \definecolumnset[Zwei][n=2] \startcolumnset[Zwei] \startlines Starlight, star bright, first star I see tonight; \stoplines \column \startlines I wish I may, I wish I might have the wish I wish tonight. \stoplines \stopcolumnset \defineparagraphs[Zwei][n=2] \setupparagraphs[Zwei][1][ width=.45\textwidth, distance=2em, align={verytolerant,stretch}] % width of 2nd column is calculated automatically \startZwei ... \nextZwei ... \stopZwei Hraban ___ 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 ___
Re: [NTG-context] Parallel texts: verse with blanks between stanzas via tabulate
Am 26.08.22 um 22:00 schrieb Denis Maier via ntg-context: Hi, I need to typeset two poems side by side. Usually, I use the tabulate environment for typesetting parallel texts. However, for poems this does not quite work as tabulate does not seem to allow blanks between the stanzas. See MWE below. Am I missing someting? Is there a better way to achieve this? How about columnsets or paragraphs? \definecolumnset[Zwei][n=2] \startcolumnset[Zwei] \startlines Starlight, star bright, first star I see tonight; \stoplines \column \startlines I wish I may, I wish I might have the wish I wish tonight. \stoplines \stopcolumnset \defineparagraphs[Zwei][n=2] \setupparagraphs[Zwei][1][ width=.45\textwidth, distance=2em, align={verytolerant,stretch}] % width of 2nd column is calculated automatically \startZwei ... \nextZwei ... \stopZwei Hraban ___ 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 ___
[NTG-context] Parallel texts: verse with blanks between stanzas via tabulate
Hi, I need to typeset two poems side by side. Usually, I use the tabulate environment for typesetting parallel texts. However, for poems this does not quite work as tabulate does not seem to allow blanks between the stanzas. See MWE below. Am I missing someting? Is there a better way to achieve this? Best, Denis %%% \startbuffer[lines] \startlines[after={\blank}] this is a poem with two stanzas \stoplines \stopbuffer \starttext With a blank between the stanzas: \getbuffer[lines] Without a blank between the stanzas: \starttabulate[|p|p|] \NC \getbuffer[lines] \NC \getbuffer[lines] \NC\NR \stoptabulate \stoptext %%% ___ 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 ___