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.

Thanks,
--
Thomas Ingram
https://taingram.org/

>From 3ef2cde5d3fb884763f5abdaa473253d4087b5c4 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 | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/lisp/oc-bibtex.el b/lisp/oc-bibtex.el
index 1d44b10d0..ba6079a8b 100644
--- a/lisp/oc-bibtex.el
+++ b/lisp/oc-bibtex.el
@@ -45,13 +45,26 @@
 
 (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")))
+
 
 ;;; 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

Reply via email to