Skip to content

Commit

Permalink
Tweak Citar and TeX
Browse files Browse the repository at this point in the history
  • Loading branch information
Eric Zhuo Chen committed Apr 15, 2024
1 parent 6aa7afc commit b259d18
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
9 changes: 8 additions & 1 deletion modules/zy-bib.el
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,12 @@
(after! '(+platform citar)
(setq citar-file-open-functions '((t . +platform/open-externally))))

;; Embark integration for Citar.
;; Load Citar early for relevant modes.
(after! '(tex-mode org markdown-mode)
(require 'citar))

(after! 'citar
;; Embark integration for Citar.
(citar-embark-mode 1))

;; Configure the built-in library `bibtex', which is used to edit BibTeX files
Expand All @@ -72,6 +76,9 @@
;; Using 5 words for title is too long. I prefer shorter keys.
(setq bibtex-autokey-titlewords 2)

;; Do not use more than 2 words. Short keys are prettier!
(setq bibtex-autokey-titlewords-stretch 0)

;; Separate everything with underscores.
(setq bibtex-autokey-name-year-separator "_"
bibtex-autokey-year-title-separator "_")
Expand Down
6 changes: 5 additions & 1 deletion modules/zy-personal.el
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,11 @@ Org-journal, Org-roam, and many more."
ebib-notes-directory
(expand-file-name "ebib/notes" path)
ebib-file-search-dirs
`(,(expand-file-name "ebib/files" path))))
`(,(expand-file-name "ebib/files" path)))
;; Citar paths (same as the Ebib ones).
(defvar citar-bibliography)
(setq citar-bibliography
`(,(expand-file-name "ebib/references.bib" path))))
;; Otherwise, warn about it when necessary.
(when +personal-enable
(lwarn 'zyemacs :warning "Zybox path is not valid."))))
Expand Down
9 changes: 7 additions & 2 deletions modules/zy-tex.el
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,15 @@
nil LaTeX-mode-map "<localleader>"
"a" (cons "Run All" #'TeX-command-run-all)
"c" (cons "Run Command" #'TeX-command-master)
"e" (cons "Insert Env" #'LaTeX-environment)
"e" (cons "Ins. Env" #'LaTeX-environment)
"f" (cons "Set Font" #'TeX-font)
"v" (cons "View" #'TeX-view)
"_" (cons "Choose Master File" #'TeX-master-file-ask)))
"_" (cons "Choose Master File" #'TeX-master-file-ask))

;; Use a key for inserting citations with Citar.
(after! '(+bib citar)
(keybind! nil +tex-map
"i" (cons "Ins. Citation" #'citar-insert-citation))))

(provide 'zy-tex)

Expand Down

0 comments on commit b259d18

Please sign in to comment.