Merge branch 'maint'

This commit is contained in:
Nicolas Goaziou 2017-03-27 13:53:05 +02:00
commit 211d7aa9b2
1 changed files with 12 additions and 12 deletions

View File

@ -3151,10 +3151,12 @@ contextual information."
;; table, insert their definition just after it. ;; table, insert their definition just after it.
(org-latex--delayed-footnotes-definitions table info))))))) (org-latex--delayed-footnotes-definitions table info)))))))
(defun org-latex--align-string (table info) (defun org-latex--align-string (table info &optional math?)
"Return an appropriate LaTeX alignment string. "Return an appropriate LaTeX alignment string.
TABLE is the considered table. INFO is a plist used as TABLE is the considered table. INFO is a plist used as
a communication channel." a communication channel. When optional argument MATH? is
non-nil, TABLE is meant to be a matrix, where all cells are
centered."
(or (org-export-read-attribute :attr_latex table :align) (or (org-export-read-attribute :attr_latex table :align)
(let (align) (let (align)
;; Extract column groups and alignment from first (non-rule) ;; Extract column groups and alignment from first (non-rule)
@ -3170,11 +3172,12 @@ a communication channel."
;; Check left border for the first cell only. ;; Check left border for the first cell only.
(when (and (memq 'left borders) (not align)) (when (and (memq 'left borders) (not align))
(push "|" align)) (push "|" align))
(push (cl-case (org-export-table-cell-alignment cell info) (push (if math? "c" ;center cells in matrices
(left "l") (cl-case (org-export-table-cell-alignment cell info)
(right "r") (left "l")
(center "c")) (right "r")
align) (center "c"))
align))
(when (memq 'right borders) (push "|" align)))) (when (memq 'right borders) (push "|" align))))
info) info)
(apply 'concat (nreverse align))))) (apply 'concat (nreverse align)))))
@ -3358,11 +3361,8 @@ This function assumes TABLE has `org' as its `:type' property and
(plist-get attr :math-prefix) (plist-get attr :math-prefix)
;; Environment. Also treat special cases. ;; Environment. Also treat special cases.
(cond ((member env '("array" "tabular")) (cond ((member env '("array" "tabular"))
;; Make sure cells are always centered while preserving (format "\\begin{%s}{%s}\n%s\\end{%s}"
;; vertical separators. env (org-latex--align-string table info t) contents env))
(let ((align (replace-regexp-in-string
"[lr]" "c" (org-latex--align-string table info))))
(format "\\begin{%s}{%s}\n%s\\end{%s}" env align contents env)))
((assoc env org-latex-table-matrix-macros) ((assoc env org-latex-table-matrix-macros)
(format "\\%s%s{\n%s}" (format "\\%s%s{\n%s}"
env env