2018-07-18 12:11:53 +02:00
|
|
|
;;; lang/latex/+ref.el -*- lexical-binding: t; -*-
|
|
|
|
|
|
|
|
(def-package! reftex
|
2018-07-18 13:39:15 +02:00
|
|
|
:hook (LaTeX-mode . reftex-mode)
|
2018-07-18 12:11:53 +02:00
|
|
|
: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
|
2018-07-18 15:38:32 +02:00
|
|
|
'((?a . "\\autocite[]{%l}")
|
|
|
|
(?b . "\\blockcquote[]{%l}{}")
|
2018-07-18 12:11:53 +02:00
|
|
|
(?c . "\\cite[]{%l}")
|
|
|
|
(?f . "\\footcite[]{%l}")
|
|
|
|
(?n . "\\nocite{%l}")
|
2018-07-18 15:38:32 +02:00
|
|
|
(?p . "\\parencite[]{%l}")
|
|
|
|
(?s . "\\smartcite[]{%l}")
|
|
|
|
(?t . "\\textcite[]{%l}"))
|
2018-07-18 13:39:15 +02:00
|
|
|
reftex-plug-into-AUCTeX t
|
|
|
|
reftex-toc-split-windows-fraction 0.3)
|
2018-07-18 12:11:53 +02:00
|
|
|
(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)))
|
|
|
|
|
2018-07-18 13:39:15 +02:00
|
|
|
;; set up completion for citations and references
|
2018-07-18 12:11:53 +02:00
|
|
|
(def-package! company-reftex
|
|
|
|
:when (featurep! :completion company)
|
2018-07-18 16:58:26 +02:00
|
|
|
:defer t
|
|
|
|
:init
|
2018-07-18 12:11:53 +02:00
|
|
|
(set-company-backend! 'reftex-mode 'company-reftex-labels 'company-reftex-citations))
|
|
|
|
|
2018-07-18 13:39:15 +02:00
|
|
|
;; set up mode for bib files
|
2018-07-18 15:31:35 +02:00
|
|
|
(after! bibtex
|
2018-07-18 12:11:53 +02:00
|
|
|
(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! 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)))))
|
|
|
|
|
|
|
|
|