Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I just installed auctex and preview-latex on my mac, and now when I open a tex document I see auctex has been loaded, but when I try to generate a preview I get the following error message:

Running `Preview-LaTeX' on `writeup' with ``latex  "\nonstopmode\nofiles\PassOptionsToPackage{active,tightpage,auctex}{preview}\AtBeginDocument{\ifx\ifPreview\undefined\RequirePackage[displaymath,floats,graphics,textmath,sections,footnotes]{preview}[2004/11/05]\fi}" "\input" writeup.tex''
/bin/sh: latex: command not found

Preview-LaTeX exited as expected with code 127 at Tue Jan 18 20:01:34
LaTeX: LaTeX found no preview images

What is going wrong here? LaTeX is in my path, at least at the terminal. For Emacs when I run M-x getenv PATH I don't see the LaTeX installation in my path. I created a file ~/.MacOSX/environment.plist with the following lines:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "";>
<plist version="1.0">

But that didn't change my PATH variable in at all.

share|improve this question
up vote 2 down vote accepted

Emacs internally uses the exec-path variable to determine what it looks for.

This is normally initialised to PATH, but not if it is customised. Check its value using c-h v exec-path; there's a link there to the customise submenu. If you delete the relevant line from your customisation file (see the value of the Emacs variable custom-file), you can force the default behaviour.

share|improve this answer
My custom.el just has two calls in it: (custom-set-variables) and (custom-set-faces) But the path I see when I look at exec-path is different from the PATH. – 2daaa Jan 20 '11 at 19:03
What happens when you setq exec-path in your Emacs initialisation file? – Charles Stewart Jan 20 '11 at 19:29
Actually it seems to be working now. I rebooted my computer and that seems to have caused to start reading the environment.plist file. – 2daaa Jan 20 '11 at 20:00

You need a LaTeX installation. Make sure the directory where the latex executable lives is inside your PATH.

share|improve this answer
Sorry I should have been clearer. There is some kind of PATH problem, but I do have LaTeX installed and I can run it from the terminal just fine. isn't aware of it for some reason though. – 2daaa Jan 19 '11 at 13:51

Your Answer


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.