On Thu, 16 Apr 2020 at 16:52, Hans Hagen wrote: > On 4/16/2020 4:38 PM, Mojca Miklavec wrote: > > On Thu, 16 Apr 2020 at 11:29, Taco Hoekwater wrote: > >>> On 16 Apr 2020, at 11:12, Mojca Miklavec wrote: > >>> > >>> One option is that I quickly draft a python script that creates a few > >>> thousand TeX documents and compiles them individually, but it might be > >>> easier if there was a way to just create a single template document > >>> and then run something like > >>> context --some-params --N=42 --output=document-0042.pdf template.tex > >>> or something along those lines. > >> > >> If you want to go this route (and you may have to if not each record > >> fits exactly within a single page), > > > > I do have one page per document. The more annoying part is having > > strange document names that need more attention when mapping page > > number -> name (I'm not saying this is not doable). > > so, don't make files: > > - write a tex file foo.tex > - process it: context --batch --result=1 --once foo > > etc ... so, use --result for the target name and use the same input name
This works just perfect, thank you very much. I now have template.tex and process it with context --batch --result=doc-0042 --someparam=21a --once template which generates precisely the desired doc-0042.pdf. For the moment I'm simply using a combination of \doifdocumentargument {someparam} {\getdocumentargument{someparam}} from TeX and environment.arguments from within the lua code as suggested by Taco and you in the previous email thread. Where would be the best way to document this / under what wiki topic, as I'm sure I'll need it again and forget until then unless I write it down immediately? "Mail merge"? ;) Thank you very much, Mojca ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___________________________________________________________________________________