[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: “exec-path” alone or “PATH” alone is unable to call up SumatraPDF

From: Eli Zaretskii
Subject: Re: “exec-path” alone or “PATH” alone is unable to call up SumatraPDF
Date: Mon, 18 Dec 2017 18:16:53 +0200

> Date: Mon, 18 Dec 2017 18:04:47 +0800
> From: "" <>
> I construct a latex editing environment by "windows7 + Emacs25.3 + auctex + 
> Miktex+SumatraPDF". The package auctex is installed by ELPA of Emacs. As I 
> don't want the content of environment variable "Path" of my windows7 
> operating system changed, I put the following codes in "init.el":
> ;; Put the path of SumatraPDF.exe in the Emacs variable "exec-path":
> (setq exec-path (append '("E:/tex/SumatraPDF") exec-path))
> ;; Put the path of Miktex in the Emacs variable "PATH":
> (setenv "PATH" (concat "E:/tex/miktex/miktex/bin" ";" (getenv "PATH")))
> ;; define tex complier
> (setq-default TeX-engine 'xetex)
> (setq TeX-command-default "XeLaTeX")
> ;; define PDF viewer
> (setq TeX-PDF-mode t)
> (setq TeX-view-program-selection '((output-pdf "SumatraPDF")))
> After this, my tex documents can be complied successfully when clicking the 
> button "Run LaTex" on the Emacs tool bar, but SumatraPDF does not work when 
> clicking the button "Run Viewer".
> Then I move the the path of SumatraPDF.exe from "exec-path" to "PATH", 
> SumatraPDF.exe does not work eigher. I have to put the path of SumatraPDF.exe 
> both in "PATH" and in "exec-path". SumatraPDF.exe does work this time.
> So why is that "exec-path" alone or "PATH" alone is unable to call up 
> SumatraPDF?

My advice: do NOT tweak your PATH by tricks from inside Emacs.
Instead, change the PATH outside of Emacs (and restart Emacs if it
already runs when you make the PATH changes).  This way you guarantee
that all the Emacs features that use PATH, exec-path, and whatnot are
in sync with your system and your shell, and the above problems will
never happen.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]