Procházet zdrojové kódy

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.
TEC před 2 roky
rodič
revize
4504473779
1 změnil soubory, kde provedl 6 přidání a 1 odebrání
  1. 6 1
      lisp/ox-latex.el

+ 6 - 1
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"