emacs 探索之五:latex配置
最近需要使用Latex写论文,之前一直在用emacs,而且渐渐理解emacs的思想之后发现大多数
事情都能够在emacs中完成,那么自然会想到emacs是否能够与latex相结合。
Google一下发现好多方式,当前前提是需要安装latex软件,然后emacs中配置auctex这个插
件,分为四步:
一、安装latex
二、安装auctex
三、.emacs中关于auctex的基本配置
四、.eamcs中自我偏好设置
修改C-c C-c或者C-c C-v的默认pdf阅读器evince为acroread,具体修改代码如下
(setq TeX-view-program-list '(("acroread" "acroread %s.pdf"))) (setq TeX-view-program-selection '((output-pdf "acroread")))
以下是我emacs中关于auctex的相关设置,其中auctex-11.86是从网上下载到的源码文件,
存放在.emacs.d目录下;
;;--------------------latex--------------------------------------------- (add-to-list 'load-path "~/.emacs.d/auctex-11.86") (load "auctex.el" nil t t) (load "preview-latex.el" nil t t) (if (string-equal system-type "windows-nt") (require 'tex-mik)) (mapc (lambda (mode) (add-hook 'LaTeX-mode-hook mode)) (list 'auto-fill-mode 'LaTeX-math-mode 'turn-on-reftex 'linum-mode 'turn-on-auto-fill )) (add-hook 'LaTeX-mode-hook (lambda () (setq TeX-auto-untabify t ; remove all tabs before saving TeX-engine 'xetex ; use xelatex default TeX-show-compilation t ;; display compilation windows turn-on-auto-fill t ) (TeX-global-PDF-mode t) ; PDF mode enable, not plain (setq TeX-save-query nil) (imenu-add-menubar-index) (define-key LaTeX-mode-map (kbd "TAB") 'TeX-complete-symbol))) ;(global-set-key (kbd "M-q") 'auto-fill-mode) (global-set-key (kbd "C-c j") 'auto-fill-mode) ;回车时自动缩进 (setq TeX-newline-function 'newline-and-indent) (setq TeX-view-program-list '(("acroread" "acroread %s.pdf"))) (setq TeX-view-program-selection '((output-pdf "acroread"))) ;;-------------------------------------------------------------------------