Hi Jean-Pierre,

thanks for this reply.   But see below...

On Fri, Nov 28, 2025 at 09:32 (+0100), Jean-Pierre Delange via ntg-context 
wrote:

> I Jim,

> Short answer (if I understand properly the issue you are confronted to):
> your number |1.| is ignored because the standard section ToC formatter does
> *not* use the number field provided by |\writetolist|; it recomputes numbers
> from the internal section counter.

Interesting.  When you say "recomputes" does that mean that when
\completecontent (or similar) is placed, rather than using numbers that
were (maybe?) stored when \section (\subsection, ...) was called, it
ignores those and starts numbering from 1 (or 0)?

>\section| → updates structure + counters + writes a ToC entry

I can see this updating counters, but I might have imagined the actual ToC
entry would just have had the updated section number.

>\writetolist[section]| → only writes a raw list entry (no counters,
> no structure)


> Therefore:

>>\writetolist[section]{1.}{My entry} |cannot behave like a real. Then,
> depending on your goal, here are the two correct approaches.

> 1) Just add an extra line in the ToC
>>\setupcombinedlist[content][list={section}]\starttext \completecontent
> \section{Normalsection} \writetolist[section]{}{Sectionunder construction}
> \stoptext |

> Use this if you just want a non-structural ToC entry.

Part of my lack of understanding is what the "structures" that \section
updates are for.  (I poked around on the wiki for a while, but didn't find
anything illuminating.)

I think this will do what I want if I use
        alternative=command,command=\myformatter
appropriately.  So thank you for that.


> 2) Add a real section that appears only in the ToC

>\setupcombinedlist[content][list={section}] \starttext \completecontent
> \startsection[title={Visible section}] Text : ConTeXt is fun !|
>\stopsection \startsection [title={Section onlyinthe ToC}, list={Section
> onlyinthe ToC}, placehead=hidden] \stopsection \stoptext |

> This creates a real structural section (proper numbering, references, etc.)
> whose heading is hidden in the body but appears in the ToC.

I am wondering if we both use the same version of ConTeXt.  Here is (I
believe) a bit of a reformatting of what you have above, but maintaining
the ideas.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\setupcombinedlist[content][list={section}]

\starttext
\completecontent

\startsection[title={Visible section}]
Text : ConTeXt is fun !
\stopsection

\startsection[title={Text that ends up next to the new section number},
        list={This goes into the TOC},
        placehead=hidden]
\stopsection

\stoptext
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

When I run this on my system (having just updated ConTeXt 5 minutes ago) I
see
        2 Text that ends up next to the new section number
in the PDF output.

But, from what you said, I assumed it would not be seen in the PDF.

So, did I misunderstand what your second suggestion does (is supposed to
do), or am I using a different ConTeXt?  (Looking in the wiki, there is no
        placehead=
option that I can find.)

For reference, if I run the command
        context --version  
I get the output
        mtx-context     | ConTeXt Process Management 1.06
        mtx-context     |
        mtx-context     | main context file: 
/usr/local/context/tex/texmf-context/tex/context/base/mkiv/context.mkiv
        mtx-context     | current version: 2025.11.24 17:55
        mtx-context     | main context file: 
/usr/local/context/tex/texmf-context/tex/context/base/mkxl/context.mkxl
        mtx-context     | current version: 2025.11.24 17:55


> _Summary:_

>\writetolist| → lightweight list entry

>\section| / |\startsection| → structural element

> Section numbers in the ToC always come from the section counter, not
> from |\writetolist|
(presumably except in the alternative=command,command=\someformatter case).

> Hope this helps,

Your second suggestion would have been exactly what I wanted.  If I could
only get it to work. :-)


Again, thanks very much for getting back to me.

                                        Jim


> Le 27/11/2025 à 03:39, Jim a écrit :
>> 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
>> ___________________________________________________________________________________

> ___________________________________________________________________________________
> 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
> ___________________________________________________________________________________

___________________________________________________________________________________
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
___________________________________________________________________________________

Reply via email to