branch: externals/org
commit c00ade84fd4343fbae434c6040948b9ac519a686
Author: Thomas Ingram <[email protected]>
Commit: Ihor Radchenko <[email protected]>
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 #+CITE_EXPORT options.
---
etc/ORG-NEWS | 6 ++++++
lisp/oc-bibtex.el | 30 +++++++++++++++++++++++++++++-
2 files changed, 35 insertions(+), 1 deletion(-)
diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index f4ff44d299..feac28cea0 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -425,6 +425,12 @@ This option makes ~org-cite~'s ~basic~ insert processor use
It can also be set to dynamically compute ~crm-separator~ so that the
separator does not appear in completion candidates.
+*** New option ~org-cite-bibtex-bibliography-style~
+
+This option adds a fallback bibliography style for BibTeX when none is
+provided in the =#+CITE_EXPORT= options. The default style is
+"plain".
+
*** New Option ~org-md-link-org-files-as-md~
This option makes it possible to disable mapping of linked org files
diff --git a/lisp/oc-bibtex.el b/lisp/oc-bibtex.el
index 1d44b10d0a..804d96dc77 100644
--- a/lisp/oc-bibtex.el
+++ b/lisp/oc-bibtex.el
@@ -45,13 +45,41 @@
(declare-function org-export-data "ox" (data info))
+(defcustom org-cite-bibtex-bibliography-style "plain"
+ "Default BibTeX bibliography style.
+
+BibTeX provides the following default styles:
+
+ \"plain\" Sorted numbered entries
+ \"abbrv\" Sorted numbered entries with abbreviated author name
+ \"unsrt\" Unsorted numbered entries
+ \"alpha\" Alphabetized entries with unique short id
+ \"acm\" ACM Transactions
+ \"apalike\" APA-like
+ \"ieeetr\" IEEE Transactions
+ \"siam\" SIAM"
+ :group 'org-cite
+ :package-version '(Org . "9.8")
+ :type
+ '(choice
+ (const :tag "Plain" "plain")
+ (const :tag "Abbreviated" "abbrv")
+ (const :tag "Unsorted" "unsrt")
+ (const :tag "Alphabetic" "alpha")
+ (const :tag "ACM" "acm")
+ (const :tag "APA-like" "apalike")
+ (const :tag "IEEE" "ieeetr")
+ (const :tag "SIAM" "siam")
+ (string :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