1

I am using emacs with org mode to take notes. I read that org mode can export to pdf whene you type C-c C-e lp. When I type this in, *Org PDF LaTeX Output* buffer says :

/bin/bash: pdflatex: command not found

But when I run $ pdflatex on my terminal the program executes. I belive that emacs doesn't login in bash, and as a result it doesn't have acces to my $PATH variable.

Do you have any idea how I can fix this. Thanks in advance.

  • Where is pdflatex on your system? What is your $PATH outside of emacs (echo $PATH in a shell) and inside Emacs ((getenv "PATH"))? – Wieland May 21 '17 at 13:53
0

I have the same problem when the Emacs PATH does not copy the contents of the login shell. I run this in the Emacs *scratch* buffer:

(getenv "PATH")
"/usr/bin:/bin:/usr/sbin:/sbin"

(Alternatively, hit M-x and type getenv, then type PATH.)

I searched for the location of pdflatex in a login shell in Terminal with:

> which pdflatex
/Library/TeX/texbin/pdflatex

So I added that directory to the PATH, e.g. add this to .emacs:

(setenv "PATH" (concat (getenv "PATH") ":/Library/TeX/texbin"))

and source it again with M-x load-file and type ~/.emacs. And now C-c C-e lp in Org-mode works:

PDF file produced.

(Cross-posted on StackOverlow.)

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.