New patch attached, with a news entry and package version.

I have no specific objections to adding a defcustom, but I am wondering
why not using #+INCLUDE directive and adding all the export settings
that way?

I'm not sure what you mean by this? I tried a few workflows with
 #+INCLUDE before settling on what I have now and none was quite
satisfactory (for me).

best,

Hugo
From aface4223b01a80beb5ea58e19c2190666bc89af Mon Sep 17 00:00:00 2001
From: Hugo Heagren <h...@heagren.com>
Date: Fri, 10 Jan 2025 13:01:28 +0000
Subject: [PATCH] ox-latex.el: new custom var `org-latex-default-class-options'

* lisp/ox-latex.el (org-latex-default-class-options): New
option.
(latex): Default to `org-latex-default-class-options'.
* etc/ORG-NEWS (New option ~org-latex-default-class-options~):
Document above.
---
 etc/ORG-NEWS     | 6 ++++++
 lisp/ox-latex.el | 9 ++++++++-
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index 92bfe3501..73ccc9038 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -158,6 +158,12 @@ English.  The default value is ~t~ as the CSL standard assumes that
 English titles are specified in sentence-case but the bibtex
 bibliography format requires them to be written in title-case.
 
+*** New option ~org-latex-default-class-options~
+
+String of options passed to LaTeX document class during export.  This
+option is to ~#+LATEX_CLASS_OPTIONS~ as ~org-latex-default-class~ is
+to ~#+LATEX_CLASS~.
+
 ** New functions and changes in function arguments
 
 # This also includes changes in function behavior from Elisp perspective.
diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el
index 782be244b..2137f1310 100644
--- a/lisp/ox-latex.el
+++ b/lisp/ox-latex.el
@@ -121,7 +121,7 @@ (org-export-define-backend 'latex
 		   (:filter-verse-block . org-latex-clean-invalid-line-breaks))
   :options-alist
   '((:latex-class "LATEX_CLASS" nil org-latex-default-class t)
-    (:latex-class-options "LATEX_CLASS_OPTIONS" nil nil t)
+    (:latex-class-options "LATEX_CLASS_OPTIONS" nil org-latex-default-class-options t)
     (:latex-header "LATEX_HEADER" nil nil newline)
     (:latex-header-extra "LATEX_HEADER_EXTRA" nil nil newline)
     (:description "DESCRIPTION" nil nil parse)
@@ -423,6 +423,13 @@ (defcustom org-latex-default-class "article"
   :group 'org-export-latex
   :type '(string :tag "LaTeX class"))
 
+(defcustom org-latex-default-class-options ""
+  "The default options passed to the document class."
+  :group 'org-export-latex
+  :type 'string
+  :safe #'stringp
+  :package-version '(Org . "9.8"))
+
 (defcustom org-latex-classes
   '(("article"
      "\\documentclass[11pt]{article}"
-- 
2.39.5

Reply via email to