I am using Linux, so those tools are available, but Bruce's solution is working great! Just had to make tiny changes to the file.

I had no idea I could send an environment variable to ConTeXt...will be using that a lot from now! Thanks very much everyone for the help!

On Friday, September 20, 2024 at 11:04:47 AM MDT, Bruce Horrocks <ntg@scorecrow.com> wrote:




> On 20 Sep 2024, at 03:57, Joel via ntg-context <ntg-context@ntg.nl> wrote:
>
> I have a document that's quite long. It uses a recurse function, a bit like this:
>
> \starttext
>
>    \dostepwiserecurse{1}{180}{1}{%
>
>        \input chapter\recurselevel
>
> }
>
> \stoptext
>
> That produces 180  chapters of content.
>
> Anyway, my boss is upset she has to use a table of contents to navigate to the page she wants, and so wants me to split the file into 180  separate files, which somehow is going to be easier to look at. Honestly, she probably still won't ever actually look at it, but that's her requirement.

Since you’ve already got the chapter content split into separate \input files ...

At the Unix level, use the following script to run Context 180 times specifying a different output file each time:

#! /bin/bash
for i in {1..180}
do
  context \
    --arguments="ChapNo=$i" test.tex \
    --result="chapter_$i.pdf”
done

And at the Context level, test.tex is simply:

\starttext
  \input chapter\env{ChapNo}

\stoptext



Regards,

Bruce Horrocks
Hampshire, UK