![](https://secure.gravatar.com/avatar/74d41c3215dcdd377343cdc47311757c.jpg?s=120&d=mm&r=g)
Alan Bowen schrieb am 30.03.2024 um 20:59:
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.
You can try this: \definepagestate[alanpage] \definecounter [alanindex] \setuphead [chapter] [insidesection={\setpagestate[alanpage]}, aftersection={\setpagestate[alanpage]}] \setuphead [title] [insidesection=, aftersection=] \define[1]\ChapterListPage {\pagestaterealpage{alanpage}{\number\numexpr\incrementedcounter[alanindex]\relax}% \thinspace --\thinspace \pagestaterealpage{alanpage}{\number\numexpr\incrementedcounter[alanindex]\relax}} \setuplist[chapter][pagecommand=\ChapterListPage] \setuplist[chapter][pagecommand=\ChapterListPage] \showgrid \starttext \completecontent \startchapter [title=Knuth] \dorecurse{12}{\samplefile{knuth}} \stopchapter \startchapter [title=Zapf] \dorecurse{12}{\samplefile{zapf}} \stopchapter \stoptext Wolfgang