Skip to content
This repository has been archived by the owner on Jun 15, 2022. It is now read-only.

mclear-tools/citar-capf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 

Repository files navigation

NOTE: Citar-capf is being merged into citar per this commit. All further development will be a part of the citar repo.

citar-capf provides a completion-at-point function (via the minor-mode citar-capf-mode) for citations in latex, org, and markdown (pandoc) modes. This completion depends on citar and its parsing of bibtex keys. This backend activates for citation styles used by markdown-mode (pandoc, (@)), latex-mode (\cite{}), and org-mode (cite:@).

Please note that citar-capf reads from a bibliography file or files specified in citar-bibliography and presents completion info as set by citar-templates.

Initialization

Load the package and turn on the minor-mode via the following hooks:

(require 'citar-capf)
;; Define hook
(add-hook 'tex-mode-hook #'citar-capf-mode) ;; you may need to define this in more than one tex mode (e.g. latex, reftex, etc). 
(add-hook 'markdown-mode-hook #'citar-capf-mode)
(add-hook 'org-mode-hook #'citar-capf-mode)

If you use use-package, here’s how you might set things:

(use-package citar-capf
  :straight (:type git :host github :repo "mclear-tools/citar-capf")
  ;; NOTE: Set these hooks for whatever modes for which you want citar citation completion
  :hook ((org-mode markdown-mode tex-mode latex-mode reftex-mode) . citar-capf-mode) 
  :config
  ;; if you don't already have this set in citar
  (setq citar-bibliography "path/to/bib")
  (setq citar-templates
      `((main . " ${=key= id:15} ${title:48}")
        (suffix . "${author editor:30}  ${=type=:12}  ${=beref=:12} ${tags keywords:*}")
        (preview . "${author editor} (${year issued date}) ${title}, ${journal journaltitle publisher container-title collection-title}.\n"))))

To remove the hooks just deactivate the minor mode.

Acknowledgements

  • Thanks to Bruce D’Arcus for discussion of how to best flesh out the completion function.

About

Completion at point for citations using citar

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published