I would like to export my org file to a different directory than the one containing the base org file. I've tried setting the property EXPORT_FILE_NAME:

:EXPORT_FILE_NAME: ./export/test

When I export the subtree that has this property drawer attached with C-c C-e l p, I'm seeing the following (surprising) behavior.

The .tex file is produced in ./export, as desired. The `.pdf' file is produced in the original directory.

How can I get both the .tex and the .pdf to show up in the other directory?

Here's a MWE of my org file:

#+TITLE: latex org-mode testing

* Exporting to different directory
:EXPORT_FILE_NAME: ./export/test

This is the material in the test file.

1 Answer 1


It turns out that the problem is with the way the latex compiler is called. Its own working directory is the original directory of the .org file, not the new directory of the .tex file. So that means that while it finds the .tex file in the correct directory (/export), its own working directory is still ./, so that's where it puts the output files. I had to explicitly specify the output directory. Adding the option -output-directory=%o to the command org-latex-pdf-process solved the problem.

  • 3
    Bernhard can you maybe share some configuration code for the emacs noobs like me? Commented Mar 6, 2019 at 14:55
  • @AlwynSchoeman I have in my emacs init.el (or .emacs): (setq org-latex-pdf-process '("pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f" "pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f" "pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f")) Unfortunately, that doesn't appear to work when using the :EXPORT_FILE_NAME: property - the .tex file is exported correctly, but pdflatex fails to compile...
    – AstroFloyd
    Commented Dec 2, 2021 at 11:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.