AUCTeX can't find PDFLaTeX

I installed TeX Live 2011 from source in my Ubuntu. The AUCTeX module was also compiled and installed instead of pulling from Ubuntu's repository. However, when I opened a LaTeX file with Emacs, and compiled, it complained

Running 'LaTeX' on 'jun13' with pdflatex -interaction=nonstopmode "\input" jun13.tex'' /bin/sh: pdflatex: not found

LaTeX exited abnormally with code 127 at Sat Oct 15 00:40:58

But PDFLaTeX was already in the PATH. I tried this file with TeXmaker, and it was successful. Could anyone please give me a hint what was going on? Thanks.

-
Does your ".emacs" file contain a nonexisting path to pdftex? –  Keks Dose Oct 15 '11 at 21:00
@keks Could you please explain more on "nonexisting path to pdftex"? My \$HOME/.emacs only has two lines which are required by AUCTeX: (load "auctex.el" nil t t) (load "preview-latex.el" nil t t) –  shva Oct 15 '11 at 22:18
OK, there's nothing to explain. What's the result of 'pdftex --version' on commandline? Maybe you've got a space in your path? –  Keks Dose Oct 16 '11 at 19:40
@keks Oh, it was "pdfTeX 3.1415926-2.3-1.40.12 (TeX Live 2011) kpathsea version 6.0.1 Copyright 2011 Peter Breitenlohner (eTeX)/Han The Thanh (pdfTeX). There is NO warranty. Redistribution of this software is covered by the terms of both the pdfTeX copyright and the Lesser GNU General Public License. For more information about these matters, see the file named COPYING and the pdfTeX source. Primary author of pdfTeX: Peter Breitenlohner (eTeX)/Han The Thanh (pdfTeX). Compiled with libpng 1.5.2; using libpng 1.5.2 Compiled with zlib 1.2.5; using zlib 1.2.5 Compiled with xpdf version 3.02pl5 " –  shva Oct 18 '11 at 0:03
So I guess the path was fine.. –  shva Oct 18 '11 at 0:04

AUCTeX complains that pdflatex cannot be found. However, according to your comments you checked and found pdftex, not pdflatex, which still can be missing.

Today, pdflatex if often just a symbolic link to pdftex. For example, on my Ubuntu system with TeX Live 2011:

> ls -l which pdflatex
lrwxrwxrwx 1 root root 49 2011-10-07 22:13 /usr/local/bin/pdflatex
-> /usr/local/texlive/2011/bin/x86_64-linux/pdflatex
> ls -l /usr/local/texlive/2011/bin/x86_64-linux/pdflatex
lrwxrwxrwx 1 root root 6 2009-08-15 19:49
/usr/local/texlive/2011/bin/x86_64-linux/pdflatex -> pdftex


It finally points to pdftex.

So, you could

• configure Emacs/AUCTeX to run pdftex instead of pdflatex, since LaTeX is just the format, not the engine or executable
• or create a symbolic link, such as by

ln -s /usr/local/texlive/2011/bin/x86_64-linux/pdftex pdflatex


in your path, where it can be found.

• or use the TeX Live Manager, start it by

sudo tlmgr -gui


and have a look in the menu Actions/ Managing symbolic links to the point update symbolic links or let it create symbolic links, this is also possible via command line option to tlmgr (see tlmgr --help).

-