Browse Source

ox-latex: Possibly make a matrix out of tabular environment

* lisp/ox-latex.el (org-latex--math-table): Properly create matrix if
  "tabular" environment is used.  Make sure cells are centered instead
  of applying usual alignment rules.
Nicolas Goaziou 10 years ago
parent
commit
c27d86d6f1
1 changed files with 4 additions and 3 deletions
  1. 4 3
      lisp/ox-latex.el

+ 4 - 3
lisp/ox-latex.el

@@ -2832,9 +2832,10 @@ This function assumes TABLE has `org' as its `:type' property and
      ;; Prefix.
      (plist-get attr :math-prefix)
      ;; Environment.  Also treat special cases.
-     (cond ((equal env "array")
-	    (let ((align (org-latex--align-string table info)))
-	      (format "\\begin{array}{%s}\n%s\\end{array}" align contents)))
+     (cond ((member env '("array" "tabular"))
+	    (let ((align (make-string
+			  (cdr (org-export-table-dimensions table info)) ?c)))
+	      (format "\\begin{%s}{%s}\n%s\\end{%s}" env align contents env)))
 	   ((assoc env org-latex-table-matrix-macros)
 	    (format "\\%s%s{\n%s}"
 		    env