From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: latex exporting to different directory with v9.0 Date: Tue, 08 Nov 2016 18:49:24 +0100 Message-ID: <87oa1pkgkb.fsf@nicolasgoaziou.fr> References: <36258fcb-bc34-6517-2bc6-919722c3e72f@pressure.to> <874m3lo7v0.fsf@nicolasgoaziou.fr> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:32803) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c4AWT-0001C2-9o for emacs-orgmode@gnu.org; Tue, 08 Nov 2016 12:49:26 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c4AWS-0008N8-5U for emacs-orgmode@gnu.org; Tue, 08 Nov 2016 12:49:25 -0500 Received: from relay4-d.mail.gandi.net ([2001:4b98:c:538::196]:53212) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1c4AWR-0008Mo-Vi for emacs-orgmode@gnu.org; Tue, 08 Nov 2016 12:49:24 -0500 In-Reply-To: (Alex Fenton's message of "Sun, 6 Nov 2016 12:39:37 +0100") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: Alex Fenton Cc: emacs-orgmode@gnu.org Hello, Alex Fenton 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