Browse Source

ox-latex: Fix error with inline image with no option provided

* lisp/ox-latex.el (org-latex--inline-image): Fix error when no
  default width, height and option are provided and no attribute is
  set for the inline image.
Nicolas Goaziou 12 years ago
parent
commit
7b36019069
1 changed files with 6 additions and 3 deletions
  1. 6 3
      lisp/ox-latex.el

+ 6 - 3
lisp/ox-latex.el

@@ -1853,9 +1853,12 @@ used as a communication channel."
 	(setq options (concat options ",width=" width)))
 	(setq options (concat options ",width=" width)))
       (when (org-string-nw-p height)
       (when (org-string-nw-p height)
 	(setq options (concat options ",height=" height)))
 	(setq options (concat options ",height=" height)))
-      (when (= (aref options 0) ?,)
-	(setq options (substring options 1)))
-      (setq image-code (format "\\includegraphics[%s]{%s}" options path)))
+      (setq image-code
+	    (format "\\includegraphics%s{%s}"
+		    (cond ((not (org-string-nw-p options)) "")
+			  ((= (aref options 0) ?,) (substring options 1))
+			  (t options))
+		    path)))
     ;; Return proper string, depending on FLOAT.
     ;; Return proper string, depending on FLOAT.
     (case float
     (case float
       (wrap (format "\\begin{wrapfigure}%s
       (wrap (format "\\begin{wrapfigure}%s