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