# Set LaTeX version to use when exporting using org-mode

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:

/usr/local/texlive/2014/bin/x86_64-linux/latexmk


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?

• 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

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