Hi Nicolas, I know nothing about lisp, but I think I understand enough of the structure to propose the following changes: In my testfile, this preserves the current behavior if no #+CAPTION is present. However, if the #+CAPTION is not empty, the table will be exported as float with the proper caption and label. The code needs probably some cleanup, but I don't understand enough lisp to know what's save to drop. Hope this can be merged Cheers Uli --- org-mode/lisp/ox-latex.el 2018-11-28 11:58:15.234232222 -0500 +++ org-mode-uliw/ox-latex.el.uliw 2018-11-28 11:57:09.057281230 -0500 @@ -3305,6 +3310,21 @@ This function assumes TABLE has `table.el' as its `:type' property." + (let* ((caption (org-latex--caption/label-string table info)) + (attr (org-export-read-attribute :attr_latex table)) + ;; Determine alignment string. + (alignment (org-latex--align-string table info)) + ;; Determine environment for the table: longtable, tabular... + (table-env (or (plist-get attr :environment) + (plist-get info :latex-default-table-environment))) + ;; If table is a float, determine environment: table, table* + ;; or sidewaystable. + (placement + (or (plist-get attr :placement) + (format "[%s]" (plist-get info :latex-default-figure-position)))) + (centerp (if (plist-member attr :center) (plist-get attr :center) + (plist-get info :latex-tables-centered))) + (caption-above-p (org-latex--caption-above-p table info))) (require 'table) ;; Ensure "*org-export-table*" buffer is empty. (with-current-buffer (get-buffer-create "*org-export-table*") @@ -3332,7 +3352,16 @@ (let ((centerp (if (plist-member attr :center) (plist-get attr :center) (plist-get info :latex-tables-centered)))) (if (not centerp) output - (format "\\begin{center}\n%s\n\\end{center}" output)))))) + (if (string= "" caption) + (format (concat "\\begin{center}\n" + "%s\n" + "\\end{center}\n") output) + (format (concat "\\begin{table}\n" + caption + "\\centering\n" + "%s\n" + "\\end{table}\n") output)) + )))))) (defun org-latex--math-table (table info) "Return appropriate LaTeX code for a matrix. On Mon, 26 Nov 2018 at 16:02 Nicolas Goaziou wrote: > Hello, > > "Ulrich G. Wortmann" writes: > > > I had a quick look at table.el > > > > It exports only a tabular command, not a table. Is there a way to make > org > > wrap the > > > > \begin{tabular} > > \end{tabular} > > > > into a regular > > > > \begin{table} > > \end{table} > > > > This would be perfectly correct latex, and keep the export mechanism, > > neatly separated > > You may want to look at `org-latex--table.el-table' and see what can be > done. > > Regards, > > -- > Nicolas Goaziou > -- Ulrich Wortmann 416 978 7084 Associate Chair Undergraduate Affairs Department of Earth Sciences University of Toronto 22 Russel St., Toronto, ON, Canada, M5S 3B1