Spring-cleaning
This commit is contained in:
parent
39e03f4cf1
commit
5f14efbc20
1 changed files with 12 additions and 117 deletions
|
@ -1,15 +1,8 @@
|
|||
;;; lang/latex/config.el -*- lexical-binding: t; -*-
|
||||
|
||||
(defvar +latex-bibtex-file ""
|
||||
"File AUCTeX (specifically RefTeX) uses to search for citations.")
|
||||
|
||||
(defvar +latex-indent-level-item-continuation 4
|
||||
"Custom indentation level for items in enumeration-type environments")
|
||||
|
||||
;;
|
||||
;; Plugins
|
||||
;;
|
||||
|
||||
;; sp's default rules are obnoxious, so disable them
|
||||
(provide 'smartparens-latex)
|
||||
|
||||
|
@ -33,14 +26,9 @@
|
|||
(setq-default TeX-master nil)
|
||||
;; Display the output of the latex commands in a popup.
|
||||
(set-popup-rule! " output\\*$" :size 15)
|
||||
|
||||
;; TeX Font Styling
|
||||
;; (def-package! tex-style :defer t)
|
||||
|
||||
;; TeX Folding
|
||||
(add-hook 'TeX-mode-hook #'TeX-fold-mode))
|
||||
|
||||
|
||||
(after! latex
|
||||
(setq LaTeX-section-hook ; Add the toc entry to the sectioning hooks.
|
||||
'(LaTeX-section-heading
|
||||
|
@ -73,28 +61,8 @@
|
|||
(dolist (env '("itemize" "enumerate" "description"))
|
||||
(add-to-list 'LaTeX-indent-environment-list `(,env +latex/LaTeX-indent-item)))
|
||||
|
||||
;;
|
||||
;; Use Okular if the user says so.
|
||||
(when (featurep! +okular)
|
||||
;; Configure Okular as viewer. Including a bug fix
|
||||
;; (https://bugs.kde.org/show_bug.cgi?id=373855)
|
||||
(add-to-list 'TeX-view-program-list '("Okular" ("okular --unique file:%o" (mode-io-correlate "#src:%n%a"))))
|
||||
(add-to-list 'TeX-view-program-selection '(output-pdf "Okular")))
|
||||
|
||||
;; Or Skim
|
||||
(when (featurep! +skim)
|
||||
(add-to-list 'TeX-view-program-selection 'output-pdf '("Skim")))
|
||||
|
||||
;; Or Zathura
|
||||
(when (featurep! +zathura)
|
||||
(add-to-list 'TeX-view-program-selection '(output-pdf "Zathura")))
|
||||
|
||||
;; Or PDF-tools, but only if the module is also loaded
|
||||
(when (and (featurep! :tools pdf)
|
||||
(featurep! +pdf-tools))
|
||||
(add-to-list 'TeX-view-program-selection '(output-pdf "PDF Tools"))
|
||||
;; Enable auto reverting the PDF document with PDF Tools
|
||||
(add-hook 'TeX-after-compilation-finished-functions #'TeX-revert-document-buffer)))
|
||||
;; Set-up viewers
|
||||
(load! "+viewers"))
|
||||
|
||||
|
||||
(def-package! preview
|
||||
|
@ -104,83 +72,6 @@
|
|||
preview-scale-function
|
||||
(lambda () (* (/ 10.0 (preview-document-pt)) preview-scale))))
|
||||
|
||||
|
||||
(def-package! latex-preview-pane
|
||||
:when (featurep! +preview-pane)
|
||||
:hook ((latex-mode LaTeX-mode) . latex-preview-pane-enable)
|
||||
:commands latex-preview-pane-mode
|
||||
:init
|
||||
(setq latex-preview-pane-multifile-mode 'auctex)
|
||||
:config
|
||||
(add-to-list 'TeX-view-program-list '("preview-pane" latex-preview-pane-mode))
|
||||
(add-to-list 'TeX-view-program-selection '(output-pdf "preview-pane"))
|
||||
(define-key! doc-view-mode-map
|
||||
(kbd "ESC") #'delete-window
|
||||
"q" #'delete-window
|
||||
"k" (λ! (quit-window) (delete-window))))
|
||||
|
||||
|
||||
(def-package! reftex
|
||||
:hook ((latex-mode LaTeX-mode) . turn-on-reftex)
|
||||
:init
|
||||
(setq reftex-plug-into-AUCTeX t
|
||||
reftex-toc-split-windows-fraction 0.3)
|
||||
:config
|
||||
;; Get ReTeX working with biblatex
|
||||
;; http://tex.stackexchange.com/questions/31966/setting-up-reftex-with-biblatex-citation-commands/31992#31992
|
||||
(setq reftex-cite-format
|
||||
'((?t . "\\textcite[]{%l}")
|
||||
(?a . "\\autocite[]{%l}")
|
||||
(?c . "\\cite[]{%l}")
|
||||
(?s . "\\smartcite[]{%l}")
|
||||
(?f . "\\footcite[]{%l}")
|
||||
(?n . "\\nocite{%l}")
|
||||
(?b . "\\blockcquote[]{%l}{}")))
|
||||
(unless (string-empty-p +latex-bibtex-file)
|
||||
(setq reftex-default-bibliography (list (expand-file-name +latex-bibtex-file))))
|
||||
(map! :map reftex-mode-map
|
||||
:localleader :n ";" 'reftex-toc)
|
||||
(add-hook! 'reftex-toc-mode-hook
|
||||
(reftex-toc-rescan)
|
||||
(map! :local
|
||||
:e "j" #'next-line
|
||||
:e "k" #'previous-line
|
||||
:e "q" #'kill-buffer-and-window
|
||||
:e "ESC" #'kill-buffer-and-window)))
|
||||
|
||||
|
||||
(def-package! bibtex
|
||||
:defer t
|
||||
:config
|
||||
(setq bibtex-dialect 'biblatex
|
||||
bibtex-align-at-equal-sign t
|
||||
bibtex-text-indentation 20)
|
||||
(define-key bibtex-mode-map (kbd "C-c \\") #'bibtex-fill-entry))
|
||||
|
||||
(def-package! auctex-latexmk
|
||||
:when (featurep! +latexmk)
|
||||
:after-call (latex-mode-hook LaTeX-mode-hook)
|
||||
:init
|
||||
;; Pass the -pdf flag when TeX-PDF-mode is active
|
||||
(setq auctex-latexmk-inherit-TeX-PDF-mode t)
|
||||
;; Set LatexMk as the default
|
||||
(setq-hook! LaTeX-mode TeX-command-default "LatexMk")
|
||||
:config
|
||||
;; Add latexmk as a TeX target
|
||||
(auctex-latexmk-setup))
|
||||
|
||||
(def-package! ivy-bibtex
|
||||
:when (featurep! :completion ivy)
|
||||
:commands ivy-bibtex)
|
||||
|
||||
(def-package! helm-bibtex
|
||||
:when (featurep! :completion helm)
|
||||
:commands helm-bibtex)
|
||||
|
||||
(after! bibtex-completion
|
||||
(unless (string-empty-p +latex-bibtex-file)
|
||||
(setq bibtex-completion-bibliography (list (expand-file-name +latex-bibtex-file)))))
|
||||
|
||||
(def-package! company-auctex
|
||||
:when (featurep! :completion company)
|
||||
:after latex
|
||||
|
@ -198,13 +89,17 @@
|
|||
company-auctex-environments))
|
||||
company-backends)))))
|
||||
|
||||
(def-package! company-reftex
|
||||
:when (featurep! :completion company)
|
||||
:after reftex
|
||||
:config
|
||||
(set-company-backend! 'reftex-mode 'company-reftex-labels 'company-reftex-citations))
|
||||
|
||||
;; Nicely indent lines that have wrapped when visual line mode is activated
|
||||
(def-package! adaptive-wrap
|
||||
:hook (LaTeX-mode . adaptive-wrap-prefix-mode)
|
||||
:init (setq-default adaptive-wrap-extra-indent 0))
|
||||
|
||||
;; referencing + bibtex setup
|
||||
(load! "+ref")
|
||||
|
||||
;;
|
||||
;; Sub-modules
|
||||
;;
|
||||
|
||||
(if (featurep! +latexmk) (load! "+latexmk"))
|
||||
(if (featurep! +preview-pane) (load! "+preview-pane"))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue