ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Max Chernoff via ntg-context <ntg-context@ntg.nl>
To: ntg-context@ntg.nl
Cc: Max Chernoff <mseven@telus.net>
Subject: [NTG-context] Can ConTeXt write its pdf to a different directory?
Date: Fri, 26 May 2023 21:53:23 -0600	[thread overview]
Message-ID: <78c71878522e119db77b24cd93ab4782b6de2d82.camel@telus.net> (raw)
In-Reply-To: <D7420FB5-45E0-4914-A980-BBAA26172FBD@icloud.com>

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
___________________________________________________________________________________

  reply	other threads:[~2023-05-27  3:54 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 [this message]
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

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=78c71878522e119db77b24cd93ab4782b6de2d82.camel@telus.net \
    --to=ntg-context@ntg.nl \
    --cc=mseven@telus.net \
    /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).