emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] org-manual.org: update and add info for arbitrary :float values
@ 2022-02-11 20:37 Juan Manuel Macías
  2022-02-13 21:18 ` Nicolas Goaziou
  0 siblings, 1 reply; 6+ messages in thread
From: Juan Manuel Macías @ 2022-02-11 20:37 UTC (permalink / raw)
  To: orgmode

[-- Attachment #1: Type: text/plain, Size: 427 bytes --]

Hi all,

From the commit:

e0bc2b37f :: lisp/ox-latex.el: Allow arbitrary float environments

The `t' option for `:float' in tables and images is no longer valid.
That is, something like

#+ATTR_LaTeX: :float t
[[file:foo.jpg]]

would create in LaTeX export:

\begin{t}
\centering
\includegraphics[width=.9\linewidth]{foo.jpg}
\end{t}

I am attaching a patch to update those changes to the Manual.

Best regards,

Juan Manuel


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-doc-org-manual.org-add-arbitrary-float-values.patch --]
[-- Type: text/x-patch, Size: 1932 bytes --]

From 03aacd306355741f67533325dd6dbd8c5a472ec0 Mon Sep 17 00:00:00 2001
From: Juan Manuel Macias <maciaschain@posteo.net>
Date: Fri, 11 Feb 2022 21:18:16 +0100
Subject: [PATCH] doc/org-manual.org: add arbitrary :float values

* Tables in LaTeX export: remove `t' value
* Images in LaTeX export: remove `t' value
---
 doc/org-manual.org | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/doc/org-manual.org b/doc/org-manual.org
index b8c61fddd..4c6fcf8db 100644
--- a/doc/org-manual.org
+++ b/doc/org-manual.org
@@ -13572,7 +13572,11 @@ include:
 
   The table environments by default are not floats in LaTeX.  To make
   them floating objects use =:float= with one of the following
-  options: =sideways=, =multicolumn=, =t=, and =nil=.
+  options: =sideways= (for a =sidewaystable= environment),
+  =multicolumn= (to span the table across multiple columns of a page
+  in a =table*= environment) and =nil=. In addition to these three
+  values, =:float= can pass through any arbitrary value, for example a
+  user-defined float type with the =float= LaTeX package.
 
   LaTeX floats can also have additional layout =:placement=
   attributes.  These are the usual =[h t b p ! H]= permissions
@@ -13684,11 +13688,6 @@ export back-end wraps the picture in a floating =figure= environment.
 To float an image without specifying a caption, set the =:float=
 attribute to one of the following:
 
-- =t= ::
-
-  For a standard =figure= environment; used by default whenever an
-  image has a caption.
-
 - =multicolumn= ::
 
   To span the image across multiple columns of a page; the back-end
@@ -13708,6 +13707,11 @@ attribute to one of the following:
 
   To avoid a =:float= even if using a caption.
 
+- Any arbitrary value ::
+
+ For example, a user-defined float type with the =float= LaTeX package.
+
+
 Use the =placement= attribute to modify a floating environment's
 placement.
 
-- 
2.35.0


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

* Re: [PATCH] org-manual.org: update and add info for arbitrary :float values
  2022-02-11 20:37 [PATCH] org-manual.org: update and add info for arbitrary :float values Juan Manuel Macías
@ 2022-02-13 21:18 ` Nicolas Goaziou
  2022-02-13 22:21   ` Juan Manuel Macías
  0 siblings, 1 reply; 6+ messages in thread
From: Nicolas Goaziou @ 2022-02-13 21:18 UTC (permalink / raw)
  To: Juan Manuel Macías; +Cc: orgmode

Hello,

Juan Manuel Macías <maciaschain@posteo.net> writes:

> Hi all,
>
> From the commit:
>
> e0bc2b37f :: lisp/ox-latex.el: Allow arbitrary float environments
>
> The `t' option for `:float' in tables and images is no longer valid.
> That is, something like
>
> #+ATTR_LaTeX: :float t
> [[file:foo.jpg]]
>
> would create in LaTeX export:
>
> \begin{t}
> \centering
> \includegraphics[width=.9\linewidth]{foo.jpg}
> \end{t}
>
> I am attaching a patch to update those changes to the Manual.

Thanks. Note you need to add two spaces between sentences.

However, isn't it a bug? Shouldn't t value default to "figure"
environment, if only for the sake of backward compatibility?

Regards,
-- 
Nicolas Goaziou


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

