all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* “exec-path” alone or “PATH” alone is unable to call up SumatraPDF
@ 2017-12-18 10:04 liyanlin
  2017-12-18 15:11 ` Óscar Fuentes
  2017-12-18 16:16 ` Eli Zaretskii
  0 siblings, 2 replies; 3+ messages in thread
From: liyanlin @ 2017-12-18 10:04 UTC (permalink / raw)
  To: help-gnu-emacs


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?


liyanlin@csair.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: “exec-path” alone or “PATH” alone is unable to call up SumatraPDF
  2017-12-18 10:04 “exec-path” alone or “PATH” alone is unable to call up SumatraPDF liyanlin
@ 2017-12-18 15:11 ` Óscar Fuentes
  2017-12-18 16:16 ` Eli Zaretskii
  1 sibling, 0 replies; 3+ messages in thread
From: Óscar Fuentes @ 2017-12-18 15:11 UTC (permalink / raw)
  To: help-gnu-emacs

"liyanlin@csair.com" <liyanlin@csair.com> writes:

> 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?

Probably auctex uses `executable-find' for checking the existence of the
viewer (SumatraPDF in this case) before executing it. `executable-find'
uses `exec-path'.

You don't need PATH/exec-path for executing the pdf reader. Something
like this:

(setq TeX-output-view-style
	  (cons (list "^pdf$" "." "\"c:/path/to/sumatraPDF.exe\" %o")
		TeX-output-view-style))

should do the trick.




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: “exec-path” alone or “PATH” alone is unable to call up SumatraPDF
  2017-12-18 10:04 “exec-path” alone or “PATH” alone is unable to call up SumatraPDF liyanlin
  2017-12-18 15:11 ` Óscar Fuentes
@ 2017-12-18 16:16 ` Eli Zaretskii
  1 sibling, 0 replies; 3+ messages in thread
From: Eli Zaretskii @ 2017-12-18 16:16 UTC (permalink / raw)
  To: help-gnu-emacs

> Date: Mon, 18 Dec 2017 18:04:47 +0800
> From: "liyanlin@csair.com" <liyanlin@csair.com>
> 
> 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.



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-12-18 16:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-18 10:04 “exec-path” alone or “PATH” alone is unable to call up SumatraPDF liyanlin
2017-12-18 15:11 ` Óscar Fuentes
2017-12-18 16:16 ` Eli Zaretskii

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.