浏览代码

Export: org-export-latex-image-default-option can be buffer-local
Jason Riedy writes:

> I'm trying to change org-export-latex-image-default-option
> to "width=.7\\linewidth" in a file local variable. It's set
> correctly as a buffer local variable, and it's having no
> effect on the export. My guess is that the buffer-local
> property is stopping it as soon as org-export-as-latex runs
> set-buffer.
>
> I can smuggle the value in by adding an entry to org-export-plist-vars
> referring to org-export-latex-image-default-option and pulling the value
> from the plist, but that feels incorrect.

It is actually the correct way to do this, and I have
implemented this change.

Carsten Dominik 16 年之前
父节点
当前提交
d79696d914
共有 4 个文件被更改,包括 14 次插入3 次删除
  1. 1 0
      doc/org.texi
  2. 7 0
      lisp/ChangeLog
  3. 3 1
      lisp/org-exp.el
  4. 3 2
      lisp/org-latex.el

+ 1 - 0
doc/org.texi

@@ -9378,6 +9378,7 @@ respective variable for details.
 @item @code{:email}                 @tab @code{user-mail-address} : @code{addr;addr;..}
 @item @code{:select-tags}           @tab @code{org-export-select-tags}
 @item @code{:exclude-tags}          @tab @code{org-export-exclude-tags}
+@item @code{:latex-image-options}   @tab @code{org-export-latex-image-default-option}
 @end multitable
 
 Most of the @code{org-export-with-*} variables have the same effect in

+ 7 - 0
lisp/ChangeLog

@@ -1,3 +1,10 @@
+2009-05-05  Carsten Dominik  <carsten.dominik@gmail.com>
+
+	* org-latex.el (org-export-latex-links): Use the property list to
+	retrieve the default image attributes.
+
+	* org-exp.el (org-export-plist-vars): Add a new option.
+
 2009-05-04  Carsten Dominik  <carsten.dominik@gmail.com>
 
 	* org-exp.el (org-export, org-export-visible): Support ASCII

+ 3 - 1
lisp/org-exp.el

@@ -576,7 +576,9 @@ much faster."
     (:author		      nil	  user-full-name)
     (:email		      nil	  user-mail-address)
     (:select-tags	      nil	  org-export-select-tags)
-    (:exclude-tags	      nil	  org-export-exclude-tags))
+    (:exclude-tags	      nil	  org-export-exclude-tags)
+
+    (:latex-image-options     nil	  org-export-latex-image-default-option))
   "List of properties that represent export/publishing variables.
 Each element is a list of 3 items:
 1. The property that is used internally, and also for org-publish-project-alist

+ 3 - 2
lisp/org-latex.el

@@ -1345,7 +1345,8 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER."
 			  "file")))
 	    (coderefp (equal type "coderef"))
 	    (caption (org-find-text-property-in-string 'org-caption raw-path))
-	    (attr (org-find-text-property-in-string 'org-attributes raw-path))
+	    (attr (or (org-find-text-property-in-string 'org-attributes raw-path)
+		      (plist-get org-export-latex-options-plist :latex-image-options)))
 	    (label (org-find-text-property-in-string 'org-label raw-path))
 	    (floatp (or label caption))
 	    imgp radiop
@@ -1380,7 +1381,7 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER."
 	       (concat
 		(if floatp "\\begin{figure}[htb]\n")
 		(format "\\centerline{\\includegraphics[%s]{%s}}\n"
-			(or attr org-export-latex-image-default-option)
+			attr
 			(if (file-name-absolute-p raw-path)
 			    (expand-file-name raw-path)
 			  raw-path))