Browse Source

ox-latex: Fix user-defined align string in matrices

* lisp/ox-latex.el (org-latex--align-string): Change signature.
  Center all cells in matrices, yet preserve user-defined align
  string.
(org-latex--math-table): Apply signature change.

Reported-by: Phil Regier <phil.regier@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/112873>
Nicolas Goaziou 8 years ago
parent
commit
7839fb891b
1 changed files with 6 additions and 3 deletions
  1. 6 3
      lisp/ox-latex.el

+ 6 - 3
lisp/ox-latex.el

@@ -3312,9 +3312,12 @@ This function assumes TABLE has `org' as its `:type' property and
      ;; Environment.  Also treat special cases.
      (cond ((member env '("array" "tabular"))
 	    ;; Make sure cells are always centered while preserving
-	    ;; vertical separators.
-	    (let ((align (replace-regexp-in-string
-			  "[lr]" "c" (org-latex--align-string table info))))
+	    ;; vertical separators, unless user provided a special
+	    ;; align string.
+	    (let ((align
+		   (or (org-export-read-attribute :attr_latex table :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)
 	    (format "\\%s%s{\n%s}"