In my .emacs, I have the following:

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

However, when exporting an org it uses the "wrong" version of latexmk. More precisely, from my shell (outside of emacs), I use:


But, it seems like, org is using a different one that is associated to the wrong version of TeXLive. How can I set the right LaTeX to be used when exporting org files?

  • 1
    Emacs use the same PATH var as in the shell env from where you launched it. What do you see when you do which latexmk in the terminal (from where you launched emacs)? – Kaushal Modi Apr 28 '15 at 11:01
  • From the terminal I see the right latexmk. I launch emacs from a shortcut, so I don't know what's its PATH. How can I check it? – Dror Atariah Apr 28 '15 at 11:20
  • Examine the value of exec-path (for example by pressing M-: and then typing exec-path) to see what directories are available to Emacs to search for latexmk. I'm not 100% sure, but I think that Org will launch a process with latexmk rather than executing a shell command with that text. – wvxvw Apr 28 '15 at 14:21

If you run Emacs on OS X, then it may have different environment variables values than the ones you see in terminal shell. You can check the value of PATH environment variable that Emacs process has by typing M-x getenv RET PATH. Most likely you don't have /usr/texbin in PATH that getenv will show you. I run emacs from shell prompt on OS X like this

$ /usr/local/opt/emacs/Emacs.app/Contents/MacOS/Emacs

to get the exact environment I have in shell. This path to Emacs works if you installed Emacs as a homebrew package. Otherwise the path to emacs executable is likely to be different. All other solutions don't quite work for me since upgrade to OS X 10.10.

I guess you could put the absolute path to latexmk in the definition of org-latex-to-pdf-process

| improve this answer | |

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.