2014-12-01 23:20:24 +00:00
|
|
|
(defvar auctex-packages
|
|
|
|
'(
|
|
|
|
auctex
|
2015-04-09 04:13:15 +00:00
|
|
|
company
|
2015-04-06 20:49:53 +00:00
|
|
|
company-auctex
|
2015-04-09 04:13:15 +00:00
|
|
|
evil-matchit
|
2014-12-01 23:20:24 +00:00
|
|
|
))
|
|
|
|
|
|
|
|
(defun auctex/init-auctex ()
|
2015-01-11 20:33:45 +00:00
|
|
|
(use-package tex
|
|
|
|
:defer t
|
|
|
|
:config
|
|
|
|
(progn
|
|
|
|
(defun auctex/build-view ()
|
|
|
|
(interactive)
|
|
|
|
(if (buffer-modified-p)
|
|
|
|
(progn
|
|
|
|
(let ((TeX-save-query nil))
|
|
|
|
(TeX-save-document (TeX-master-file)))
|
|
|
|
(setq build-proc (TeX-command "LaTeX" 'TeX-master-file -1))
|
|
|
|
(set-process-sentinel build-proc 'auctex/build-sentinel))
|
|
|
|
(TeX-view)))
|
|
|
|
|
|
|
|
(defun auctex/build-sentinel (process event)
|
|
|
|
(if (string= event "finished\n")
|
|
|
|
(TeX-view)
|
|
|
|
(message "Errors! Check with C-`")))
|
|
|
|
|
|
|
|
(add-hook 'LaTeX-mode-hook '(lambda () (local-set-key (kbd "H-r") 'auctex/build-view)))
|
|
|
|
(add-hook 'LaTeX-mode-hook 'flyspell-mode)
|
2015-03-31 18:00:38 +00:00
|
|
|
(add-hook 'LaTeX-mode-hook 'company-mode)
|
2015-01-11 20:33:45 +00:00
|
|
|
(add-hook 'LaTeX-mode-hook 'LaTeX-math-mode)
|
|
|
|
(add-hook 'LaTeX-mode-hook 'spacemacs/load-yasnippet)
|
|
|
|
|
|
|
|
(setq spacemacs/key-binding-prefixes '(("mp" . "LaTeX Preview")))
|
|
|
|
(evil-leader/set-key-for-mode 'latex-mode
|
|
|
|
"mb" 'auctex/build-view
|
|
|
|
"me" 'LaTeX-environment
|
|
|
|
"mc" 'LaTeX-close-environment
|
|
|
|
"mi" 'LaTeX-insert-item
|
|
|
|
"mf" 'TeX-font ;; Find a way to rebind tex-fonts
|
|
|
|
|
|
|
|
"mC" 'TeX-command-master
|
|
|
|
|
|
|
|
"mpr" 'preview-region
|
|
|
|
"mpb" 'preview-buffer
|
|
|
|
"mpd" 'preview-document
|
|
|
|
"mpe" 'preview-environment
|
|
|
|
"mps" 'preview-section
|
|
|
|
"mpp" 'preview-at-point
|
|
|
|
"mpf" 'preview-cache-preamble
|
|
|
|
"mpc" 'preview-clearout
|
|
|
|
|
|
|
|
"mhd" 'TeX-doc ;; TeX-doc is a very slow function
|
|
|
|
)
|
|
|
|
|
|
|
|
(setq-default TeX-auto-save t)
|
|
|
|
(setq-default TeX-parse-self t)
|
|
|
|
(setq-default TeX-PDF-mode t))))
|
2015-01-16 04:45:53 +00:00
|
|
|
|
2015-04-06 20:49:53 +00:00
|
|
|
|
2015-04-04 05:41:34 +00:00
|
|
|
(defun auctex/post-init-evil-matchit ()
|
2015-04-09 04:13:15 +00:00
|
|
|
(add-hook 'LaTeX-mode-hook 'evil-matchit-mode))
|
2015-04-07 20:02:53 +00:00
|
|
|
|
|
|
|
(when (configuration-layer/layer-usedp 'auto-completion)
|
2015-04-09 04:13:15 +00:00
|
|
|
(defun auctex/post-init-company ()
|
|
|
|
(spacemacs|add-company-hook LaTeX-mode))
|
|
|
|
|
2015-04-07 20:02:53 +00:00
|
|
|
(defun auctex/init-company-auctex ()
|
2015-04-09 04:13:15 +00:00
|
|
|
(use-package company-auctex
|
|
|
|
:if (configuration-layer/package-usedp 'company)
|
|
|
|
:defer t
|
|
|
|
:init
|
|
|
|
(progn
|
|
|
|
(push 'company-auctex-labels company-backends-LaTeX-mode)
|
|
|
|
(push 'company-auctex-bibs company-backends-LaTeX-mode)
|
|
|
|
(push '(company-auctex-macros company-auctex-symbols company-auctex-environments)
|
|
|
|
company-backends-LaTeX-mode)))))
|