我在spacemacs 的user-config 里添加了latex 的执行路径,为什么还是说找不到呢?
(require 'org)
(require 'ox-latex)
(setq org-latex-create-formula-image-program 'dvipng)
(org-babel-do-load-languages 'org-babel-load-languages '((latex . t)))
)
(setq exec-path (append exec-path '("/usr/local/texlive/2020/bin/x86_64-linux/latex")))
which路径下的latex 和dvipng 都在的呀
你这是文件路径吧?PATH 应该加的是文件夹,把最后的 latex 去掉。
去掉latex 后,加载文件夹,出现下面这个:
executing Latex code block…
/bin/bash: latex: command not found
org-compile-file: File “/tmp/orgtexJSKIH5.dvi” wasn’t produced. Please adjust ‘dvipng’ part of ‘org-
preview-latex-process-alist’.
user-error: Minibuffer window is not active
出现了这个,谢谢您的回复!
.zshrc里加入了latex 的path 了
➜ ~ echo $PATH
/home/ufo/anaconda3/envs/obspy/bin:/usr/local/sac/bin:/home/ufo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/local/texlive/2020/bin/x86_64-linux:/usr/local/sac/bin
" M-! which pdflatex RET
" 或者" M-! which latex RET
" 提示:
(Shell command failed with code 1 and no output) [3 times]
spacemacs的shell 却找不到latex
通过 Shell 执行命令要找环境变量 PATH
,无论任何地方都如此(比如终端、Emacs 的 M-!),直接执行命令用不着 Shell / PATH
,如 call-process
,会用到 exec-path
,比如:
;; `exec-path' 里有 foo
(call-process "date")
;; PATH 里有 foo
(shell-command "date")
ob-latex 可能是用 shell-command 执行的,所以要加到 Emacs 的 PATH 里,能自动继承最好了(比如从桌面环境、终端),手动加的话,应该是:
(setenv
"PATH"
(concat
"/usr/local/texlive/2020/bin/x86_64-linux/:"
(getenv "PATH")))