* [NTG-context] understanding \writetolist and \writebetweenlist
@ 2024-12-13 20:52 Henning Hraban Ramm
2024-12-15 14:20 ` [NTG-context] " Bruce Horrocks
0 siblings, 1 reply; 3+ messages in thread
From: Henning Hraban Ramm @ 2024-12-13 20:52 UTC (permalink / raw)
To: mailing list for ConTeXt users
Hi,
I’m trying to understand the ordering of list entries and find it really
hard.
Below is the content of "inbetween-01.tex" from the test suite, more or
less the same was in
https://wiki.contextgarden.ne/Command/writebetweenlist; I tried to
enhance it but probably messed it up.
Looking at the examples, I only partly understand what’s going on.
* What’s the difference of \writetolist and \writebetweenlist WRT their
connection to the place where they occur? This seems to be important.
(\writetolist has a section number, \writebetweenlist hasn’t …)
* What’s the difference between location="here", "none" or nothing with
\writetolist?
* In my notes, I found the remark that "between" items should be
anchored to a paragraph (not being their own par) to avoid inserting
whitespace.
* The order of \placelist can be normal, command, all or title. The
latter isn’t mentioned in the file below, but in the interface. I don’t
understand the effect for "normal" or "all" in the example.
- normal: there’s some reordering.
- command: "only the commands": does this mean, sort the "between"
entries by macro name or how?
- all: everything in the order of occurrence (that’s clear)
- title: sorted by title; how does this affect "between" entries?
Hraban
""" % inbetween-01.tex
\definelist[testlist][criterium=all]
\starttext
Regular list entries are bound to a specific location in order to
get the right pagenumber etc.\ associated. When pushing something
inbetween (in mkiv) it ends up directly in the list. This is the
default because otherwise users will wonder why spacing might get
messed up (due to an unseen but present node). It is possible to
force a location by explicitly setting \type {location} to \type
{here}.
Another way to force a certain order is to set the \type {order}
variable when placing a list. The \type {command} option only
pushes commands into the right order, and \type {all} orders all
entries (which might be too much). In this case no specific
location is needed with the inbetween method. Maybe additional
mechanisms show up some day.
\subject{normal} \placelist[testlist]
\subject{command} \placelist[testlist][order=command]
\subject{all} \placelist[testlist][order=all]
\page \input tufte
\writetolist [testlist] {1} {One}
\writebetweenlist[testlist]
{\blackrule[color=red,width=\hsize]}
\writebetweenlist[testlist][location=here]{\blackrule[color=blue,width=\hsize]}
\writetolist [testlist] {2} {Second}
\writetolist [testlist][location=none]{W} {Whatever}
\writebetweenlist[testlist]
{\blackrule[color=green,width=\hsize]}
\stoptext
"""
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 3+ messages in thread
* [NTG-context] Re: understanding \writetolist and \writebetweenlist
2024-12-13 20:52 [NTG-context] understanding \writetolist and \writebetweenlist Henning Hraban Ramm
@ 2024-12-15 14:20 ` Bruce Horrocks
2024-12-17 9:04 ` Henning Hraban Ramm
0 siblings, 1 reply; 3+ messages in thread
From: Bruce Horrocks @ 2024-12-15 14:20 UTC (permalink / raw)
To: ntg-context mailing list
On 13 Dec 2024, at 20:52, Henning Hraban Ramm <texml@fiee.net> wrote:
>
> Hi,
> I’m trying to understand the ordering of list entries and find it really hard.
There might be a bug. With no order option specified the first \writebetweenlist is positioned after the following item. It appears correctly when order=command or order=all is specified.
>
> Below is the content of "inbetween-01.tex" from the test suite, more or less the same was in https://wiki.contextgarden.ne/Command/writebetweenlist; I tried to enhance it but probably messed it up.
> Looking at the examples, I only partly understand what’s going on.
>
> * What’s the difference of \writetolist and \writebetweenlist WRT their connection to the place where they occur? This seems to be important.
> (\writetolist has a section number, \writebetweenlist hasn’t …)
As far as I can tell the only difference is that \writebetweenlist has no number. Otherwise it appears in the list in the order it appears in the document source.
> * What’s the difference between location="here", "none" or nothing with \writetolist?
From the comments in source of strc-lst.mkxl (line 105) it looks like it was something introduced to deal with an issue in mkiv that no longer applies? Hard to tell without comparing both versions in detail. I can't create a test example that shows a difference.
> * In my notes, I found the remark that "between" items should be anchored to a paragraph (not being their own par) to avoid inserting whitespace.
Ditto re the source comments.
> * The order of \placelist can be normal, command, all or title. The latter isn’t mentioned in the file below, but in the interface. I don’t understand the effect for "normal" or "all" in the example.
> - normal: there’s some reordering.
> - command: "only the commands": does this mean, sort the "between" entries by macro name or how?
> - all: everything in the order of occurrence (that’s clear)
> - title: sorted by title; how does this affect "between" entries?
I'm guessing that the text of between entries counts as the title for sorting purposes. Perhaps "here" was meant to attach to the previous \writetolist for sorting purposes?
I can't get sorting to work at all as per this example:
\definelist[testlist][criterium=all]
\starttext
\subject{normal}
\placelist[testlist]
\subject{order=command}
\placelist[testlist][order=command]
\subject{order=all}
\placelist[testlist][order=all]
\page
\writetolist[testlist]{2}{Second}
\writebetweenlist[testlist]{betweenlist entry after second}
The text of the second list item starts here.
\page
\writetolist[testlist]{1}{First}
\writebetweenlist[testlist]{betweenlist entry after first}
The text of the first list item starts here.
\stoptext
—
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://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 3+ messages in thread
* [NTG-context] Re: understanding \writetolist and \writebetweenlist
2024-12-15 14:20 ` [NTG-context] " Bruce Horrocks
@ 2024-12-17 9:04 ` Henning Hraban Ramm
0 siblings, 0 replies; 3+ messages in thread
From: Henning Hraban Ramm @ 2024-12-17 9:04 UTC (permalink / raw)
To: ntg-context
Am 15.12.24 um 15:20 schrieb Bruce Horrocks:
> On 13 Dec 2024, at 20:52, Henning Hraban Ramm <texml@fiee.net> wrote:
>>
>> Hi,
>> I’m trying to understand the ordering of list entries and find it really hard.
>
> There might be a bug. With no order option specified the first \writebetweenlist is positioned after the following item. It appears correctly when order=command or order=all is specified.
>
>>
>> Below is the content of "inbetween-01.tex" from the test suite, more or less the same was in https://wiki.contextgarden.ne/Command/writebetweenlist; I tried to enhance it but probably messed it up.
>> Looking at the examples, I only partly understand what’s going on.
>>
>> * What’s the difference of \writetolist and \writebetweenlist WRT their connection to the place where they occur? This seems to be important.
>> (\writetolist has a section number, \writebetweenlist hasn’t …)
>
> As far as I can tell the only difference is that \writebetweenlist has no number. Otherwise it appears in the list in the order it appears in the document source.
>
>> * What’s the difference between location="here", "none" or nothing with \writetolist?
>
> From the comments in source of strc-lst.mkxl (line 105) it looks like it was something introduced to deal with an issue in mkiv that no longer applies? Hard to tell without comparing both versions in detail. I can't create a test example that shows a difference.
>
>> * In my notes, I found the remark that "between" items should be anchored to a paragraph (not being their own par) to avoid inserting whitespace.
>
> Ditto re the source comments.
>
>> * The order of \placelist can be normal, command, all or title. The latter isn’t mentioned in the file below, but in the interface. I don’t understand the effect for "normal" or "all" in the example.
>> - normal: there’s some reordering.
>> - command: "only the commands": does this mean, sort the "between" entries by macro name or how?
>> - all: everything in the order of occurrence (that’s clear)
>> - title: sorted by title; how does this affect "between" entries?
>
> I'm guessing that the text of between entries counts as the title for sorting purposes. Perhaps "here" was meant to attach to the previous \writetolist for sorting purposes?
>
> I can't get sorting to work at all as per this example:
>
>
> \definelist[testlist][criterium=all]
> \starttext
>
> \subject{normal}
> \placelist[testlist]
>
> \subject{order=command}
> \placelist[testlist][order=command]
>
> \subject{order=all}
> \placelist[testlist][order=all]
>
> \page
>
> \writetolist[testlist]{2}{Second}
> \writebetweenlist[testlist]{betweenlist entry after second}
> The text of the second list item starts here.
> \page
>
> \writetolist[testlist]{1}{First}
> \writebetweenlist[testlist]{betweenlist entry after first}
> The text of the first list item starts here.
>
> \stoptext
Without "inbetween" entries:
* order=title works for section titles, but not for an arbitrary "testlist".
* I can’t find any effect of "order" on "testlist"
With "inbetween" entries:
* With order=title, the section order is totally messed up, and I still
see no effect on the testlist.
* With order=normal (or without "order"), injections get on top of the
section list (which is in order of appearance); in the testlist not all
inbetweens show up, order is unaffected.
* With order=all or order=command, the order of normal and inbetween
entries in both lists is "appearance"; I don’t see a difference.
* \writebetweenlist with [location=here] stays in the right place, if
order is not given, "normal" or "title".
Conclusion:
* order=title works only for section titles without injections.
* Use order=all or order=command for lists with injections or
location=here for each injection to keep their order of appearance.
Hraban
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-12-17 9:12 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-12-13 20:52 [NTG-context] understanding \writetolist and \writebetweenlist Henning Hraban Ramm
2024-12-15 14:20 ` [NTG-context] " Bruce Horrocks
2024-12-17 9:04 ` Henning Hraban Ramm
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).