From 77332bd11bd1812f5df265f0ff30cb3c181181f4 Mon Sep 17 00:00:00 2001 From: Don Armstrong Date: Sat, 29 Apr 2017 10:07:33 -0700 Subject: [PATCH] use-package for tex --- emacs_el/configuration/don-configuration.org | 194 ++++++++++--------- 1 file changed, 99 insertions(+), 95 deletions(-) diff --git a/emacs_el/configuration/don-configuration.org b/emacs_el/configuration/don-configuration.org index 1622d4d..be27ed9 100644 --- a/emacs_el/configuration/don-configuration.org +++ b/emacs_el/configuration/don-configuration.org @@ -360,101 +360,105 @@ value, scrolling continues until there is no more output. #+END_SRC ** LaTeX #+BEGIN_SRC emacs-lisp - (load "auctex.el" nil t t) - (load "preview-latex.el" nil t t) - (load "latex.el" nil t t) - - ;; this is in the very newest auctex; avoid for now - (add-to-list 'LaTeX-fill-excluded-macros - '("Sexpr")) - (add-to-list 'TeX-style-path '"/home/don/lib/emacs_el/auctex/style") - ;; REFTEX (much enhanced management of cross-ref, labels, etc) - ;; http://www.strw.leidenuniv.nl/~dominik/Tools/reftex/ - (autoload 'reftex-mode "reftex" "RefTeX Minor Mode" t) - (autoload 'turn-on-reftex "reftex" "RefTeX Minor Mode" nil) - (autoload 'reftex-citation "reftex-cite" "Make citation" nil) - (autoload 'reftex-index-phrase-mode "reftex-index" "Phrase mode" t) - (add-hook 'LaTeX-mode-hook 'turn-on-reftex) ; with AUCTeX LaTeX mode - (add-hook 'latex-mode-hook 'turn-on-reftex) ; with Emacs latex mode - (add-hook 'LaTeX-mode-hook 'outline-minor-mode) ; with AUCTeX LaTeX mode - (add-hook 'latex-mode-hook 'outline-minor-mode) ; with Emacs latex mode - - ; use smart quotes by default instead of `` and '' - ; taken from http://kieranhealy.org/esk/kjhealy.html - (setq TeX-open-quote "“") - (setq TeX-close-quote "”") - - ;; (TeX-add-style-hook - ;; "latex" - ;; (lambda () - ;; (TeX-add-symbols - ;; '("DLA" 1)))) - ;; (custom-set-variables - ;; '(font-latex-user-keyword-classes - ;; '(("fixme" - ;; ("DLA" "RZ") - ;; font-lock-function-name-face 2 (command 1 t)))) - ;; ) - - (require 'font-latex) - (setq font-latex-match-reference-keywords - '( - ("fref" "{") - ("Fref" "{") - ("citep" "{") - ("citet" "{") - ("acs" "{") - ("acsp" "{") - ("ac" "{") - ("acp" "{") - ("acl" "{") - ("aclp" "{") - ("acsu" "{") - ("aclu" "{") - ("acused" "{") - ; )) - ; (setq font-latex-match-warning-keywords - ; '( - ("DLA" "{") - ("RZ" "{") - ("OM" "{") - ("DL" "{") - ("fixme" "{"))) - - (setq-default TeX-parse-self t) - (setq-default TeX-auto-save t) - (setq-default TeX-master nil) - (eval-after-load - "latex" - '(TeX-add-style-hook - "cleveref" - (lambda () - (if (boundp 'reftex-ref-style-alist) - (add-to-list - 'reftex-ref-style-alist - '("Cleveref" "cleveref" - (("\\cref" ?c) ("\\Cref" ?C) ("\\cpageref" ?d) ("\\Cpageref" ?D))))) - (reftex-ref-style-activate "Cleveref") - (TeX-add-symbols - '("cref" TeX-arg-ref) - '("Cref" TeX-arg-ref) - '("cpageref" TeX-arg-ref) - '("Cpageref" TeX-arg-ref))))) - ;; this doesn't seem to work; not currently sure why - ; (setq font-latex-user-keyword-classes - ; '(("my-warning-commands" - ; (("DLA" "{") - ; ("RZ" "{") - ; ("OM" "{") - ; ("DL" "{") - ; ("fixme" "{") - ; ) - ; (:foreground "red" :weight bold :underline (:color foreground-color :style line))) - ; )) - - (setq-default reftex-default-bibliography - '("~/projects/research/references.bib")) - + (use-package tex + :defer t + :ensure auctex + :config + (add-to-list 'LaTeX-fill-excluded-macros + '("Sexpr")) + (add-to-list 'TeX-style-path '"/home/don/lib/emacs_el/auctex/style") + ;; REFTEX (much enhanced management of cross-ref, labels, etc) + ;; http://www.strw.leidenuniv.nl/~dominik/Tools/reftex/ + (autoload 'reftex-mode "reftex" "RefTeX Minor Mode" t) + (autoload 'turn-on-reftex "reftex" "RefTeX Minor Mode" nil) + (autoload 'reftex-citation "reftex-cite" "Make citation" nil) + (autoload 'reftex-index-phrase-mode "reftex-index" "Phrase mode" t) + (add-hook 'LaTeX-mode-hook 'turn-on-reftex) ; with AUCTeX LaTeX mode + (add-hook 'latex-mode-hook 'turn-on-reftex) ; with Emacs latex mode + (add-hook 'LaTeX-mode-hook 'outline-minor-mode) ; with AUCTeX LaTeX mode + (add-hook 'latex-mode-hook 'outline-minor-mode) ; with Emacs latex mode + + ;; support fake section headers + (setq TeX-outline-extra + '(("%chapter" 1) + ("%section" 2) + ("%subsection" 3) + ("%subsubsection" 4) + ("%paragraph" 5))) + ;; add font locking to the headers + (font-lock-add-keywords + 'latex-mode + '(("^%\\(chapter\\|\\(sub\\|subsub\\)?section\\|paragraph\\)" + 0 'font-lock-keyword-face t) + ("^%chapter{\\(.*\\)}" 1 'font-latex-sectioning-1-face t) + ("^%section{\\(.*\\)}" 1 'font-latex-sectioning-2-face t) + ("^%subsection{\\(.*\\)}" 1 'font-latex-sectioning-3-face t) + ("^%subsubsection{\\(.*\\)}" 1 'font-latex-sectioning-4-face t) + ("^%paragraph{\\(.*\\)}" 1 'font-latex-sectioning-5-face t))) + + ;; use smart quotes by default instead of `` and '' + ;; taken from http://kieranhealy.org/esk/kjhealy.html + (setq TeX-open-quote "“") + (setq TeX-close-quote "”") + + ;; (TeX-add-style-hook + ;; "latex" + ;; (lambda () + ;; (TeX-add-symbols + ;; '("DLA" 1)))) + ;; (custom-set-variables + ;; '(font-latex-user-keyword-classes + ;; '(("fixme" + ;; ("DLA" "RZ") + ;; font-lock-function-name-face 2 (command 1 t)))) + ;; ) + (setq-default TeX-parse-self t) + (setq-default TeX-auto-save t) + (setq-default TeX-master nil) + (eval-after-load + "latex" + '(TeX-add-style-hook + "cleveref" + (lambda () + (if (boundp 'reftex-ref-style-alist) + (add-to-list + 'reftex-ref-style-alist + '("Cleveref" "cleveref" + (("\\cref" ?c) ("\\Cref" ?C) ("\\cpageref" ?d) ("\\Cpageref" ?D))))) + (reftex-ref-style-activate "Cleveref") + (TeX-add-symbols + '("cref" TeX-arg-ref) + '("Cref" TeX-arg-ref) + '("cpageref" TeX-arg-ref) + '("Cpageref" TeX-arg-ref))))) + + (setq-default reftex-default-bibliography + '("~/projects/research/references.bib")) + (use-package font-latex + :config + (setq font-latex-match-reference-keywords + '( + ("fref" "{") + ("Fref" "{") + ("citep" "{") + ("citet" "{") + ("acs" "{") + ("acsp" "{") + ("ac" "{") + ("acp" "{") + ("acl" "{") + ("aclp" "{") + ("acsu" "{") + ("aclu" "{") + ("acused" "{") + ("DLA" "{") + ("RZ" "{") + ("OM" "{") + ("DL" "{") + ("fixme" "{")) + ) + ) + ) #+END_SRC ** Org -- 2.39.2