Hi, Bruce—
This does not quite work—the page numbers are those of the first page of the chapter, not the last. But thanks for the tip about \writetolist. Perhaps I can get that to work.

What I need are ToC entries like
AuthorName
ShortTitle                       1–6

I need this pagination because one of the requirements of continuous publication on the OJS is that once an item is published changes are not permitted. So I cannot go with normal continuous publication since, for us anyway, items are not processed in strict sequential order (e,g., we may have, paper+paper+ review+paper...)

If it helps: I currently have

\startFMTitle[reference=\Reference, title={}][itemAuthor=AuthorName, itemTitle=ShortTitle,...]
\setuplist[FMTitle][state=start, alternative=startendfmpages, criterium=all,]
(\Reference is defined at the in the preamble to input of the file/component.)

\definelistalternative[startendfmpages][renderingsetup=list:startendfmpages]

\startsetups[list:startendfmpages]
          \structurelistuservariable{itemAuthor}\crlf
          \structurelistuservariable{itemTitle}\hfill%
           \at[\currentlistentrypagenumber]–\at[\lastpagenumber]
\vglue1pc
\stopsetups
where I have \reference[\lastpagenumber]{} at the end of the file. But this 
gives me ??–viii (the viii is correct and interactive) for the FMTitle. Sadly the entries for all my other Titles (SourceTitle, StudyTitle...) is ??–viii. 
(Each title is a modified chapter.)

Curiously, \at[\Reference]–\convertnumber{r}{\lastpagenumber}  and \at[\Reference]–\at[\lastpagenumber] work properly in the body text.  
The overall structure is project-product sort with many components in the product.

This is probably TMI. The bottom line is that I am truly stumped.

All best,
Alan

On Wed, Apr 3, 2024 at 6:56 AM Bruce Horrocks <ntg@scorecrow.com> wrote:


> On 30 Mar 2024, at 19:59, Alan Bowen <bowenalan03@gmail.com> wrote:
>
> How can I get the last page number of a chapter for a list (ToC)?
>
> Outside of a list, I use \lastpagenumber.
> But that does not work in a list such as the ToC.
>
> Any tips or pointers will be gladly received.


I'm not quite sure what you want to do with these numbers: something like printing out a contents page but instead of the start page of a chapter it shows the last page of the chapter?

If so then try creating a custom list and use \writetolist immediately before each \stopchapter command?

\definelist[LastPages][criterium=all]
\starttext
\completecontent
\page
\completelist[LastPages]
\page
\dorecurse{10}{
  \startchapter[title={This is my chapter}]
  This is a chapter\par \dorecurse{6}{\input knuth } \input math-kontinuitet-sv

  \writetolist[LastPages]{3.}{\namedstructurevariable{chapter}{title}}
  \stopchapter
}
\stoptext

But I can't get the number option of \writetolist to work - the "3." above is ignored. :-(


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
___________________________________________________________________________________