Max, that answer seems like magic to me, in the sense of an advanced technology. Thank you.
It's not quite working for me yet. I'll explore more tomorrow and learn about lua. Peter > On 27/05/2023, at 3:53 PM, Max Chernoff via ntg-context <ntg-context@ntg.nl> > wrote: > > Hi Peter, > >> My .tex file is in a directory within my working directory. I would like >> ConTeXt to write its output in the same directory as my .tex file. But it >> writes to the working directory. >> >> This was asked 10 years ago: >> `tex.stackexchange.com/questions/67928/how-to-set-output-directory-in-context-command` >> >> The answer given then was to use: >> `context filename --result=output-directory/filename` >> >> But this doesn't work now. When I compile my .tex file, I get a message: >> `results are to be on the running path, not on 'output-directory', ignoring >> --result` > > This seems to work, although I'm not sure that I would call it a "good" > solution: > > \startluacode > local function absolute(path) > return file.collapsepath(dir.expandname(path)) > end > > local texfile = absolute(environment.filename) > local pdffile = file.addsuffix( > absolute(environment.inputfilebarename), > "pdf" > ) > > luatex.wrapup(function() > os.rename(pdffile, file.replacesuffix(texfile, "pdf")) > end) > \stopluacode > > \starttext > Hello! > \stoptext > > -- Max > ___________________________________________________________________________________ > If your question is of interest to others as well, please add an entry to the > Wiki! > > maillist : ntg-context@ntg.nl / > https://www.ntg.nl/mailman/listinfo/ntg-context > webpage : https://www.pragma-ade.nl / http://context.aanhet.net > archive : https://bitbucket.org/phg/context-mirror/commits/ > wiki : https://contextgarden.net > ___________________________________________________________________________________ ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context webpage : https://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : https://contextgarden.net ___________________________________________________________________________________