I have the following function attached to f2
key in latex mode:
(defun latex-compile ()
"Runs pdflatex on current file"
(interactive)
(let* ((file-name (shell-quote-argument (buffer-file-name)))
(process (start-process-shell-command
"pdflatex"
"*async pdflatex*"
(concat "pdflatex " file-name))))
(set-process-sentinel process 'latex-sentinel)
(setq new-window (split-window-below 30))
(set-window-buffer new-window "*async pdflatex*")
(other-window 1)
(set-process-query-on-exit-flag process nil)
(local-set-key (kbd "z") 'latex-kill-async-pdflatex)
))
pdflatex
program is located in /usr/local/texlive/2016/bin/i386-linux
. I have the following in .bash_profile and .bashrc:
PATH=$PATH:/usr/local/texlive/2016/bin/i386-linux
When I click <f2>
in GUI Emacs, it says: "/usr/bin/bash: pdflatex: command not found".
But in console Emacs it works.
I have also added
(setq exec-path (append exec-path '("/usr/local/texlive/2016/bin/i386-linux")))
to .emacs, but it didn't help.