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` I've looked in the wiki: `https://wiki.contextgarden.net/Context` Thank you, Peter
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
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
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 ___________________________________________________________________________________
I usually use a makefile for this.
There I have build rule that first cds into the target directory, then calls context from there.
Best
Denis
________________________________________
Von: ntg-context
On 5/27/2023 11:51 AM, Denis Maier via ntg-context wrote:
I usually use a makefile for this. There I have build rule that first cds into the target directory, then calls context from there. That is indeed the solution (also because the --path option will then fetch from the source). The more lua hackery the more danger of interference. The problem here is that a rename won't work in all scenarios (different drives on windows for instance, or from local disk to network drive).
Anyway, one can also give --runpath=sometargetpath which i actually use to run for instance manuals, but there it is driven in the file itself: % language=us runpath=texruns:manuals/musings in combination with TEXRUNS=c:\data\temporary\texruns so that I don't overwrite a stable manual in the source path. Over the decades that context evolved there have been plenty such tricks added. I could probably add a move option to the job ticket mechanism but that has not changed in ages so ... workflows demands are too different. Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------
Sorry. I have the same problem. This may seem basic but how do I pass multiple paths to the --path option? Jethro On Sat, May 27, 2023 at 10:09 AM Hans Hagen via ntg-context < ntg-context@ntg.nl> wrote:
On 5/27/2023 11:51 AM, Denis Maier via ntg-context wrote:
I usually use a makefile for this. There I have build rule that first cds into the target directory, then calls context from there. That is indeed the solution (also because the --path option will then fetch from the source). The more lua hackery the more danger of interference. The problem here is that a rename won't work in all scenarios (different drives on windows for instance, or from local disk to network drive).
Anyway, one can also give
--runpath=sometargetpath
which i actually use to run for instance manuals, but there it is driven in the file itself:
% language=us runpath=texruns:manuals/musings
in combination with
TEXRUNS=c:\data\temporary\texruns
so that I don't overwrite a stable manual in the source path. Over the decades that context evolved there have been plenty such tricks added.
I could probably add a move option to the job ticket mechanism but that has not changed in ages so ... workflows demands are too different.
Hans
----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------
___________________________________________________________________________________ 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
___________________________________________________________________________________
On 8/7/2023 3:58 AM, Jethro Djan wrote:
Sorry. I have the same problem. This may seem basic but how do I pass multiple paths to the --path option?
you can try --path="aa,bb,cc" ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------
participants (6)
-
denis.maier@unibe.ch
-
Hans Hagen
-
Hans Hagen
-
Jethro Djan
-
Max Chernoff
-
peter.hopcroft@icloud.com