From aacaf2bdbf078d861dee4ddadcaac1ad694a9f36 Mon Sep 17 00:00:00 2001 From: Daneel Date: Wed, 25 Feb 2026 12:59:19 +0100 Subject: [PATCH] bibliography: citar + biblio + org-cite CSL setup - init.el: biblio module with +citar flag - packages.el: citeproc for org-cite CSL export - config.el: citar (browse/insert/notes), biblio (online search), org-cite with CSL processor, bibtex editing defaults - Keybindings under SPC b: browse, insert, notes, search online - Auto-creates ~/org/references.bib if missing --- config.el | 53 +++++++++++++++++++++++++++++++++++++++++++++++------ init.el | 2 +- packages.el | 3 +++ 3 files changed, 51 insertions(+), 7 deletions(-) diff --git a/config.el b/config.el index 29c4993..d007fc1 100644 --- a/config.el +++ b/config.el @@ -1807,18 +1807,59 @@ Skip for beamer exports — beamer uses adjustbox on plain tabular." ;;; ============================================================ -;;; BIBTEX / CITAR +;;; BIBLIOGRAPHY — citar + biblio + org-cite ;;; ============================================================ +;; Workflow: +;; 1. SPC b s → search CrossRef/DBLP/arXiv by author/title/DOI +;; 2. In results: select entry → i = insert into references.bib +;; 3. In org file: SPC b i → search your .bib → insert [cite:@key] +;; 4. Export to PDF: citations auto-formatted, bibliography generated +;; +;; Files: +;; ~/org/references.bib — master bibliography (auto-created if missing) +;; ~/org/notes/ — reading notes per reference +;; ~/org/papers/ — PDF library (optional) (after! citar (setq citar-bibliography '("~/org/references.bib") citar-notes-paths '("~/org/notes/") citar-library-paths '("~/org/papers/")) - (map! :leader - "b b" #'citar-open - "b i" #'citar-insert-citation - "b n" #'citar-open-notes - "b r" #'citar-refresh)) + + ;; Ensure references.bib exists + (let ((bib (expand-file-name "~/org/references.bib"))) + (unless (file-exists-p bib) + (with-temp-file bib (insert "% Bibliography — managed via citar + biblio\n\n"))))) + +;; org-cite: use CSL processor (no BibLaTeX/BibTeX toolchain needed) +(after! oc + (require 'citeproc) + (setq org-cite-global-bibliography '("~/org/references.bib") + org-cite-export-processors '((latex csl) + (html csl) + (t csl)))) + +;; biblio.el: search and import references from online databases +(after! biblio + (setq biblio-crossref-user-email-address "martin@sukany.cz")) + +;; BibTeX editing defaults +(setq bibtex-dialect 'biblatex + bibtex-autokey-year-length 4 + bibtex-autokey-name-year-separator "" + bibtex-autokey-year-title-separator "-" + bibtex-autokey-titleword-length 5 + bibtex-autokey-titlewords 3) + +(map! :leader + (:prefix ("b" . "bibliography") + :desc "Browse references" "b" #'citar-open + :desc "Insert citation" "i" #'citar-insert-citation + :desc "Open notes for reference" "n" #'citar-open-notes + :desc "Refresh bibliography" "r" #'citar-refresh + :desc "Search online (CrossRef)" "s" #'biblio-crossref-lookup + :desc "Search arXiv" "a" #'biblio-arxiv-lookup + :desc "Search DBLP" "d" #'biblio-dblp-lookup + :desc "Search DOI" "D" #'biblio-doi-insert-bibtex)) ;;; ============================================================ diff --git a/init.el b/init.el index 74b5eb4..b656224 100644 --- a/init.el +++ b/init.el @@ -46,7 +46,7 @@ :tools ansible - biblio + (biblio +citar) debugger docker (eval +overlay) diff --git a/packages.el b/packages.el index 781cbd7..3c91ca5 100644 --- a/packages.el +++ b/packages.el @@ -109,6 +109,9 @@ (package! combobulate :recipe (:host github :repo "mickeynp/combobulate")) (package! breadcrumb :recipe (:host github :repo "joaotavora/breadcrumb")) +;; Bibliography: CSL citation processor for org-cite export +(package! citeproc) + ;; Tier 3 — Supplementary (package! org-anki) (package! org-ql)