Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

LaTeX rookie here.

I'm running OS X 10.7 with Emacs 24, Auctex 11.86 and TexLive 2011 via MacTex.

When i run LaTeX through Emacs in the terminal it outputs my test.tex as test.pdf just fine.

However, when i run the same file through Auctex in Emacs.app it fails and i'm given:

LaTex: problems after [0] pages'

and the output reads

Running `LaTeX' on `test2' with ``pdflatex -synctex=1  -interaction=nonstopmode "\input" test2.tex''
/bin/sh: pdflatex: command not found

I've been googling this and know this is a fairly common problem, but for the life of me I haven't been able to implement a fix. From what i've read it seems Emacs has a different PATH than terminal, no? Can someone please explain to me how to fix the PATH or environment variable (i'm not sure which) so that Emacs can find pdflatex. Is there something I need to change in my ~/.emacs ?

thanks, any help is appreciated.

share|improve this question
    
You run emacs in the terminal and it outputs a pdf? You mean you run latex in the terminal? –  Seamus Jul 30 '11 at 22:14
    
yes latex, my mistake. –  idclark Jul 30 '11 at 23:05
    
This isn't really a TeX question, but an emacs question. Here are some solutions: EmacsApp. I don't recommend using the environment.plist solutions, as they can interfere with other applications. The "quick and ugly" solution seems the best; you need to change the path accordingly (the path there assume Darwin Ports). For MacTeX you want to make sure that /usr/texbin/ is early in the path. (You also might want to try Aquamacs.) –  Alan Munn Jul 30 '11 at 23:20
    
finally got it! –  idclark Jul 31 '11 at 2:32
    
If you have found a solution please report it here as an answer of your own question, so everyone can enjoy of it –  Spike Jul 31 '11 at 7:06

3 Answers 3

ok, sorry for the delay- i wasn't allowed to post a self-answer earlier. Indeed Emacs.app was operating in a different environment than the terminal.

M-x getenv for PATH showed that /usr/texbin was missing, which explains why LaTex was not working inside the Emacs.app shell.

following @Alan Munn's idea to stay away from editing a .plist I found some good info here and hacked together this in ~/.emacs

(getenv "PATH")
 (setenv "PATH"
(concat
 "/usr/texbin" ":"

(getenv "PATH")))

/usr/texbin is now part of thePATH and LaTeX will play nice with Emacs.app

thanks for the help everyone!

share|improve this answer

you can try to add in your .emacs the following command:

(setq exec-path (append exec-path '("YOUR/PATH/TO/LATEXB/BIN/")) )
share|improve this answer
    
I tried this earlier and unfortunately it didn't work. It's frustrating because I thought this would do the same thing as my fix in the answer post. –  idclark Jul 31 '11 at 13:07

If you have the root right, you can add the path to the end of /etc/profile like this:

export PATH=$PATH:/work/tools/arc/arcanist/bin:/work/tools/jdk1.6.0_25/bin

I have the same problem in my Linux/Ubuntu 12.04, and it works!

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.