Hi Jean-Pierre (et al)
On Tue, Nov 25, 2025 at 18:32 (+0100), Jean-Pierre Delange via ntg-context
wrote:
> Hi Jim,
> Well ... it seem that the wiki example is uncompletely written. What's the
> problem?
> * The second argument of |\writetolist[Reprints]{1.}{...}| (the “1.”)
> is indeed *stored* in the list, but the default formatting of
> the| Reprints list**|*does not display* this field.
Thanks for enlightening me. I could argue that the default formatting for
this list violates the law of least astonishment, but my argument would be
from a position of n00b-ness, so I probably shouldn't go there. No doubt
it is related to the fact that "my intuitions lack calibration".
(Taken from the wiki. :-)
But (without poring over the code...), part of why I am astonished is that
the default table of contents format shows a page number (for \section,
\subsection, ...), and if one adds an entry with \writetolist *with* a page
number, wouldn't it be natural to display that? If I didn't want the
number to be displayed, I wouldn't have gone to the effort of typing it in.
Your answer clarifies things quite well for the "Reprints" list case.
> * So this is neither a ConTeXt bug nor “your fault”: the wiki example
> is simply incomplete/misleading because it does not show how to
> configure |\setuplist| to use the first argument. You have to tell
> ConTeXt how to display the list items, via
>>\setuplist[Reprints][command=...]|.
> Then, try this MWE :
<snip>
> \setuplist
> [Reprints]
> [alternative=command,
> command=\ReprintsEntry]
Interesting side note for anyone reading this in the future:
I copied and pasted your example into a file and ran ConTeXT on it, and
when I pasted it (in my usual way) I got blank lines as above. Which
caused a spurious ']' to appear on page 1, and also caused your MWE to be a
M*N*WE. Which is part of the reason it took me so long to respond.
<snip>
Having removed the above-noted blank lines, your example works perfectly.
Thank you very much for your help, it is much appreciated.
...
However, my original problem which I was trying to solve before I emailed
this list was the following...
If I have
\setupcombinedlist [content]
[list={chapter,title,section,subject,subsection,subsubject}]
and place the TOC with
\completecontent
somewhere, then in the TOC the sections are numbered. All is good.
But suppose, for some devious reason, I want to add an entry to the
"section" list, without using the \section commend. So I might try
\writetolist[section]{1.}{Deviously inserted list entry A}
However, while \completecontent does output "Deviously ... A", the "1." is
not output in the TOC. Which makes me wonder about the difference between
how \section adds an entry to the "section" list and how \writetolist
adds an entry to the "section" list.
I realize my original question was just about the "user defined" Reprints
list, because I thought if I came to understand that, I would be able to
solve my original problem. Unfortunately, complete understanding still
eludes me.
Are you (or anyone else who has read this long message) able to lead me to
the path of list righteousness?
Thanks.
> 2. "bonus" questions :
> Answer A :
> \getnumber[chapter]
> \getnumber[section]
> \getnumber[subsection]
> Answer B : see this little MWE :
> \starttext
> \chapter{Un chapitre}
> Le numéro de ce chapitre est \getnumber[chapter].
> \section{Une section}
> Le numéro de cette section est \getnumber[section].
> \stoptext
Alas, at the risk of appearing ungrateful, I can not get your little MWE to
work for me. No errors reported, but nothing is shown by \getnumber. I
tried looking \getnumber up in the wiki, but without luck.
> Note : Can you correct the wiki in the right way with a functional MWE of
> your choice? Thanks!
I will be more than happy to write something up for the wiki, based on your
most helpful email.
> Hope this helps,
It certainly does!
Thanks again.
Jim
> Le 25/11/2025 à 15:30, Jim a écrit :
>> Hi all,
>> athttps://wiki.contextgarden.net/Command/writetolist we see the example
>> %%%%
>> \definelist[Reprints][criterium=all]
>> \starttext
>> \section{Sec 1}
>> \writetolist[Reprints]{1.}{List entry A}%
>> \writetolist[Reprints]{}{With no number}%
>> \subsection{Subsec 1}
>> \writetolist[Reprints]{2.}{List entry B}%
>> \completelist[Reprints]
>> \stoptext
>> %%%%
>> and the TOC entries cause me to speculate that the intention of this
>> example is that, in the TOC, "List Entry A" will be annotated with "1."
>> (and "List Entry B" will have "2.").
>> But when I run that example, neither of those entries have numbers.
>> Can someone tell me whether
>> (a) it's somehow a "me" problem, or
>> (b) it's a ConTeXt problem?
>> Thanks.
>> Bonus question: is there a macro or counter or token list or ... which has
>> the number of the current chapter (and section and subsection and ...)?
>> Thanks ^ 2.
>> Jim
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the
Wiki!
maillist : [email protected] /
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
___________________________________________________________________________________