* Re: [PATCH] org-manual.org: update and add info for arbitrary :float values
  2022-02-13 21:18 ` Nicolas Goaziou
@ 2022-02-13 22:21   ` Juan Manuel Macías
  2022-02-15 13:24     ` Nicolas Goaziou
  0 siblings, 1 reply; 6+ messages in thread
From: Juan Manuel Macías @ 2022-02-13 22:21 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: orgmode

Hi Nicolas,

Nicolas Goaziou writes:

> Thanks. Note you need to add two spaces between sentences.

Ah, sorry, I hadn't noticed that :-). The thing is that I have in my
~/.emacs `sentence-end-double-space' set to nil.

> However, isn't it a bug? Shouldn't t value default to "figure"
> environment, if only for the sake of backward compatibility?

I think you're right. t value should be figure and table, I agree. Would
it be appropriate to add these two lines:

In org-latex--inline-image:

((string= float "t") 'figure)

And in org-latex--decorate-table

((string= float "t") "table")

?

Best regards,

Juan Manuel 


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

* Re: [PATCH] org-manual.org: update and add info for arbitrary :float values
  2022-02-13 22:21   ` Juan Manuel Macías
@ 2022-02-15 13:24     ` Nicolas Goaziou
  2022-02-16 19:52       ` [PATCH] ox-latex.el: Add a `t' value for `:float' in tables and figures (was: update and add info for arbitrary :float values) Juan Manuel Macías
  0 siblings, 1 reply; 6+ messages in thread
From: Nicolas Goaziou @ 2022-02-15 13:24 UTC (permalink / raw)
  To: Juan Manuel Macías; +Cc: orgmode

Hello,

Juan Manuel Macías <maciaschain@posteo.net> writes:

> Ah, sorry, I hadn't noticed that :-). The thing is that I have in my
> ~/.emacs `sentence-end-double-space' set to nil.

Yes, .dir-locals.el files contains (sentence-end-double-space . t).
Somehow, you are not evaluating it.

>> However, isn't it a bug? Shouldn't t value default to "figure"
>> environment, if only for the sake of backward compatibility?
>
> I think you're right. t value should be figure and table, I agree. Would
> it be appropriate to add these two lines:
>
> In org-latex--inline-image:
>
> ((string= float "t") 'figure)
>
> And in org-latex--decorate-table
>
> ((string= float "t") "table")

I think so.

Regards,
-- 
Nicolas Goaziou


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

* Re: [PATCH] ox-latex.el: Add a `t' value for `:float' in tables and figures (was: update and add info for arbitrary :float values)
  2022-02-15 13:24     ` Nicolas Goaziou
@ 2022-02-16 19:52       ` Juan Manuel Macías
  2022-02-22 19:14         ` [PATCH] ox-latex.el: Add a `t' value for `:float' in tables and figures Nicolas Goaziou
  0 siblings, 1 reply; 6+ messages in thread
From: Juan Manuel Macías @ 2022-02-16 19:52 UTC (permalink / raw)
  To: orgmode; +Cc: Nicolas Goaziou

[-- Attachment #1: Type: text/plain, Size: 1006 bytes --]

Hi,

I am attaching an updated version of the patch, which retrieves the
`t' value for `:float' in tables and figures. The necessary information in
the Manual is also updated.

Best regards,

Juan Manuel 

Nicolas Goaziou writes:

> Hello,
>
> Juan Manuel Macías <maciaschain@posteo.net> writes:
>
>> Ah, sorry, I hadn't noticed that :-). The thing is that I have in my
>> ~/.emacs `sentence-end-double-space' set to nil.
>
> Yes, .dir-locals.el files contains (sentence-end-double-space . t).
> Somehow, you are not evaluating it.
>
>>> However, isn't it a bug? Shouldn't t value default to "figure"
>>> environment, if only for the sake of backward compatibility?
>>
>> I think you're right. t value should be figure and table, I agree. Would
>> it be appropriate to add these two lines:
>>
>> In org-latex--inline-image:
>>
>> ((string= float "t") 'figure)
>>
>> And in org-latex--decorate-table
>>
>> ((string= float "t") "table")
>
> I think so.
>
> Regards,


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-lisp-ox-latex.el-Add-a-t-value-for-float-in-tables-a.patch --]
[-- Type: text/x-patch, Size: 2955 bytes --]

From b00b1d30d66d0932d4becb3c74fe3c3837dbdec1 Mon Sep 17 00:00:00 2001
From: Juan Manuel Macias <maciaschain@posteo.net>
Date: Wed, 16 Feb 2022 20:27:38 +0100
Subject: [PATCH] lisp/ox-latex.el: Add a `t' value for `:float' in tables and
 figures

* org-latex--inline-image: default `figure' environment
* org-latex--decorate-table: default table environment
* doc/org-manual.org (Tables in LaTeX export): add `t' and arbitrary
`:float' values
* doc/org-manual.org (Images in LaTeX export): add `t' and arbitrary
`:float' values
---
 doc/org-manual.org | 15 ++++++++++++---
 lisp/ox-latex.el   |  2 ++
 2 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/doc/org-manual.org b/doc/org-manual.org
index b8c61fddd..d58f80523 100644
--- a/doc/org-manual.org
+++ b/doc/org-manual.org
@@ -13572,7 +13572,12 @@ include:
 
   The table environments by default are not floats in LaTeX.  To make
   them floating objects use =:float= with one of the following
-  options: =sideways=, =multicolumn=, =t=, and =nil=.
+  options: =t= (for a default =table= environment), =sideways= (for a
+  =sidewaystable= environment), =multicolumn= (to span the table
+  across multiple columns of a page in a =table*= environment) and
+  =nil=.  In addition to these three values, =:float= can pass through
+  any arbitrary value, for example a user-defined float type with the
+  =float= LaTeX package.
 
   LaTeX floats can also have additional layout =:placement=
   attributes.  These are the usual =[h t b p ! H]= permissions
@@ -13686,8 +13691,7 @@ attribute to one of the following:
 
 - =t= ::
 
-  For a standard =figure= environment; used by default whenever an
-  image has a caption.
+For a default =figure= environment. 
 
 - =multicolumn= ::
 
@@ -13708,6 +13712,11 @@ attribute to one of the following:
 
   To avoid a =:float= even if using a caption.
 
+- Any arbitrary value ::
+
+ For example, a user-defined float type with the =float= LaTeX package.
+
+
 Use the =placement= attribute to modify a floating environment's
 placement.
 
diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el
index 5dda9b3ab..0edba9e52 100644
--- a/lisp/ox-latex.el
+++ b/lisp/ox-latex.el
@@ -2414,6 +2414,7 @@ used as a communication channel."
 		  (cond ((string= float "wrap") 'wrap)
 			((string= float "sideways") 'sideways)
 			((string= float "multicolumn") 'multicolumn)
+                        ((string= float "t") 'figure)
 			((and (plist-member attr :float) (not float)) 'nonfloat)
                         (float float)
 			((or (org-element-property :caption parent)
@@ -3269,6 +3270,7 @@ Return new environment, as a string."
 	    (cond ((and (not float) (plist-member attributes :float)) nil)
 		  ((member float '("sidewaystable" "sideways")) "sidewaystable")
 		  ((equal float "multicolumn") "table*")
+                  ((string= float "t") "table")
                   (float float)
 		  ((org-string-nw-p caption) "table")
 		  (t nil))))
-- 
2.35.0


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

* Re: [PATCH] ox-latex.el: Add a `t' value for `:float' in tables and figures
  2022-02-16 19:52       ` [PATCH] ox-latex.el: Add a `t' value for `:float' in tables and figures (was: update and add info for arbitrary :float values) Juan Manuel Macías
@ 2022-02-22 19:14         ` Nicolas Goaziou
  0 siblings, 0 replies; 6+ messages in thread
From: Nicolas Goaziou @ 2022-02-22 19:14 UTC (permalink / raw)
  To: Juan Manuel Macías; +Cc: orgmode

Hello,

Juan Manuel Macías <maciaschain@posteo.net> writes:

> I am attaching an updated version of the patch, which retrieves the
> `t' value for `:float' in tables and figures. The necessary information in
> the Manual is also updated.

Applied. Thank you.

Regards,
-- 
Nicolas Goaziou


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

end of thread, other threads:[~2022-02-22 19:15 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-11 20:37 [PATCH] org-manual.org: update and add info for arbitrary :float values Juan Manuel Macías
2022-02-13 21:18 ` Nicolas Goaziou
2022-02-13 22:21   ` Juan Manuel Macías
2022-02-15 13:24     ` Nicolas Goaziou
2022-02-16 19:52       ` [PATCH] ox-latex.el: Add a `t' value for `:float' in tables and figures (was: update and add info for arbitrary :float values) Juan Manuel Macías
2022-02-22 19:14         ` [PATCH] ox-latex.el: Add a `t' value for `:float' in tables and figures Nicolas Goaziou

Code repositories for project(s) associated with this 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).