瀏覽代碼

ox-latex: Surround option string with braces if it includes brackets

lisp/ox-latex.el (org-latex--make-option-string): If `value' of
a `pair' from `options' contains a bracket the whole `value' is
surrounded by braces.

In case of LaTeX export using listings the dialect of
a language (e.g. [LaTeX]TeX) is surrounded by brackets. For inline
source blocks all options end as optional argument to \lstinline
between brackets which breaks the LaTeX parser.

TINYCHANGE
Markus Huber 3 年之前
父節點
當前提交
54863e802f
共有 1 個文件被更改,包括 4 次插入1 次删除
  1. 4 1
      lisp/ox-latex.el

+ 4 - 1
lisp/ox-latex.el

@@ -1494,7 +1494,10 @@ nil."
 	       (pcase-let ((`(,keyword ,value) pair))
 		 (concat keyword
 			 (and (> (length value) 0)
-			      (concat "=" value)))))
+			      (concat "="
+                                      (if (string-match-p (rx (any "[]")) value)
+                                          (format "{%s}" value)
+                                        value))))))
 	     options
 	     ","))