I am running Emacs 25 on Kubuntu 17.10.

I have a texlive installation in:


echo $PATH produces:


But out of this, /home/user/texlive/2017/bin/x86_64slinux was added by hand in my ~/.zshrc.

So, I added the following line to my ~/.emacs:

(setenv "PATH" (concat (getenv "PATH") ":/home/user/texlive/2017/bin/x86_64-linux")

Now, (getenv "PATH") shows the full path as mentioned above.

And yet when I try to compile a .tex file using C-c C-a, it produces an error:

AUCTeX cannot find a working TeX distribution.

What is happening? How do I get AUCTeX to compile?

  • 2
    What's the output of (getenv "PATH")?
    – matteol
    Dec 4 '17 at 12:11
  • @matteol I am surprized! It is /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games The last part was added in my ~/.zshrc by hand. I think that is the cause of the error. How do I set it right?
    – deshmukh
    Dec 4 '17 at 12:37
  • I don't know but if you add details about your OS an emacs version maybe someone else can help you
    – matteol
    Dec 4 '17 at 12:40
  • @matteol Done that. Edited the question so all can see.
    – deshmukh
    Dec 4 '17 at 12:46
  • Emacs doesn't read shell rc files on its own by default, so customizing your PATH there won't affect what's set in emacs.
    – user12563
    Dec 4 '17 at 12:52

You may have two possible solutions:

a) use the package exec-path-from-shell to add your path in emacs init.el file

b) add/modify this code to your auctex initialization in init.el file (this is mine for mac):

(setenv "PATH" (concat "/Library/TeX/texbin:"
                         (getenv "PATH")))
(add-to-list 'exec-path "/Library/TeX/texbin")

Set the PATH variable in .profile not in .zshrc and remove the change in .emacs. Logout and login again.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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