From 984ef56e651fe218067de30293a001a8a1188932 Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Wed, 21 Nov 2012 16:44:53 +0100 Subject: [PATCH] org-e-latex: Change syntax for images attributes * contrib/lisp/org-e-latex.el (org-e-latex--inline-image): Rename from `org-e-latex-link--inline-image'. Use new attributes. (org-e-latex-link): Use new function. --- contrib/lisp/org-e-latex.el | 84 +++++++++++++++++++++++---------------------- 1 file changed, 43 insertions(+), 41 deletions(-) diff --git a/contrib/lisp/org-e-latex.el b/contrib/lisp/org-e-latex.el index 7c09a5fb8..77fdd7eb9 100644 --- a/contrib/lisp/org-e-latex.el +++ b/contrib/lisp/org-e-latex.el @@ -72,6 +72,14 @@ ;; (i.e. "inparaenum"). The second one allows to specify optional ;; arguments for that environment (square brackets are not mandatory). ;; +;; Images accept `:float', `:placement' and `:options' as attributes. +;; `:float' accepts a symbol among `wrap', `multicolumn', and +;; `figure', which defines the float environment for the table (if +;; unspecified, an image with a caption will be set in a "figure" +;; environment). `:placement' is a string that will be used as +;; argument for the environment chosen. `:options' is a string that +;; will be used as the optional argument for "includegraphics" macro. +;; ;; This back-end also offers enhanced support for footnotes. Thus, it ;; handles nested footnotes, footnotes in tables and footnotes in item ;; descriptions. @@ -1709,7 +1717,7 @@ CONTENTS is nil. INFO is a plist holding contextual information." ;;;; Link -(defun org-e-latex-link--inline-image (link info) +(defun org-e-latex--inline-image (link info) "Return LaTeX code for an inline image. LINK is the link pointing to the inline image. INFO is a plist used as a communication channel." @@ -1719,51 +1727,45 @@ used as a communication channel." (expand-file-name raw-path)))) (caption (org-e-latex--caption/label-string parent info)) ;; Retrieve latex attributes from the element around. - (attr (let ((raw-attr - (mapconcat #'identity - (org-element-property :attr_latex parent) - " "))) - (unless (string= raw-attr "") raw-attr))) - (disposition - (cond - ((and attr (string-match "\\" attr)) 'wrap) - ((and attr (string-match "\\" attr)) 'multicolumn) - ((or (and attr (string-match "\\" attr)) - (not (string= caption ""))) - 'float))) + (attr (org-export-read-attribute :attr_latex parent)) + (float (let ((float (plist-get attr :float))) + (cond ((string= float "wrap") 'wrap) + ((string= float "multicolumn") 'multicolumn) + ((or (string= float "figure") + (org-element-property :caption parent)) + 'figure)))) (placement - (cond - ((and attr (string-match "\\