I'm experiencing a strange error when trying to execute/compile a LaTeX source block in org-babel. A simple example looks like this:

#+NAME: latex1802142321
#+BEGIN_SRC latex :results raw :file latex1802142321.pdf :packages '(("" "forest")) :border 0em :noweb yes :eval no-export :tangle latex1802142321.tex

Everything works fine with vanilla Emacs (25.3.1, org-mode 8.2). But with my configuration (org-mode 9.1.6), something goes wrong, and the compilation exits with the following messages:

executing Latex code block (latex1802142321)...
Processing LaTeX file c:/Users/timm/AppData/Local/Temp/babel-12124NVL/latex-12124LOf.tex...
org-compile-file: File "c:/Users/timm/AppData/Local/Temp/babel-12124NVL/latex-12124LOf.pdf" wasn’t produced. 

I suspect that some part of org-babel is using the wrong directory. In fact, the PDF is generated in the directory of the org-mode file (along all the other temporary files), but not in AppData/Local/Temp/babel-12124NVL/. Really puzzling.

Any idea how I can tell org-babel to use the temporary directory?


The problem arises when the call of latexmk is lacking the option -cd %o. Here is how it is specified now:

(setq org-latex-pdf-process (list "latexmk -f -pdf %f -cd %o"))

See the discussion here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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