org-e-latex: Take into account default mode when building a cluster

* contrib/lisp/org-e-latex.el (org-e-latex--math-table): Take into
  account default mode when building a cluster.
This commit is contained in:
Nicolas Goaziou 2012-11-25 16:41:43 +01:00
parent 755af23577
commit 6c8bd67cae
1 changed files with 10 additions and 8 deletions

View File

@ -2449,15 +2449,20 @@ This function assumes TABLE has `org' as its `:type' property and
;; of the same type). ;; of the same type).
(mode (org-export-read-attribute :attr_latex table :mode)) (mode (org-export-read-attribute :attr_latex table :mode))
(prev (org-export-get-previous-element table info)) (prev (org-export-get-previous-element table info))
(next (org-export-get-next-element table info))) (next (org-export-get-next-element table info))
(same-mode-p
(lambda (table)
;; Non-nil when TABLE has the same mode as current table.
(string= (or (org-export-read-attribute :attr_latex table :mode)
org-e-latex-default-table-mode)
mode))))
(concat (concat
;; Opening string. If TABLE is in the middle of a table cluster, ;; Opening string. If TABLE is in the middle of a table cluster,
;; do not insert any. ;; do not insert any.
(cond ((and prev (cond ((and prev
(eq (org-element-type prev) 'table) (eq (org-element-type prev) 'table)
(memq (org-element-property :post-blank prev) '(0 nil)) (memq (org-element-property :post-blank prev) '(0 nil))
(string= (org-export-read-attribute :attr_latex prev :mode) (funcall same-mode-p prev))
mode))
nil) nil)
(inlinep "\\(") (inlinep "\\(")
((org-string-nw-p caption) (concat "\\begin{equation}\n" caption)) ((org-string-nw-p caption) (concat "\\begin{equation}\n" caption))
@ -2481,8 +2486,7 @@ This function assumes TABLE has `org' as its `:type' property and
(cond ((and next (cond ((and next
(eq (org-element-type next) 'table) (eq (org-element-type next) 'table)
(memq (org-element-property :post-blank table) '(0 nil)) (memq (org-element-property :post-blank table) '(0 nil))
(string= (org-export-read-attribute :attr_latex next :mode) (funcall same-mode-p next))
mode))
nil) nil)
(inlinep "\\)") (inlinep "\\)")
;; Find cluster beginning to know which environment to use. ;; Find cluster beginning to know which environment to use.
@ -2491,9 +2495,7 @@ This function assumes TABLE has `org' as its `:type' property and
cluster-beg info)) cluster-beg info))
(memq (org-element-property :post-blank prev) (memq (org-element-property :post-blank prev)
'(0 nil)) '(0 nil))
(string= (funcall same-mode-p prev))
(org-export-read-attribute :attr_latex prev :mode)
mode))
(setq cluster-beg prev)) (setq cluster-beg prev))
(and (or (org-element-property :caption cluster-beg) (and (or (org-element-property :caption cluster-beg)
(org-element-property :name cluster-beg)) (org-element-property :name cluster-beg))