Browse Source

ox-latex.el: support sideways :float options for tables and figures

* lisp/ox-latex.el (org-latex--inline-image): support a 'sideways
option for the float, and add case to handle it with a \sideaysfigure
in the export.
(org-latex--org-table): support "sideways" instead of deprecated
"sidewaystable".  The latter is still handled for backward
compatibility.

* doc/org.texi (Tables in LaTeX export): Document use of :float
  sideways.
(Images in LaTeX export): Document use of :float sideways.

This patch provides consistent :float sideways support for LaTeX
export of both figures and tables.

http://permalink.gmane.org/gmane.emacs.orgmode/84618

TINYCHANGE
Greg Tucker-Kellogg 11 years ago
parent
commit
c99fa2ab8a
2 changed files with 18 additions and 4 deletions
  1. 11 3
      doc/org.texi
  2. 7 1
      lisp/ox-latex.el

+ 11 - 3
doc/org.texi

@@ -11696,10 +11696,13 @@ task, you can use @code{:caption} attribute instead.  Its value should be raw
 @LaTeX{} code.  It has precedence over @code{#+CAPTION}.
 @LaTeX{} code.  It has precedence over @code{#+CAPTION}.
 @item :float
 @item :float
 @itemx :placement
 @itemx :placement
-Float environment for the table.  Possible values are @code{sidewaystable},
+The @code{:float} specifies the float environment for the table.  Possible
+values are @code{sideways}@footnote{Formerly, the value was
+@code{sidewaystable}.  This is deprecated since Org 8.3.},
 @code{multicolumn}, @code{t} and @code{nil}.  When unspecified, a table with
 @code{multicolumn}, @code{t} and @code{nil}.  When unspecified, a table with
-a caption will have a @code{table} environment.  Moreover, @code{:placement}
-attribute can specify the positioning of the float.
+a caption will have a @code{table} environment.  Moreover, the
+@code{:placement} attribute can specify the positioning of the float.  Note:
+@code{:placement} is ignored for @code{:float sideways} tables.
 @item :align
 @item :align
 @itemx :font
 @itemx :font
 @itemx :width
 @itemx :width
@@ -11802,6 +11805,11 @@ environment.
 @code{wrap}: if you would like to let text flow around the image.  It will
 @code{wrap}: if you would like to let text flow around the image.  It will
 make the figure occupy the left half of the page.
 make the figure occupy the left half of the page.
 @item
 @item
+@code{sideways}: if you would like the image to appear alone on a separate
+page rotated ninety degrees using the @code{sidewaysfigure}
+environment.  Setting this @code{:float} option will ignore the
+@code{:placement} setting.
+@item
 @code{nil}: if you need to avoid any floating environment, even when
 @code{nil}: if you need to avoid any floating environment, even when
 a caption is provided.
 a caption is provided.
 @end itemize
 @end itemize

+ 7 - 1
lisp/ox-latex.el

@@ -1801,6 +1801,7 @@ used as a communication channel."
 	 (float (let ((float (plist-get attr :float)))
 	 (float (let ((float (plist-get attr :float)))
 		  (cond ((and (not float) (plist-member attr :float)) nil)
 		  (cond ((and (not float) (plist-member attr :float)) nil)
 			((string= float "wrap") 'wrap)
 			((string= float "wrap") 'wrap)
+			((string= float "sideways") 'sideways)
 			((string= float "multicolumn") 'multicolumn)
 			((string= float "multicolumn") 'multicolumn)
 			((or float
 			((or float
 			     (org-element-property :caption parent)
 			     (org-element-property :caption parent)
@@ -1876,6 +1877,10 @@ used as a communication channel."
 \\centering
 \\centering
 %s%s
 %s%s
 %s\\end{wrapfigure}" placement comment-include image-code caption))
 %s\\end{wrapfigure}" placement comment-include image-code caption))
+      (sideways (format "\\begin{sidewaysfigure}
+\\centering
+%s%s
+%s\\end{sidewaysfigure}" comment-include image-code caption))
       (multicolumn (format "\\begin{figure*}%s
       (multicolumn (format "\\begin{figure*}%s
 \\centering
 \\centering
 %s%s
 %s%s
@@ -2547,7 +2552,8 @@ This function assumes TABLE has `org' as its `:type' property and
 		      (let ((float (plist-get attr :float)))
 		      (let ((float (plist-get attr :float)))
 			(cond
 			(cond
 			 ((and (not float) (plist-member attr :float)) nil)
 			 ((and (not float) (plist-member attr :float)) nil)
-			 ((string= float "sidewaystable") "sidewaystable")
+			 ((or (string= float "sidewaystable")
+			      (string= float "sideways")) "sidewaystable")
 			 ((string= float "multicolumn") "table*")
 			 ((string= float "multicolumn") "table*")
 			 ((or float
 			 ((or float
 			      (org-element-property :caption table)
 			      (org-element-property :caption table)