emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* PATCH -- ox-latex.el .  sideways figure in latex export
@ 2014-04-05  6:14 Greg Tucker-Kellogg
  2014-04-05 19:03 ` Nicolas Goaziou
  0 siblings, 1 reply; 6+ messages in thread
From: Greg Tucker-Kellogg @ 2014-04-05  6:14 UTC (permalink / raw)
  To: org-mode mailing list

This is a tiny patch to support a “:float sidewaysfigure” option in LaTeX backend export

---
 lisp/ox-latex.el | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el
index d65c975..c05ffb6 100644
--- a/lisp/ox-latex.el
+++ b/lisp/ox-latex.el
@@ -1801,6 +1801,7 @@ used as a communication channel."
 	 (float (let ((float (plist-get attr :float)))
 		  (cond ((and (not float) (plist-member attr :float)) nil)
 			((string= float "wrap") 'wrap)
+			((string= float "sidewaysfigure") 'sidewaysfigure)
 			((string= float "multicolumn") 'multicolumn)
 			((or float
 			     (org-element-property :caption parent)
@@ -1876,6 +1877,10 @@ used as a communication channel."
 \\centering
 %s%s
 %s\\end{wrapfigure}" placement comment-include image-code caption))
+      (sidewaysfigure (format "\\begin{sidewaysfigure}%s
+\\centering
+%s%s
+%s\\end{sidewaysfigure}" placement comment-include image-code caption))
       (multicolumn (format "\\begin{figure*}%s
 \\centering
 %s%s
-- 
1.8.4.3

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: PATCH -- ox-latex.el .  sideways figure in latex export
  2014-04-05  6:14 PATCH -- ox-latex.el . sideways figure in latex export Greg Tucker-Kellogg
@ 2014-04-05 19:03 ` Nicolas Goaziou
  2014-04-06  4:10   ` Greg Tucker-Kellogg
  0 siblings, 1 reply; 6+ messages in thread
From: Nicolas Goaziou @ 2014-04-05 19:03 UTC (permalink / raw)
  To: Greg Tucker-Kellogg; +Cc: org-mode mailing list

Hello,

Greg Tucker-Kellogg <gtuckerkellogg@gmail.com> writes:

> This is a tiny patch to support a “:float sidewaysfigure” option in
> LaTeX backend export

Thank you for the patch.

It makes sense since tables provide "sidewaystable". By the way,
wouldn't it make sense to use "sideways" for both, instead of
"sidewaystable" and "sidewaysfigure"?

Also, it needs to be documented in org.texi. Do you want to take care of
that part?


Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: PATCH -- ox-latex.el . sideways figure in latex export
  2014-04-05 19:03 ` Nicolas Goaziou
@ 2014-04-06  4:10   ` Greg Tucker-Kellogg
  2014-04-06  8:46     ` Nicolas Goaziou
  0 siblings, 1 reply; 6+ messages in thread
From: Greg Tucker-Kellogg @ 2014-04-06  4:10 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: org-mode mailing list


