emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Orgmode] allow table* specification with #+ATTR_LaTeX:


From: Eric Schulte
Subject: [Orgmode] allow table* specification with #+ATTR_LaTeX:
Date: Wed, 15 Dec 2010 14:33:17 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

Hi,

The attached patch allows the use of table* latex tables from within Org
mode documents using the attr_latex lines, for example

#+CAPTION: A wide table
#+LABEL: tbl:wide
#+ATTR_LaTeX: table* align=l|lp{3cm}r|l
| ... | ... |
| ... | ... |

Should this be added, or should we put together a more general solution
for different types of table environments?  Currently only longtable is
supported.  Also, is there already a way to do this that I have missed?

Thanks -- Eric

diff --git a/lisp/org-latex.el b/lisp/org-latex.el
index a261171..b7f48d3 100644
--- a/lisp/org-latex.el
+++ b/lisp/org-latex.el
@@ -1741,7 +1741,7 @@ The conversion is made depending of STRING-BEFORE and 
STRING-AFTER."
              (org-table-last-column-widths (copy-sequence
                                             org-table-last-column-widths))
              fnum fields line lines olines gr colgropen line-fmt align
-             caption shortn label attr floatp placement longtblp)
+             caption shortn label attr floatp placement longtblp tblenv)
         (if org-export-latex-tables-verbatim
             (let* ((tbl (concat "\\begin{verbatim}\n" raw-table
                                 "\\end{verbatim}\n")))
@@ -1758,6 +1758,9 @@ The conversion is made depending of STRING-BEFORE and 
STRING-AFTER."
                          'org-label raw-table)
                   longtblp (and attr (stringp attr)
                                 (string-match "\\<longtable\\>" attr))
+                 tblenv (if (and attr (stringp attr)
+                                 (string-match (regexp-quote "table*") attr))
+                            "table*" "table")
                   align (and attr (stringp attr)
                              (string-match "\\<align=\\([^ \t\n\r]+\\)" attr)
                              (match-string 1 attr))
@@ -1821,7 +1824,8 @@ The conversion is made depending of STRING-BEFORE and 
STRING-AFTER."
                        (concat
                         (if longtblp
                             (concat "\\begin{longtable}{" align "}\n")
-                          (if floatp (format "\\begin{table}%s\n" placement)))
+                          (if floatp
+                             (format "\\begin{%s}%s\n" tblenv placement)))
                         (if floatp
                             (format
                              "\\caption%s{%s} %s"
@@ -1852,7 +1856,7 @@ The conversion is made depending of STRING-BEFORE and 
STRING-AFTER."
                                               "\n\\end{center}\n" "\n"))
                         (if longtblp
                             "\\end{longtable}"
-                          (if floatp "\\end{table}"))))
+                          (if floatp (format "\\end{%s}" tblenv)))))
                       "\n\n"))))))))
 
 (defun org-export-latex-convert-table.el-table ()

reply via email to

[Prev in Thread] Current Thread [Next in Thread]