我在 OS X El capitan 上使用 Emacs 25.3。当我C-c C-c编译文档时.tex
,我收到以下提示。这些选项中的每一个实际上都会运行,latexmk
但不知何故,有很多同名的提示令我烦恼。而且,synctex
有时会停止工作。这是怎么回事?我应该在 上询问吗emacs stackexchange
?
根据 Arash Esbati 的评论进行编辑:这是我的完整AUCTeX
配置。
;; AucTeX configuration
(setq TeX-auto-save t)
(setq TeX-parse-self t)
(setq-default TeX-master nil)
(add-hook 'LaTeX-mode-hook 'visual-line-mode)
(add-hook 'LaTeX-mode-hook 'flyspell-mode)
(add-hook 'LaTeX-mode-hook 'LaTeX-math-mode)
(add-hook 'LaTeX-mode-hook 'turn-on-reftex)
(setq reftex-plug-into-AUCTeX t)
(setq TeX-PDF-mode t)
;; Use Skim as viewer, enable source <-> PDF sync
;; make latexmk available via C-c C-c
;; Note: SyncTeX is setup via ~/.latexmkrc (see below)
(add-hook 'LaTeX-mode-hook (lambda ()
(push
'("latexmk" "latexmk -pdf %s" TeX-run-TeX nil t
:help "Run latexmk on file")
TeX-command-list)))
(add-hook 'TeX-mode-hook '(lambda () (setq TeX-command-default "latexmk")))
;; use Skim as default pdf viewer
;; Skim's displayline is used for forward search (from .tex to .pdf)
;; option -b highlights the current line; option -g opens Skim in the background
(setq TeX-view-program-selection '((output-pdf "PDF Viewer")))
(setq TeX-view-program-list
'(("PDF Viewer" "/Applications/Skim.app/Contents/SharedSupport/displayline -b %n %o %b")))
这是我的.latexmkrc
配置
$recorder = 1;
$pdf_mode = 1; # tex -> pdf
$pdf_previewer = 'open -a Skim %O %S';
$bibtex_use = 2;
$pdflatex = 'pdflatex -synctex=1 -interaction=nonstopmode -shell-escape %O %S';
@generated_exts = (@generated_exts, 'synctex.gz');
$clean_ext = 'synctex.gz synctex.gz(busy) run.xml tex.bak bbl bcf fdb_latexmk run tdo %R-blx.bib';
print("Config file located at $HOME/.latexmkrc\n");
答案1
我认为问题在于您使用函数将latexmk
条目放入。它不会检查条目是否已经存在,而只是添加它。因此,每次调用时都会添加一个条目。您可以通过使用而不是来解决这个问题:TeX-command-list
push
LaTeX-mode-hook
add-to-list
push
(add-hook 'LaTeX-mode-hook
(lambda ()
(add-to-list 'TeX-command-list
'("latexmk" "latexmk -pdf %s" TeX-run-TeX nil t
:help "Run latexmk on file"))))
一般来说,你可以用或简称来检查变量的值。M-x describe-variable RET var-name RETC-h v var-name RET