Browse Source

LaTeX export: Implement table* environment for wide tables

Patch by Chris Gray.
Carsten Dominik 15 years ago
parent
commit
2d3817d51a
4 changed files with 24 additions and 5 deletions
  1. 5 0
      doc/ChangeLog
  2. 4 2
      doc/org.texi
  3. 5 0
      lisp/ChangeLog
  4. 10 3
      lisp/org-latex.el

+ 5 - 0
doc/ChangeLog

@@ -1,3 +1,8 @@
+2010-05-15  Carsten Dominik  <carsten.dominik@gmail.com>
+
+	* org.texi (Tables in LaTeX export): Document the multicolumn
+	keyword.
+
 2010-05-10  Carsten Dominik  <carsten.dominik@gmail.com>
 
 	* org.texi (The date/time prompt): Document the new keys `C-v'

+ 4 - 2
doc/org.texi

@@ -9676,8 +9676,10 @@ All lines between these markers are exported literally
 
 For La@TeX{} export of a table, you can specify a label and a caption
 (@pxref{Images and tables}).  You can also use the @code{ATTR_LaTeX} line to
-request a longtable environment for the table, so that it may span several
-pages.  Finally, you can set the alignment string:
+request a @code{longtable} environment for the table, so that it may span
+several pages, or provide the @code{multicolumn} keyword that will make the
+table span the page in a multicolumn environment (@code{table*} environment).
+Finally, you can set the alignment string:
 
 @cindex #+CAPTION
 @cindex #+LABEL

+ 5 - 0
lisp/ChangeLog

@@ -1,3 +1,8 @@
+2010-05-15  Carsten Dominik  <carsten.dominik@gmail.com>
+
+	* org-latex.el (org-export-latex-format-image): Add support
+	for multicolumn figures in LaTeX.
+
 2010-05-14  David Maus  <dmaus@ictsoc.de>
 
 	* org.el (org-clone-subtree-with-time-shift): Remove ID

+ 10 - 3
lisp/org-latex.el

@@ -1889,15 +1889,17 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER."
 
 (defun org-export-latex-format-image (path caption label attr)
   "Format the image element, depending on user settings."
-  (let (ind floatp wrapp placement figenv)
+  (let (ind floatp wrapp multicolumnp placement figenv)
     (setq floatp (or caption label))
     (setq ind (org-get-text-property-any 0 'original-indentation path))
     (when (and attr (stringp attr))
       (if (string-match "[ \t]*\\<wrap\\>" attr)
 	  (setq wrapp t floatp nil attr (replace-match "" t t attr)))
       (if (string-match "[ \t]*\\<float\\>" attr)
-	  (setq wrapp nil floatp t attr (replace-match "" t t attr))))
-
+	  (setq wrapp nil floatp t attr (replace-match "" t t attr)))
+      (if (string-match "[ \t]*\\<multicolumn\\>" attr)
+	  (setq multicolumnp t attr (replace-match "" t t attr))))
+    
     (setq placement
 	  (cond
 	   (wrapp "{l}{0.5\\textwidth}")
@@ -1920,6 +1922,11 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER."
 \\includegraphics[%attr]{%path}
 \\caption{%labelcmd%caption}
 \\end{wrapfigure}")
+	   (multicolumnp "\\begin{figure*}%placement
+\\centering
+\\includegraphics[%attr]{%path}
+\\caption{%labelcmd%caption}
+\\end{figure*}")
 	   (floatp "\\begin{figure}%placement
 \\centering
 \\includegraphics[%attr]{%path}