[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] latex exporting to different directory with v9.0
From: |
Nicolas Goaziou |
Subject: |
Re: [O] latex exporting to different directory with v9.0 |
Date: |
Tue, 08 Nov 2016 18:49:24 +0100 |
Hello,
Alex Fenton <address@hidden> 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