2

I have some problems with the emacs org-mode. When I use the command org-export-as-pdf in org-mode, I got the error:

/bin/bash: pdflatex: command not found [3 times]

I am a Mac OS X(10.7) user and the version of emacs is 24.2. I downloaded the Tex Live from the official website and it was installed at /usr/local/texlive. I knew the env variables of emacs shell is different from user's terminal, so I tried this command:

M-! $PATH 

it printed:

/bin/bash: /usr/bin:/bin:/usr/sbin:/sbin: No such file or directory

then I typed some commands below:

$which pdflatex
/usr/texbin

$ln -s /usr/texbin/pdflatex /usr/bin

and then I turned back to emacs, and tried org-export-as-pdf again, the same problem still existed.
I am confused and I need your help ;-)

miguelmorin
  • 5,025
  • 4
  • 29
  • 64
Gizak
  • 854
  • 2
  • 11
  • 21
  • 1
    Check this answer: http://stackoverflow.com/a/2566945/605276 I'm calling that function in my `.emacs` for setting path. – Juancho Jan 02 '13 at 11:29
  • @Juancho it worked pretty well, thanks ;-) – Gizak Jan 03 '13 at 15:27
  • possible duplicate of [Emacs is ignoring my path when it runs a compile command](http://stackoverflow.com/questions/2266905/emacs-is-ignoring-my-path-when-it-runs-a-compile-command) – François Févotte Mar 08 '13 at 19:12

1 Answers1

0

Add the pdflatex directory to the Emacs PATH environment variable, instead of the symbolic link, e.g. add this to ~/.emacs:

(setenv "PATH" (concat (getenv "PATH") ":/usr/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 Unix.StackExchange.)

miguelmorin
  • 5,025
  • 4
  • 29
  • 64