]> git.donarmstrong.com Git - lib.git/commitdiff
use-package for tex
authorDon Armstrong <don@donarmstrong.com>
Sat, 29 Apr 2017 17:07:33 +0000 (10:07 -0700)
committerDon Armstrong <don@donarmstrong.com>
Sat, 29 Apr 2017 17:18:12 +0000 (10:18 -0700)
emacs_el/configuration/don-configuration.org

index 1622d4dc6fab0ac69308a294a1b149848debaf5a..be27ed9d7864144f9ae34cafa0916f7e29015f5e 100644 (file)
@@ -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