On 9/20/24 04:57, Joel via ntg-context wrote:
[...] The perhaps "obvious" answer is just make 180 *.tex files, but since the minimal example above is like 0.01% of the complexity of the real file, that isn't so easy...
Hi Joel, I tried to recreate a document with chapters that contain a different number of pages each: \setuppagenumbering[alternative=doublesided] \setuphead[chapter][reference=ch\the\numexpr\namedheadnumber{chapter}+1] \starttext \dorecurse{180}{% \startchapter[title={Chapter \namedheadnumber{chapter}}] \dorecurse{\randomnumber{10}{50}} {\input zapf\par} \stopchapter} \stoptext The key above is setting a reference for each chapter, so that they may be retrieved later automatically. Then you should have the pages for any chapter from its reference with the following command: context --pages=ch100 main-file.tex But I must confess, I cannot get this working. I don’t know what I miss. If you are on Unix, generating a bash loop would be similar to (once your main PDF document has been generated): for i in {1..180}; do mutool merge -o chapter-$i.pdf main-file\ "$(context --pages=ch$i main-file)" But for that, you need to know first how "--pages=[reference]" may work. Just in case it might help, Pablo