BibTeX Actions

about | blog | config | notes | github

1. Quickly Find and Act on BibTeX Entries

bibtex-actions is a package that is meant to quickly find BibTeX entries using the BibTeX Completions backend via completion frameworks like Vertico, also adding various actions that can be run via Embark.

2. Configuration

2.1. Setup Dependencies

We really just need to make sure Embark is configured first probably.

(require 'init-embark)

More importantly, bibtex-actions makes use of BibTeX Completions which needs to be configured as well.

(require 'init-bibtex-completions)

2.2. Package Install

While setting up the package.

(use-package bibtex-actions
  :after embark
  :config (add-to-list 'embark-keymap-alist '(bibtex  . bibtex-actions-map)))

2.3. Setup Action Inputs

I prefer to have the initial inputs for the various commands setup a little differently. Find it more intuitive.

(setq bibtex-actions-initial-inputs
  '((pdf    . "has:pdf")
    (note   . "has:note")
    (link   . "has:link")
    (source . nil)))

2.4. Configure Template

(setq bibtex-actions-template
      '((t . "${author:20}   ${title:48}   ${year:4}")))
(setq bibtex-actions-template-suffix
      '((t . "          ${=key=:15}    ${=type=:12}    ${tags:*}")))

2.5. All-the-icons Integration

(setq bibtex-actions-symbols
  `((pdf . (,(all-the-icons-icon-for-file "foo.pdf" :face 'all-the-icons-dred) .
            ,(all-the-icons-icon-for-file "foo.pdf" :face 'bibtex-actions-icon-dim)))
    (note . (,(all-the-icons-icon-for-file "foo.txt") .
            ,(all-the-icons-icon-for-file "foo.txt" :face 'bibtex-actions-icon-dim)))
    (link .
        (,(all-the-icons-faicon "external-link-square" :v-adjust 0.02 :face 'all-the-icons-dpurple) .
        ,(all-the-icons-faicon "external-link-square" :v-adjust 0.02 :face 'bibtex-actions-icon-dim)))))

Here we define a face to dim non 'active' icons, but preserve alignment

(defface bibtex-actions-icon-dim
    '((((background dark)) :foreground "#282c34")
     (((background light)) :foreground "#fafafa"))
     "Face for obscuring/dimming icons"
     :group 'all-the-icons-faces)

2.6. Feature Provide

(provide 'init-bibtex-actions)

Created: 2021-11-13

Emacs 26.1 (Org mode 9.5)