我一直试图让 Skim 从 emacs 启动。但总是提示“找不到匹配的查看器”。这是我的 .emacs 的设置,我确信这里出了问题,但无法找出原因。如能得到帮助,不胜感激。
谢谢
(add-hook 'LaTeX-mode-hook 'TeX-source-correlate-mode)
(setq command-line-default-directory "~/")
(setq TeX-source-correlate-method 'synctex)
(setq reftex-ref-macro-prompt nil)
(add-hook 'LaTeX-mode-hook
(lambda()
(add-to-list 'TeX-expand-list
'("%q" skim-make-url))))
(defun skim-make-url () (concat
(TeX-current-line)
" \""
(expand-file-name (funcall file (TeX-output-extension) t)
(file-name-directory (TeX-master-file)))
"\" \""
(buffer-file-name)"\""))
;; This line tells emacs where to find the latex compiler
(setenv "PATH" (concat "/usr/texbin:" (getenv "PATH")))
'(LaTeX-command "latex -synctex=1")
(add-hook 'TeX-mode-hook
(lambda ()
(add-to-list 'TeX-output-view-style
'("^pdf$" "."
"/Applications/Skim.app/Contents/SharedSupport/displayline -b %q %n %o %b")))
)
;; start emacs in server mode so that skim can talk to it
(server-start);
;; This line tells emacs to create pdf files instead of dvi files.
(setq-default TeX-PDF-mode t)
(setq TeX-view-program-list
'(("PDF Viewer" "/Applications/Skim.app/Contents/SharedSupport/displayline -b -g %q %n %o %b")))
(setq TeX-view-program-selection '((output-pdf "PDF Viewer")))
答案1
我把这个问题解决了。我实际上手动打开了 Emacs 中 Tex 命令的 Auctex 设置,发现出于某种原因,用于查看 pdf 输出的 Tex 命令未设置为 .emacs 文件中的 PDF 查看器。我手动执行了此操作,现在我可以从 emacs 打开 pdf。这样做极大地改变了我的 .emacs 文件中的设置。下面是 Emacs 添加的额外文本。我还没有时间协调我手动添加到 .emacs 的内容和 Emacs 添加的内容。下面的许多文本实际上对于 pdf 查看来说是多余的,我会在闲暇时清理它们,但现在一切正常。
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(TeX-output-view-style (quote (("^pdf$" "." "/Applications/Skim.app/Contents
/SharedSupport/displayline %q %n %o %b") ("^dvi$" ("^landscape$"
"^pstricks$\\|^pst-\\|^psfrag$") "%(o?)dvips -t landscape %d -o && gv %f") ("^dvi$"
"^pstricks$\\|^pst-\\|^psfrag$" "%(o?)dvips %d -o && gv %f") ("^dvi$" ("^\\(?:a4
\\(?:dutch\\|paper\\|wide\\)\\|sem-a4\\)$" "^landscape$") "%(o?)xdvi %dS -paper a4r
-s 0 %d") ("^dvi$" "^\\(?:a4\\(?:dutch\\|paper\\|wide\\)\\|sem-a4\\)$" "%(o?)xdvi
%dS -paper a4 %d") ("^dvi$" ("^\\(?:a5\\(?:comb\\|paper\\)\\)$" "^landscape$")
"%(o?)xdvi %dS -paper a5r -s 0 %d") ("^dvi$" "^\\(?:a5\\(?:comb\\|paper\\)\\)$"
"%(o?)xdvi %dS -paper a5 %d") ("^dvi$" "^b5paper$" "%(o?)xdvi %dS -paper b5 %d")
("^dvi$" "^letterpaper$" "%(o?)xdvi %dS -paper us %d") ("^dvi$" "^legalpaper$"
"%(o?)xdvi %dS -paper legal %d") ("^dvi$" "^executivepaper$" "%(o?)xdvi %dS -paper
7.25x10.5in %d") ("^dvi$" "." "%(o?)xdvi %dS %d") ("^pdf$" "." "xpdf -remote %s
-raise %o %(outpage)") ("^html?$" "." "netscape %o"))))
'(TeX-view-program-selection (quote (((output-dvi style-pstricks output-pdf) "dvips
and gv") (output-dvi "xdvi") (output-html "xdg-open") (output-pdf "PDF Viewer")))))