瀏覽代碼

LaTeX export: Allow centered images in plain lists

Carsten Dominik 15 年之前
父節點
當前提交
4bfb32bb75
共有 2 個文件被更改,包括 20 次插入12 次删除
  1. 5 0
      lisp/ChangeLog
  2. 15 12
      lisp/org-latex.el

+ 5 - 0
lisp/ChangeLog

@@ -1,3 +1,8 @@
+2009-11-24  Carsten Dominik  <carsten.dominik@gmail.com>
+
+	* org-latex.el (org-export-latex-format-image): Preserve the
+	original-indentation property.
+
 2009-11-23  Carsten Dominik  <carsten.dominik@gmail.com>
 
 	* org-clock.el (org-clock-insert-selection-line): Catch error when

+ 15 - 12
lisp/org-latex.el

@@ -1601,8 +1601,9 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER."
 
 (defun org-export-latex-format-image (path caption label attr)
   "Format the image element, depending on user settings."
-  (let (floatp wrapp placement figenv)
+  (let (ind floatp wrapp placement figenv)
     (setq floatp (or caption label))
+    (setq ind (org-get-text-property-any 0 'original-indentation path))
     (when (and attr (stringp attr))
       (if (string-match "[ \t]*\\<wrap\\>" attr)
 	  (setq wrapp t floatp nil attr (replace-match "" t t attr)))
@@ -1647,17 +1648,19 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER."
     (if (and (not label) (not caption)
 	     (string-match "^\\\\caption{.*\n" figenv))
 	(setq figenv (replace-match "" t t figenv)))
-    (org-fill-template
-     figenv
-     (list (cons "path"
-		 (if (file-name-absolute-p path)
-		     (expand-file-name path)
-		   path))
-	   (cons "attr" attr)
-	   (cons "labelcmd" (if label (format "\\label{%s}"
-					      label)""))
-	   (cons "caption" (or caption ""))
-	   (cons "placement" (or placement ""))))))
+    (org-add-props
+	(org-fill-template
+	 figenv
+	 (list (cons "path"
+		     (if (file-name-absolute-p path)
+			 (expand-file-name path)
+		       path))
+	       (cons "attr" attr)
+	       (cons "labelcmd" (if label (format "\\label{%s}"
+						  label)""))
+	       (cons "caption" (or caption ""))
+	       (cons "placement" (or placement ""))))
+	nil 'original-indentation ind)))
 
 (defun org-export-latex-protect-amp (s)
   (while (string-match "\\([^\\\\]\\)\\(&\\)" s)