ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* [NTG-context] Can ConTeXt write its pdf to a different directory?
@ 2023-05-27  1:52 peter.hopcroft--- via ntg-context
  2023-05-27  3:53 ` Max Chernoff via ntg-context
  2023-05-27  9:51 ` Denis Maier via ntg-context
  0 siblings, 2 replies; 7+ messages in thread
From: peter.hopcroft--- via ntg-context @ 2023-05-27  1:52 UTC (permalink / raw)
  To: ntg-context; +Cc: peter.hopcroft

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

___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [NTG-context] Can ConTeXt write its pdf to a different directory?
  2023-05-27  1:52 [NTG-context] Can ConTeXt write its pdf to a different directory? peter.hopcroft--- via ntg-context
@ 2023-05-27  3:53 ` Max Chernoff via ntg-context
  2023-05-27  9:44   ` peter.hopcroft--- via ntg-context
  2023-05-27  9:51 ` Denis Maier via ntg-context
  1 sibling, 1 reply; 7+ messages in thread
From: Max Chernoff via ntg-context @ 2023-05-27  3:53 UTC (permalink / raw)
  To: ntg-context; +Cc: Max Chernoff

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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [NTG-context] Can ConTeXt write its pdf to a different directory?
  2023-05-27  3:53 ` Max Chernoff via ntg-context
@ 2023-05-27  9:44   ` peter.hopcroft--- via ntg-context
  0 siblings, 0 replies; 7+ messages in thread
From: peter.hopcroft--- via ntg-context @ 2023-05-27  9:44 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: peter.hopcroft, Max Chernoff

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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [NTG-context] Can ConTeXt write its pdf to a different directory?
  2023-05-27  1:52 [NTG-context] Can ConTeXt write its pdf to a different directory? peter.hopcroft--- via ntg-context
  2023-05-27  3:53 ` Max Chernoff via ntg-context
@ 2023-05-27  9:51 ` Denis Maier via ntg-context
  2023-05-27 10:09   ` Hans Hagen via ntg-context
  1 sibling, 1 reply; 7+ messages in thread
From: Denis Maier via ntg-context @ 2023-05-27  9:51 UTC (permalink / raw)
  To: ntg-context; +Cc: denis.maier

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 <ntg-context-bounces@ntg.nl> im Auftrag von peter.hopcroft--- via ntg-context <ntg-context@ntg.nl>
Gesendet: Samstag, 27. Mai 2023 03:52:42
An: ntg-context@ntg.nl
Cc: peter.hopcroft@icloud.com
Betreff: [NTG-context] Can ConTeXt write its pdf to a different directory?

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

___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [NTG-context] Can ConTeXt write its pdf to a different directory?
  2023-05-27  9:51 ` Denis Maier via ntg-context
@ 2023-05-27 10:09   ` Hans Hagen via ntg-context
  2023-08-07  1:58     ` [NTG-context] " Jethro Djan
  0 siblings, 1 reply; 7+ messages in thread
From: Hans Hagen via ntg-context @ 2023-05-27 10:09 UTC (permalink / raw)
  To: Denis Maier via ntg-context; +Cc: Hans Hagen

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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [NTG-context] Re: Can ConTeXt write its pdf to a different directory?
  2023-05-27 10:09   ` Hans Hagen via ntg-context
@ 2023-08-07  1:58     ` Jethro Djan
  2023-08-07  6:54       ` Hans Hagen
  0 siblings, 1 reply; 7+ messages in thread
From: Jethro Djan @ 2023-08-07  1:58 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 2219 bytes --]

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
>
> ___________________________________________________________________________________
>

[-- Attachment #1.2: Type: text/html, Size: 3271 bytes --]

[-- Attachment #2: Type: text/plain, Size: 495 bytes --]

___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [NTG-context] Re: Can ConTeXt write its pdf to a different directory?
  2023-08-07  1:58     ` [NTG-context] " Jethro Djan
@ 2023-08-07  6:54       ` Hans Hagen
  0 siblings, 0 replies; 7+ messages in thread
From: Hans Hagen @ 2023-08-07  6:54 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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
-----------------------------------------------------------------

___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-08-07  6:56 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-27  1:52 [NTG-context] Can ConTeXt write its pdf to a different directory? peter.hopcroft--- via ntg-context
2023-05-27  3:53 ` Max Chernoff via ntg-context
2023-05-27  9:44   ` peter.hopcroft--- via ntg-context
2023-05-27  9:51 ` Denis Maier via ntg-context
2023-05-27 10:09   ` Hans Hagen via ntg-context
2023-08-07  1:58     ` [NTG-context] " Jethro Djan
2023-08-07  6:54       ` Hans Hagen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).