emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Alex Fenton <alex.fenton@pressure.to>
To: emacs-orgmode@gnu.org
Subject: Re: latex exporting to different directory with v9.0
Date: Sun, 6 Nov 2016 12:39:37 +0100	[thread overview]
Message-ID: <e427e9f5-16c4-5255-98aa-05de99b374d8@pressure.to> (raw)
In-Reply-To: <874m3lo7v0.fsf@nicolasgoaziou.fr>

Hello,

On 05/11/16 23:54, Nicolas Goaziou wrote:
> Honestly, I'm surprised it worked. I'm also surprised it could be
> related to `default-directory' set-up, since links are created during
> Org -> LaTeX conversion, whereas `org-compile-file' handles LaTeX ->
> PDF. What is that "simple publishing set-up" you are talking about?

Thanks for the reply. The publishing set up defines 
:publishing-directory as "out", and then the publishing function for 
each org file was:

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

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

With 8.3, the latex process launches in the base (org) directory. Image 
& bibtex links in the tex file (in ./out) are resolved by latex relative 
to the base (working) directory.

With 9.0, the enforced switch of default-directory to "./out" means the 
latex process is launched there instead, and relative links are no 
longer correctly resolved.
> Basically, there are three directories to consider: source (".tex")
> directory, output (".pdf") directory, and working directory, i.e.,
> probably ".org" file directory.
>
> The assumption for `org-compile-file', and before it,
> `org-latex-compile', is that source and output directories are the same.
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).
> 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 ./.

> As a consequence, if we do not set `default-directory' to the output
> directory, the latter is broken. Note that if we do, "%o" place-holder
> becomes useless as it is always "./".
>
> In a nutshell we can either set default-directory to source/output
> directory or leave it as-is. In all cases, it seems to break something
> anyway.

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.

Thanks again,
alex

  reply	other threads:[~2016-11-06 11:39 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 [this message]
2016-11-08 17:49     ` Nicolas Goaziou
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=e427e9f5-16c4-5255-98aa-05de99b374d8@pressure.to \
    --to=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).