ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: "peter.hopcroft--- via ntg-context" <ntg-context@ntg.nl>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Cc: peter.hopcroft@icloud.com, Max Chernoff <mseven@telus.net>
Subject: Re: [NTG-context] Can ConTeXt write its pdf to a different directory?
Date: Sat, 27 May 2023 21:44:42 +1200	[thread overview]
Message-ID: <9D3F0582-6E08-4684-8E10-2BB5A0C1B6D2@icloud.com> (raw)
In-Reply-To: <78c71878522e119db77b24cd93ab4782b6de2d82.camel@telus.net>

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
___________________________________________________________________________________

  reply	other threads:[~2023-05-27  9:45 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-27  1:52 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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9D3F0582-6E08-4684-8E10-2BB5A0C1B6D2@icloud.com \
    --to=ntg-context@ntg.nl \
    --cc=mseven@telus.net \
    --cc=peter.hopcroft@icloud.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).