[-- Attachment #1.1: Type: text/plain, Size: 957 bytes --]

I think this covers it.  ":float sideways" now works for both tables and
figures, but ":float sidewaystable" is kept for backwards compatibility.  I
updated org.texi, and mentioned that the use of ":float sideways" will make
the ":placement" option irrelevant.

Attached are the two patches; the one from yesterday and the one that
updates as described above.

Cheers,

Greg



On Sun, Apr 6, 2014 at 3:03 AM, Nicolas Goaziou <n.goaziou@gmail.com> wrote:

> Hello,
>
> Greg Tucker-Kellogg <gtuckerkellogg@gmail.com> writes:
>
> > This is a tiny patch to support a ":float sidewaysfigure" option in
> > LaTeX backend export
>
> Thank you for the patch.
>
> It makes sense since tables provide "sidewaystable". By the way,
> wouldn't it make sense to use "sideways" for both, instead of
> "sidewaystable" and "sidewaysfigure"?
>
> Also, it needs to be documented in org.texi. Do you want to take care of
> that part?
>
>
> Regards,
>
> --
> Nicolas Goaziou
>

[-- Attachment #1.2: Type: text/html, Size: 1638 bytes --]

[-- Attachment #2: 0001-ox-latex-sidewaysfigure-export-for-LaTeX-backend.patch --]
[-- Type: application/octet-stream, Size: 1242 bytes --]

From ff119eaace76d006fae036465960b7e69c04a059 Mon Sep 17 00:00:00 2001
From: Greg Tucker-Kellogg <gtuckerkellogg@gmail.com>
Date: Sat, 5 Apr 2014 14:03:29 +0800
Subject: [PATCH 1/2] ox-latex: sidewaysfigure export for LaTeX backend

This adds a :float sidewaysfigure option analogous to sidwaystable floats
---
 lisp/ox-latex.el | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el
index d65c975..c05ffb6 100644
--- a/lisp/ox-latex.el
+++ b/lisp/ox-latex.el
@@ -1801,6 +1801,7 @@ used as a communication channel."
 	 (float (let ((float (plist-get attr :float)))
 		  (cond ((and (not float) (plist-member attr :float)) nil)
 			((string= float "wrap") 'wrap)
+			((string= float "sidewaysfigure") 'sidewaysfigure)
 			((string= float "multicolumn") 'multicolumn)
 			((or float
 			     (org-element-property :caption parent)
@@ -1876,6 +1877,10 @@ used as a communication channel."
 \\centering
 %s%s
 %s\\end{wrapfigure}" placement comment-include image-code caption))
+      (sidewaysfigure (format "\\begin{sidewaysfigure}%s
+\\centering
+%s%s
+%s\\end{sidewaysfigure}" placement comment-include image-code caption))
       (multicolumn (format "\\begin{figure*}%s
 \\centering
 %s%s
-- 
1.8.4.3


[-- Attachment #3: 0002-Documented-and-standardised-sideways-options-for-tab.patch --]
[-- Type: application/octet-stream, Size: 3452 bytes --]

From 45e881f925498e4da71f395c2cf17a7d245ffe8e Mon Sep 17 00:00:00 2001
From: Greg Tucker-Kellogg <gtuckerkellogg@gmail.com>
Date: Sun, 6 Apr 2014 12:00:16 +0800
Subject: [PATCH 2/2] Documented and standardised "sideways" options for tables
 and figures for LaTeX exporter.

---
 doc/org.texi     | 14 ++++++++++----
 lisp/ox-latex.el |  9 +++++----
 2 files changed, 15 insertions(+), 8 deletions(-)

diff --git a/doc/org.texi b/doc/org.texi
index 9205abb..18178d3 100644
--- a/doc/org.texi
+++ b/doc/org.texi
@@ -11696,10 +11696,11 @@ task, you can use @code{:caption} attribute instead.  Its value should be raw
 @LaTeX{} code.  It has precedence over @code{#+CAPTION}.
 @item :float
 @itemx :placement
-Float environment for the table.  Possible values are @code{sidewaystable},
-@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.
+The @code{:float} specifies the float environment for the table.  Possible values are @code{sideways},
+(or equivalently @code{sidewaystable}), @code{multicolumn}, @code{t} and @code{nil}.  When unspecified, a table with
+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 sidewaystable.
 @item :align
 @itemx :font
 @itemx :width
@@ -11802,6 +11803,11 @@ environment.
 @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.
 @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
 a caption is provided.
 @end itemize
diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el
index c05ffb6..eccfa3d 100644
--- a/lisp/ox-latex.el
+++ b/lisp/ox-latex.el
@@ -1801,7 +1801,7 @@ used as a communication channel."
 	 (float (let ((float (plist-get attr :float)))
 		  (cond ((and (not float) (plist-member attr :float)) nil)
 			((string= float "wrap") 'wrap)
-			((string= float "sidewaysfigure") 'sidewaysfigure)
+			((string= float "sideways") 'sideways)
 			((string= float "multicolumn") 'multicolumn)
 			((or float
 			     (org-element-property :caption parent)
@@ -1877,10 +1877,10 @@ used as a communication channel."
 \\centering
 %s%s
 %s\\end{wrapfigure}" placement comment-include image-code caption))
-      (sidewaysfigure (format "\\begin{sidewaysfigure}%s
+      (sideways (format "\\begin{sidewaysfigure}
 \\centering
 %s%s
-%s\\end{sidewaysfigure}" placement comment-include image-code caption))
+%s\\end{sidewaysfigure}" comment-include image-code caption))
       (multicolumn (format "\\begin{figure*}%s
 \\centering
 %s%s
@@ -2552,7 +2552,8 @@ This function assumes TABLE has `org' as its `:type' property and
 		      (let ((float (plist-get attr :float)))
 			(cond
 			 ((and (not float) (plist-member attr :float)) nil)
-			 ((string= float "sidewaystable") "sidewaystable")
+			 ((or (string= float "sidewaystable")
+			      (string= float "sideways")) "sidewaystable")
 			 ((string= float "multicolumn") "table*")
 			 ((or float
 			      (org-element-property :caption table)
-- 
1.8.4.3


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: PATCH -- ox-latex.el . sideways figure in latex export
  2014-04-06  4:10   ` Greg Tucker-Kellogg
@ 2014-04-06  8:46     ` Nicolas Goaziou
  2014-04-06 10:19       ` Greg Tucker-Kellogg
  0 siblings, 1 reply; 6+ messages in thread
From: Nicolas Goaziou @ 2014-04-06  8:46 UTC (permalink / raw)
  To: Greg Tucker-Kellogg; +Cc: org-mode mailing list

Hello,

Greg Tucker-Kellogg <gtuckerkellogg@gmail.com> writes:

> I think this covers it.  ":float sideways" now works for both tables and
> figures, but ":float sidewaystable" is kept for backwards compatibility.  I
> updated org.texi, and mentioned that the use of ":float sideways" will make
> the ":placement" option irrelevant.
>
> Attached are the two patches; the one from yesterday and the one that
> updates as described above.

Thank you. Here are a few comments.

> +The @code{:float} specifies the float environment for the table.  Possible values are @code{sideways},
> +(or equivalently @code{sidewaystable}), @code{multicolumn}, @code{t} and @code{nil}.  When unspecified, a table with
> +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 sidewaystable.

In Texinfo, you need to add two spaces after a period.

Also, providing backwards compatibility for "sidewaystable" in code is
fine, but I don't think we need to talk about it anymore as an
alternative option in the documentation. If you feel uncomfortable about
it, I think it's better to add a footnote:

  Possible values are @code{sideways}@footnote{Formerly, the value was
  @code{sidewaystable}.  This is deprecated since Org 8.3.},
  @code{multicolumn}...

Also, could you provide a proper commit message, with "TINYCHANGE" at
its end. For more information, see

  http://orgmode.org/worg/org-contribute.html

I think you can also merge both patches. But that's your call.


Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: PATCH -- ox-latex.el . sideways figure in latex export
  2014-04-06  8:46     ` Nicolas Goaziou
@ 2014-04-06 10:19       ` Greg Tucker-Kellogg
  2014-04-06 12:26         ` Nicolas Goaziou
  0 siblings, 1 reply; 6+ messages in thread
From: Greg Tucker-Kellogg @ 2014-04-06 10:19 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: org-mode mailing list


[-- Attachment #1.1: Type: text/plain, Size: 1838 bytes --]

Thanks for the guidance.  I think this is it.

Cheers,

Greg



On Sun, Apr 6, 2014 at 4:46 PM, Nicolas Goaziou <n.goaziou@gmail.com> wrote:

> Hello,
>
> Greg Tucker-Kellogg <gtuckerkellogg@gmail.com> writes:
>
> > I think this covers it.  ":float sideways" now works for both tables and
> > figures, but ":float sidewaystable" is kept for backwards compatibility.
>  I
> > updated org.texi, and mentioned that the use of ":float sideways" will
> make
> > the ":placement" option irrelevant.
> >
> > Attached are the two patches; the one from yesterday and the one that
> > updates as described above.
>
> Thank you. Here are a few comments.
>
> > +The @code{:float} specifies the float environment for the table.
>  Possible values are @code{sideways},
> > +(or equivalently @code{sidewaystable}), @code{multicolumn}, @code{t}
> and @code{nil}.  When unspecified, a table with
> > +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 sidewaystable.
>
> In Texinfo, you need to add two spaces after a period.
>
> Also, providing backwards compatibility for "sidewaystable" in code is
> fine, but I don't think we need to talk about it anymore as an
> alternative option in the documentation. If you feel uncomfortable about
> it, I think it's better to add a footnote:
>
>   Possible values are @code{sideways}@footnote{Formerly, the value was
>   @code{sidewaystable}.  This is deprecated since Org 8.3.},
>   @code{multicolumn}...
>
> Also, could you provide a proper commit message, with "TINYCHANGE" at
> its end. For more information, see
>
>   http://orgmode.org/worg/org-contribute.html
>
> I think you can also merge both patches. But that's your call.
>
>
> Regards,
>
> --
> Nicolas Goaziou
>

[-- Attachment #1.2: Type: text/html, Size: 2658 bytes --]

[-- Attachment #2: 0001-ox-latex.el-support-sideways-float-options-for-table.patch --]
[-- Type: application/octet-stream, Size: 3725 bytes --]

From 661632827e6d69d6a0163491a651bfe1cc985ab4 Mon Sep 17 00:00:00 2001
From: Greg Tucker-Kellogg <gtuckerkellogg@gmail.com>
Date: Sun, 6 Apr 2014 17:55:38 +0800
Subject: [PATCH] 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"

* 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.

TINYCHANGE
---
 doc/org.texi     | 14 +++++++++++---
 lisp/ox-latex.el |  8 +++++++-
 2 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/doc/org.texi b/doc/org.texi
index 9205abb..05b1888 100644
--- a/doc/org.texi
+++ b/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}.
 @item :float
 @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
-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
 @itemx :font
 @itemx :width
@@ -11802,6 +11805,11 @@ environment.
 @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.
 @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
 a caption is provided.
 @end itemize
diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el
index d65c975..eccfa3d 100644
--- a/lisp/ox-latex.el
+++ b/lisp/ox-latex.el
@@ -1801,6 +1801,7 @@ used as a communication channel."
 	 (float (let ((float (plist-get attr :float)))
 		  (cond ((and (not float) (plist-member attr :float)) nil)
 			((string= float "wrap") 'wrap)
+			((string= float "sideways") 'sideways)
 			((string= float "multicolumn") 'multicolumn)
 			((or float
 			     (org-element-property :caption parent)
@@ -1876,6 +1877,10 @@ used as a communication channel."
 \\centering
 %s%s
 %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
 \\centering
 %s%s
@@ -2547,7 +2552,8 @@ This function assumes TABLE has `org' as its `:type' property and
 		      (let ((float (plist-get attr :float)))
 			(cond
 			 ((and (not float) (plist-member attr :float)) nil)
-			 ((string= float "sidewaystable") "sidewaystable")
+			 ((or (string= float "sidewaystable")
+			      (string= float "sideways")) "sidewaystable")
 			 ((string= float "multicolumn") "table*")
 			 ((or float
 			      (org-element-property :caption table)
-- 
1.8.4.3


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: PATCH -- ox-latex.el . sideways figure in latex export
  2014-04-06 10:19       ` Greg Tucker-Kellogg
@ 2014-04-06 12:26         ` Nicolas Goaziou
  0 siblings, 0 replies; 6+ messages in thread
From: Nicolas Goaziou @ 2014-04-06 12:26 UTC (permalink / raw)
  To: Greg Tucker-Kellogg; +Cc: org-mode mailing list

Hello,

Greg Tucker-Kellogg <gtuckerkellogg@gmail.com> writes:

> Thanks for the guidance.  I think this is it.

Applied. Thank you.


Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-04-06 12:26 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-05  6:14 PATCH -- ox-latex.el . sideways figure in latex export Greg Tucker-Kellogg
2014-04-05 19:03 ` Nicolas Goaziou
2014-04-06  4:10   ` Greg Tucker-Kellogg
2014-04-06  8:46     ` Nicolas Goaziou
2014-04-06 10:19       ` Greg Tucker-Kellogg
2014-04-06 12:26         ` Nicolas Goaziou

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).