branch: externals/org
commit 4504473779351ba41b8d8631b25bb1d4f2eaa593
Author: TEC <t...@tecosaur.com>
Commit: TEC <t...@tecosaur.com>

    ox-latex: Support svg images with unicode paths
    
    * lisp/ox-latex.el (org-latex--inline-image): Testing with TeXLive 2022
    finds that while \includegraphics is fine with unicode characters in the
    file path, \includesvg needs \detokenize{...} to prevent errors.
---
 lisp/ox-latex.el | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el
index 0d1d05f748..121a3f84c6 100644
--- a/lisp/ox-latex.el
+++ b/lisp/ox-latex.el
@@ -2765,7 +2765,12 @@ used as a communication channel."
                          ((string-prefix-p "," options)
                           (format "[%s]" (substring options 1)))
                          (t (format "[%s]" options)))
-                   path))
+                    ;; While \includegraphics is fine with unicode in the path,
+                    ;; \includesvg is prone to producing errors.
+                    (if (and (string-match-p "[^[:ascii:]]" path)
+                             (equal filetype "svg"))
+                        (concat "\\detokenize{" path "}")
+                      path)))
       (when (equal filetype "svg")
        (setq image-code (replace-regexp-in-string "^\\\\includegraphics"
                                                   "\\includesvg"

Reply via email to