
Dear list, I would like to have chapters in bodypart to list two numbers, the previous to the current page and the current page, such as in: 14 · 15 24·25 50 · 51 100 · 101 I tried the following command, but I cannot get the previous to the current page number: \setuplist[chapter] [pagecommand={\the\numexpr\currentlistentrypagenumber-1\ ·}] What am I missing here? Many thanks for your help, Pablo

On 8 Feb 2025, at 21:38, Pablo Rodriguez via ntg-context
wrote: Dear list,
I would like to have chapters in bodypart to list two numbers, the previous to the current page and the current page, such as in:
14 · 15 24·25 50 · 51 100 · 101
I tried the following command, but I cannot get the previous to the current page number:
\setuplist[chapter] [pagecommand={\the\numexpr\currentlistentrypagenumber-1\ ·}]
What am I missing here?
The obvious arithmetic order doesn't work for reasons that aren't obvious to me. :-( Try this: \def\doPageNumber#1{\the\numexpr -1 + #1\relax\ · #1} \setupcombinedlist[content][list={chapter}] \setuplist[chapter][pagecommand=\doPageNumber] \starttext \completecontent \page \doloopoverlist {one,two,three,four,five} {\chapter{Title \recursestring} \input tufte \page } \stoptext (I'll leave Hans or Wolfgang to explain why the chapter title doesn't work but that's not an issue for you.) — Bruce Horrocks Hampshire, UK

On 9 Feb 2025, at 12:00, Bruce Horrocks
wrote: Try this:
\def\doPageNumber#1{\the\numexpr -1 + #1\relax\ · #1} \setupcombinedlist[content][list={chapter}] \setuplist[chapter][pagecommand=\doPageNumber]
\starttext \completecontent \page \doloopoverlist {one,two,three,four,five} {\chapter{Title \recursestring} \input tufte \page } \stoptext
P.S. This works using ConTeXt ver: 2024.12.30 16:14 but fails using ConTeXt ver: 2025.02.07 20:46 (for me at least). — Bruce Horrocks Hampshire, UK

On 2/9/25 14:47, Bruce Horrocks wrote:
[...]
P.S. This works using ConTeXt ver: 2024.12.30 16:14 but fails using ConTeXt ver: 2025.02.07 20:46 (for me at least).
Many thanks for your reply, Bruce. It works perfectly fine with current latest (the version you mention) for me. Many thanks for your help, Pablo

On 2/9/2025 2:47 PM, Bruce Horrocks wrote:
On 9 Feb 2025, at 12:00, Bruce Horrocks
wrote: Try this:
\def\doPageNumber#1{\the\numexpr -1 + #1\relax\ · #1} \setupcombinedlist[content][list={chapter}] \setuplist[chapter][pagecommand=\doPageNumber]
\starttext \completecontent \page \doloopoverlist {one,two,three,four,five} {\chapter{Title \recursestring} \input tufte \page } \stoptext
P.S. This works using ConTeXt ver: 2024.12.30 16:14 but fails using ConTeXt ver: 2025.02.07 20:46 (for me at least).
You've just been lucky then \def\doPageNumber#1% {%\the\numexpr #1 - 1\relax\ · #1}% #1 is not a number %\the\numexpr \structurelistrealpagenumber - 1\relax\ · #1} \tointeger{\structurelistrealpagenumber - 1} · #1} \setupcombinedlist[content][list={chapter}] \setuphead [chapter] [expansion=yes] \setuplist [chapter] [pagecommand=\doPageNumber] \starttext \completecontent \page \doloopoverlist {one,two,three,four,five} { \chapter{Title \recursestring} \samplefile{tufte} \page } \stoptext #1 is a 'typeset number' so even if it expands (not always btw) to soem digit you get something but then if also some relax creeps in the \numexpr scanning stops prematurely you also (likely) want that one, two etc in the list Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------
participants (3)
-
Bruce Horrocks
-
Hans Hagen
-
Pablo Rodriguez