Hi

attached is a patch that refines the bug fix I sent yesterday.

Best, /PA
--
Sagen's Paradeiser! (ORF: Als Radiohören gefährlich war) => write BE!

2nd year of the New Koprocracy
From 395342a015bb9bd12990c311f2c38d15f7dde854 Mon Sep 17 00:00:00 2001
From: "Pedro A. Aranda" <[email protected]>
Date: Wed, 22 Apr 2026 17:27:51 +0200
Subject: [PATCH] ox-latex.el: (org-latex--mk-options): Improvements

lisp/ox-latex.el: (org-latex--mk-options): Better check for an empty
string and add support for lists of strings.

Lists of strings will be needed in the future, for example, for font
management.
---
 lisp/ox-latex.el | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el
index a54ac5a3b..192a89fb3 100644
--- a/lisp/ox-latex.el
+++ b/lisp/ox-latex.el
@@ -2023,14 +2023,18 @@ The default behaviour is to typeset with the Roman font family."
 
 If STR is nil or an empty string, return STR.
 If STR is a traditional LATEX_CLASS_OPTIONS enclosed in [ ], return it as is.
-If the square brackets are missing, return STR enclosed in square brackets."
-  (if (or (not str) (length= str 0)) str
+If the square brackets are missing, return STR enclosed in square brackets.
+If STR is a list of strings, create a comma-separated concatenation of the elements
+enclosed in square brackets."
+  (if (or (not str) (and (stringp str)(length= str 0))) str
     (save-match-data  ; just in case it is used in a search/replace context
-      (let ((str (concat "[" str "]"))) ; make sure it is enclosed in []
-        (replace-regexp-in-string  ; remove excess [ at the beginning
-         "\\`\\[+" "["
-         (replace-regexp-in-string ; remove excess ] at the end
-          "]+\\'" "]" str))))))
+      (replace-regexp-in-string  ; remove excess [ at the beginning
+       "\\`\\[+" "["
+       (replace-regexp-in-string ; remove excess ] at the end
+        "]+\\'" "]"
+        (if (listp str)
+            (concat "[" (mapconcat #'identity str ",") "]")
+          (concat "[" str "]")))))))
 
 ;;;###autoload
 (defun org-latex-make-preamble (info &optional template snippet?)
-- 
2.43.0

Reply via email to