Thomas Ingram <[email protected]> writes: > Ihor Radchenko <[email protected]> writes: >> I agree that it would be a reasonable change. >> In fact, we already have `org-cite-natbib-bibliography-style' to address >> similar problem for natbib. > > Thank you Ihor. I've created a patch for oc-bibtex.el similar to the > natbib example. Please let me know if anything needs to be tweaked.
Quick correction, I've added the :safe declaration recommended by Pedro. I was not aware of that customization feature. Thanks, -- Thomas Ingram https://taingram.org/
>From 8175fff4b11d6e1fa84990c6c4e69a58fc494bb0 Mon Sep 17 00:00:00 2001 From: Thomas Ingram <[email protected]> Date: Sat, 13 Dec 2025 17:44:00 -0500 Subject: [PATCH] lisp/oc-bibtex.el: Add default bibliography style variable * oc-bibtex.el (org-cite-bibtex-export-bibliography): Add `org-cite-bibtex-bibliography-style' variable to provide a fallback bibliography style if none is provided. To render a bibliography bibtex requires a "\bibliographystyle{}" to be set, omitting a style will create latex documents that fail to compile. This variable provides a fallback bibliography style for when none is provided in the #+bibliography options. --- lisp/oc-bibtex.el | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/lisp/oc-bibtex.el b/lisp/oc-bibtex.el index 1d44b10d0..f1e992a0d 100644 --- a/lisp/oc-bibtex.el +++ b/lisp/oc-bibtex.el @@ -45,13 +45,27 @@ (declare-function org-export-data "ox" (data info)) +(defcustom org-cite-bibtex-bibliography-style 'plain + "Default BibTeX bibliography style." + :group 'org-cite + :package-version '(Org . "9.8") + :type + '(choice + (const plain) + (const unsrt) + (const alpha) + (const abbrv) + (symbol :tag "Other")) + :safe #'stringp) + ;;; Export capability (defun org-cite-bibtex-export-bibliography (_keys files style &rest _) "Print references from bibliography FILES. FILES is a list of absolute file names. STYLE is the bibliography style, as a string or nil." - (concat (and style (format "\\bibliographystyle{%s}\n" style)) + (concat (format "\\bibliographystyle{%s}\n" + (or style org-cite-bibtex-bibliography-style)) (format "\\bibliography{%s}" (mapconcat #'file-name-sans-extension files -- 2.47.3
-- Thomas Ingram https://taingram.org/
