branch: externals/org
commit bc7bba5c6d1dc3bbcb4edee9e8094087c6136eb1
Author: Ihor Radchenko <[email protected]>
Commit: Ihor Radchenko <[email protected]>

    org-latex-headline: Allow \ in alt-title
    
    * lisp/ox-latex.el (org-latex-headline): Properly handle \ in
    alt-title.  We use `replace-match' where \ is interpreted specially,
    so need to escape.
---
 lisp/ox-latex.el | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el
index 1efc9bb935..cf4f10f2a2 100644
--- a/lisp/ox-latex.el
+++ b/lisp/ox-latex.el
@@ -2506,7 +2506,10 @@ holding contextual information."
                        ;; optional arguments.
                         ((un-bracketed-alt (replace-regexp-in-string
                                             "\\[" "(" 
(replace-regexp-in-string "\\]" ")" opt-title)))
-                         (replacement-re (concat "\\1[" un-bracketed-alt "]")))
+                         (replacement-re (concat
+                                          "\\1["
+                                          (replace-regexp-in-string (rx "\\") 
"\\\\" un-bracketed-alt nil t)
+                                          "]")))
                       (setq new-format (replace-match replacement-re nil nil 
section-fmt 1))))
                   (format new-format
                           full-text

Reply via email to