Configure latexmk as the default build command

This commit is contained in:
Ista Zahn 2015-08-11 07:46:59 -04:00 committed by Eivind Fonn
parent 7dca03151c
commit 852ec8fb41
3 changed files with 20 additions and 9 deletions

View File

@ -21,6 +21,7 @@
This layer adds support for LaTeX files with [[https://savannah.gnu.org/projects/auctex/][AucTeX]]. This layer adds support for LaTeX files with [[https://savannah.gnu.org/projects/auctex/][AucTeX]].
** Features ** Features
- Auto-build with [[https://github.com/tom-tan/auctex-latexmk/][auctex-latexmk]]
- Auto-completion with [[https://github.com/alexeyr/company-auctex][company-auctex]] - Auto-completion with [[https://github.com/alexeyr/company-auctex][company-auctex]]
- Tags navigation on ~%~ with [[https://github.com/redguardtoo/evil-matchit][evil-matchit]] - Tags navigation on ~%~ with [[https://github.com/redguardtoo/evil-matchit][evil-matchit]]
- Labels, references, citations and index entries management with [[http://www.gnu.org/software/emacs/manual/html_node/reftex/index.html][RefTeX]] - Labels, references, citations and index entries management with [[http://www.gnu.org/software/emacs/manual/html_node/reftex/index.html][RefTeX]]
@ -55,14 +56,18 @@ when you recompile.
** Build command ** Build command
A build command can be specific via the layer variable =latex-build-command=. A build command can be specified via the layer variable =latex-build-command=.
The default value is =LaTeX=. If =LatexMk= is specified, the appropriate If =LatexMk= is specified, the appropriate =LatexMk= configuration
=LatexMk= configuration will be applied. will be applied. (the default on systems with =latexmk= in the path)
This variable can be set to any of the entities in =TeX-command-list=,
including any custom entries you may have added there. To use the
regular =AucTeX= command set =latex-build-command= to =LaTeX= as shown
below.
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
dotspacemacs-configuration-layers '( dotspacemacs-configuration-layers '(
(latex :variables latex-build-command "LatexMk")) (latex :variables latex-build-command "LaTeX"))
#+END_SRC #+END_SRC
** Auto-fill ** Auto-fill

View File

@ -15,7 +15,7 @@
;; Company-mode LaTeX-backend ;; Company-mode LaTeX-backend
(spacemacs|defvar-company-backends LaTeX-mode) (spacemacs|defvar-company-backends LaTeX-mode)
(defvar latex-build-command "LaTeX" (defvar latex-build-command (if (executable-find "latexmk") "LatexMk" "LaTeX")
"The default command to use with `SPC m b'") "The default command to use with `SPC m b'")
(defvar latex-enable-auto-fill t (defvar latex-enable-auto-fill t

View File

@ -77,10 +77,16 @@
"mv" 'TeX-view)))) "mv" 'TeX-view))))
(when (string= latex-build-command "LatexMk") (when (string= latex-build-command "LatexMk")
(defun latex/init-auctex-latexmk () (defun latex/init-auctex-latexmk ()
(use-package auctex-latexmk (use-package auctex-latexmk
:defer t :defer t
:init (add-hook 'LaTeX-mode-hook 'auctex-latexmk-setup)))) :init
(progn
(eval-after-load "tex-mode"
'(progn
(auctex-latexmk-setup)
(setq auctex-latexmk-inherit-TeX-PDF-mode t)))
(add-hook 'LaTeX-mode-hook (lambda() (setq TeX-command-default "LatexMk")))))))
(when (configuration-layer/layer-usedp 'auto-completion) (when (configuration-layer/layer-usedp 'auto-completion)
(defun latex/post-init-company () (defun latex/post-init-company ()