On Fri, Sep 20, 2024 at 02:57 (+0000), Joel via ntg-context 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. > The problem is, I've been splitting the file by using Print --> PDF and > choosing a custom print range, and then saving it. If I ned to repeat that > 180 times, it not only will have errors, but probably take 5-10 hours. > Is there something I can put, like \breakpdf or something that will tell it > to start a new PDF file? They can be named something like file1.pdf, > file2.pdf, etc. > \starttext > \dostepwiserecurse{1}{136}{1}{% > \input chapter\recurselevel > \breakpdf > } > \stoptext > 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... Joel, others have suggested mutool and pdftk, which could be half the solution for you. (I use pdftk for things like this, but I assume mutool is just as good. Either are far less tedious than printing to file.) If the information of the chapter boundaries is available in the log file, a judicious use of grep and a few lines of shell script code might do the trick. Alternatively, you might be able to use a tool like pdfgrep to find the page numbers from the PDF file, and then use a few lines of shell code. If you are a Linux or Mac user, this should be "easy enough". I don't do windows, but now that there is (as I understand it) a bash shell available, you might also be able to use grep and/or pdfgrep there as well. If the log file isn't currently sufficiently helpful, could you add something to your "start a new chapter" command to write a comment into the log file giving you exactly the information you need? Jim ___________________________________________________________________________________ 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 ___________________________________________________________________________________