emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nicolas Goaziou <mail@nicolasgoaziou.fr>
To: Alex Fenton <alex.fenton@pressure.to>
Cc: emacs-orgmode@gnu.org
Subject: Re: latex exporting to different directory with v9.0
Date: Tue, 08 Nov 2016 18:49:24 +0100	[thread overview]
Message-ID: <87oa1pkgkb.fsf@nicolasgoaziou.fr> (raw)
In-Reply-To: <e427e9f5-16c4-5255-98aa-05de99b374d8@pressure.to> (Alex Fenton's message of "Sun, 6 Nov 2016 12:39:37 +0100")

Hello,

Alex Fenton <alex.fenton@pressure.to> writes:

> (defun thesis-publish-chapter-to-pdf (plist filename pub-dir)
>   "Export a chapter to a LaTeX file in output dir and compile"
>   (let ((outfile
>           (org-publish-org-to 'latex filename "-chapter.tex" plist
> pub-dir)))
>     (org-latex-compile (file-relative-name outfile))))

See `org-latex-publish-to-pdf' for a possibly better way to handle this.

> With org-latex-pdf-process being a standard
> "latexmk -xelatex -interaction=nonstopmode -f -outdir=%o -pdf %f"
>

[...]

> That seems reasonable. All that I'd ideally like to continue to be
> able to do is keep a clean "working" (org) directory with correct
> relative links in the org files, and use a single other directory as
> "source" (tex) and "output" (pdf).

Per above, you could use latexmk "-C" option and move both ".tex" and
".pdf" file to appropriate directories.

>> but others clearly require the working directory to be the output
>> directory (note the absence of output directory in the command below)
>>
>>    "texi2dvi -p -b -V %f"
>
> I'm conscious that org-mode has to work with a lot of different
> backends and compilers, but that example should still work without
> switching default-directory; only the pdf file would end up not in
> ./out but ./.

This breaks the export process, because `org-compile-file' can no longer
find, and return, the produced file. `org-compile-file' has to know
where the output is.

> I imagine the case for the vast majority of the time is that working,
> source and output directories are the same. I'm just wondering
> whether, for the cases where that's not true (calling a compiler from
> one directory to compile a file somewhere else), the responsibility
> for setting the correct default-directory, if necessary, could be left
> to the calling function, rather than having an enforced switch
> hard-coded in the core org-compile-file function.

One problem is that we already provide compilation commands that do not
set it (e.g., the "texi2dvi" command above). As I wrote, if we leave
default-directory alone, something else has to be fixed.

In any case, I removed default-directory setting and, hopefully, applied
the necessary changes to commands.

Feedback welcome.


Regards,

-- 
Nicolas Goaziou

  reply	other threads:[~2016-11-08 17:49 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-05 11:54 latex exporting to different directory with v9.0 Alex Fenton
2016-11-05 22:54 ` Nicolas Goaziou
2016-11-06 11:39   ` Alex Fenton
2016-11-08 17:49     ` Nicolas Goaziou [this message]
2016-11-10 16:30       ` Alex Fenton
2016-11-11  9:26         ` Nicolas Goaziou

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

  List information: https://www.orgmode.org/

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

  git send-email \
    --in-reply-to=87oa1pkgkb.fsf@nicolasgoaziou.fr \
    --to=mail@nicolasgoaziou.fr \
    --cc=alex.fenton@pressure.to \
    --cc=emacs-orgmode@gnu.org \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).