Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

org-mode not exporting to PDF

My org-mode refuses to export produce PDF files from their corresponding org-files. I was running org-mode v 7.9.x and suspected the problem might be because I have an older version of org-mode. Hence, I am now running the most recent version of org-mode (v 8.2.2) but the problem persists.

After some investigation, I have found the following. org-mode nicely exports my .org file to .tex. But if I try to get the org-mode exporter to create the .tex file and also process to PDF, (C-c C-e l p), I get the error `PDF file ./test.pdf was not produced'. However, if I run pdflatex from the terminal on the .tex file that org-mode creates, the PDF is generated without errors.

So my best guess is that org-mode is creating a `nice' .tex file, but something in the guts of my emacs is preventing the .tex file from being processed to .pdf. Unfortunately, I'm quite a n00b at emacs and can't figure out exactly where the problem lies.

Any ideas on what I can do?

like image 360
krishnan Avatar asked Nov 12 '13 17:11

krishnan


2 Answers

Add the following somewhere in your Emacs initialization file (taken from https://gist.github.com/bradleywright/2046593)

(defun set-exec-path-from-shell-PATH ()
  "Sets the exec-path to the same value used by the user shell"
  (let ((path-from-shell
         (replace-regexp-in-string
          "[[:space:]\n]*$" ""
          (shell-command-to-string "$SHELL -l -c 'echo $PATH'"))))
    (setenv "PATH" path-from-shell)
    (setq exec-path (split-string path-from-shell path-separator))))

(set-exec-path-from-shell-PATH)

The link above explains why you must configure the path like that, I was having same issue than you, adding this I'm able to export to pdf with org mode in Mac OS X Mavericks, without it , I receive the same error message.

Update

Someone has already write a package for Emacs that resolve this: https://github.com/purcell/exec-path-from-shell

like image 91
Carlo Espino Avatar answered Sep 21 '22 07:09

Carlo Espino


This is all I need to use on OSX 10.6.8 with TexLive and Emacs -- I have it in my .emacs file:

(setenv "PATH" (concat (getenv "PATH") ":/usr/texbin"))
like image 34
lawlist Avatar answered Sep 21 '22 07:09

lawlist