I noticed a difference when compiling a latex document within emacs, but I think this is really a mac question.

When I open emacs via ⌘ - space and then type C-c C-c, instead of compiling with pdflatex, the minibuffer proposes 'Command[\doc-view]', and if I enter 'pdflatex', the TeX-shell (within emacs) tells me 'pdflatex: command not found'.

When I open emacs from a terminal window and type 'open -a emacs', it works fine.

Why is that?

  • When you open terminal .bash_profile and .bashrc executes (session start) and that's the reason you have correct PATH to pdflatex. Add the pdflatex path to /etc/paths and it should work.
    – mspasov
    Mar 7 '18 at 11:11
  • @mspasov Answers should be left as answers, not ephemeral comments
    – grg
    Mar 7 '18 at 12:52
  • @grgarside Sorry, didn't have the time to formulate a proper answer. If my comment is on the spot i'm sure somebody (or I later) will pick it up and write a nice answer with explanations.
    – mspasov
    Mar 7 '18 at 17:55

The problem you are having is a constant for Emacs. It's due to Emacs relying on a couple of things that are set in a bash shell that aren't available in the GUI.

The most notable of these is the PATH variable. That's why pdflatex isn't being found.

Check https://www.emacswiki.org/emacs/EmacsApp for a better explanation and some things you can do to make it easier.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .