Re: [PATCH] Add margin option to float for figure in ox-latex.el

2020-05-23 Thread Bastien
Hello,

"Thomas S. Dye"  writes:

> Barring a guru's user-end customization, Rasmus's figure :environment
> attribute idea is a good one.

FWIW, I also think this is a good idea.

Thanks to those who help with this thread!

-- 
 Bastien



Re: [PATCH] Add margin option to float for figure in ox-latex.el

2020-05-17 Thread Thomas S. Dye

Aloha Kyle,

Barring a guru's user-end customization, Rasmus's figure 
:environment attribute idea is a good one.


The LaTeX float package has a facility to create and name 
environments that are handled like figures.  A figure :environment 
attribute in Org mode would provide a straightforward and flexible 
path to transcode them.


Thanks for looking into this.

Let me know if you have questions.

All the best,
Tom

Kyle Meyer writes:


Thomas S. Dye writes:

This patch produces a LaTeX environment, marginfigure, that 
isn't

part of the standard.  AFAIK, marginfigure is defined in the
sidenotes package and separately in the tufte-latex class, 
neither
of which Org mode loads by default.  If the patch is applied, 
then
one of these packages should be added to the list of default 
LaTeX
packages so ox-latex doesn't export code it is unable to 
compile.


My takeaway from the discussion surrounding ox-tufte-latex 
several
years ago is that support for non-standard LaTeX constructs 
should
not be part of Org mode core because they complicate 
maintenance

unduly.


Thanks for your input and the helpful summary.  The stance in 
the second

paragraph sounds like a sensible one.

Given the desire to use the marginfigure environment has popped 
up a few
times, I wonder if an ox-latex guru can suggest a user-end 
customization
that would enable the use of that environment.  I suppose an 
alternative
is Rasmus's proposal of an :environment attribute for figures 
[*] that I

mentioned in a sibling thread.

[*]: https://yhetil.org/orgmode/878u31ycc5@gmx.us/



--
Thomas S. Dye
https://tsdye.online/tsdye



Re: [PATCH] Add margin option to float for figure in ox-latex.el

2020-05-16 Thread Kyle Meyer
Thomas S. Dye writes:

> This patch produces a LaTeX environment, marginfigure, that isn't 
> part of the standard.  AFAIK, marginfigure is defined in the 
> sidenotes package and separately in the tufte-latex class, neither 
> of which Org mode loads by default.  If the patch is applied, then 
> one of these packages should be added to the list of default LaTeX 
> packages so ox-latex doesn't export code it is unable to compile.
>
> My takeaway from the discussion surrounding ox-tufte-latex several 
> years ago is that support for non-standard LaTeX constructs should 
> not be part of Org mode core because they complicate maintenance 
> unduly.

Thanks for your input and the helpful summary.  The stance in the second
paragraph sounds like a sensible one.

Given the desire to use the marginfigure environment has popped up a few
times, I wonder if an ox-latex guru can suggest a user-end customization
that would enable the use of that environment.  I suppose an alternative
is Rasmus's proposal of an :environment attribute for figures [*] that I
mentioned in a sibling thread.

[*]: https://yhetil.org/orgmode/878u31ycc5@gmx.us/



Re: [PATCH] Add margin option to float for figure in ox-latex.el

2020-05-16 Thread Thomas S. Dye

Aloha Kyle,

This patch produces a LaTeX environment, marginfigure, that isn't 
part of the standard.  AFAIK, marginfigure is defined in the 
sidenotes package and separately in the tufte-latex class, neither 
of which Org mode loads by default.  If the patch is applied, then 
one of these packages should be added to the list of default LaTeX 
packages so ox-latex doesn't export code it is unable to compile.


My takeaway from the discussion surrounding ox-tufte-latex several 
years ago is that support for non-standard LaTeX constructs should 
not be part of Org mode core because they complicate maintenance 
unduly.


I haven't used ox-tufte-latex since I last used paper handouts at 
a presentation several years ago, so I don't know if it still 
works.  However, it really was cobbled together, a process that 
involved copying big chunks of Org mode code.  I knew then this 
approach is sub-optimal, but never found the time to puzzle out 
how to turn it into advice that could sit on top of a possibly 
changing code base.


Also, FYI, I found the tufte-latex class a bit difficult to use. 
Objects in the margin can easily overwrite one another and the 
author has to fix these manually, which can be tricky.  The upside 
is that when everything is right, the output can be terrific to 
look at.


All the best,
Tom

Kyle Meyer writes:


Pablo Palazon writes:

I've created a path to add a new option to float properties for 
figures on
latex. This is my first change for org-mode, and I don't really 
sure if

this is the correct way to do it.


Thank you!

* lisp/ox-latex.el (org-latex--inline-image): Include margin 
option
to create marginfigure environment for figures. It's useful for 
tufte
latex class, where with this environment shows the figure in 
the margin.


I wondered if something like this had been proposed or discussed 
before.
Searching the list, I see a patch [0] very similar to yours from 
a
couple of months back that didn't get a response (author added 
to cc).


Further back, there is a thread about an exporter Thomas Dye 
(+cc) wrote
to handle marginfigure and some other Tufte-y things [1].  It 
looks like
the code is available at 
,

though I'm not sure if it still works with the current Org.

As for the proposed patch, while I think the specific code 
change itself
looks fine, skimming through the above thread makes me think 
that adding
marginfigure to ox-latex.el without considering similar cases 
may not be

the right approach.  What do others think?


[0]: 
https://yhetil.org/orgmode/35aac187-b751-5723-0f15-be6605fb8...@free.fr/

[1]: https://yhetil.org/orgmode/m2h9hsgdo2@tsdye.com/



--
Thomas S. Dye
https://tsdye.online/tsdye



Re: [PATCH] Add margin option to float for figure in ox-latex.el

2020-05-16 Thread Kyle Meyer
Louis Gostiaux writes:

> Kyle could you please redirect also to Pablo's patch ? Couldn't find it.

Sure, there were three patches, but the patch for the main code change
was in the message that mine as in reply to:


You can see the message at

  
https://yhetil.org/CAOKwhjswgMvE4jkTXgMeEg7G9s9R2jkJf==Zt=dew1pjcdt...@mail.gmail.com

or in Org mode's official archive:

  https://lists.gnu.org/archive/html/emacs-orgmode/2020-05/msg00243.html

> That's also great that an exporter for tufte exists. However, as far as 
> I understood, marginfigure is not exclusevely usedby tufte. I guess the 
> marginfigure environment coule be supported in the generic latex export, 
> and the tufte export could simply focus on the environments specific to 
> tufte ?

Thanks for the information.  So the marginfigure environment is defined
by the sidenotes package, right?  Should other environments from the
package be considered?  I suppose the main one I'm wondering about is
margintable.  Also, in the ox-tufte-LaTeX thread I linked to, Rasmus was
wondering [*] whether it'd make sense to instead have an :environment
attribute.  I _think_ the main appeal is that it would allow new
environments to be specified without tweaking org-latex--inline-image or
user-end customization.

[*] https://yhetil.org/orgmode/878u31ycc5@gmx.us/#t

> That's great you found my post. At the time Bastien Guerry had replied, 
> but no news since then.

Ah, I didn't see a reply from Bastien in my local mail or any archives.
Perhaps it didn't make it to the list or wasn't linked up to the
original mail.



Re: [PATCH] Add margin option to float for figure in ox-latex.el

2020-05-16 Thread Louis Gostiaux

Hi all,

Kyle could you please redirect also to Pablo's patch ? Couldn't find it.

That's also great that an exporter for tufte exists. However, as far as 
I understood, marginfigure is not exclusevely usedby tufte. I guess the 
marginfigure environment coule be supported in the generic latex export, 
and the tufte export could simply focus on the environments specific to 
tufte ?


That's great you found my post. At the time Bastien Guerry had replied, 
but no news since then.


Louis.

Le 16/05/2020 à 08:37, Kyle Meyer a écrit :

Pablo Palazon writes:


I've created a path to add a new option to float properties for figures on
latex. This is my first change for org-mode, and I don't really sure if
this is the correct way to do it.

Thank you!


* lisp/ox-latex.el (org-latex--inline-image): Include margin option
to create marginfigure environment for figures. It's useful for tufte
latex class, where with this environment shows the figure in the margin.

I wondered if something like this had been proposed or discussed before.
Searching the list, I see a patch [0] very similar to yours from a
couple of months back that didn't get a response (author added to cc).

Further back, there is a thread about an exporter Thomas Dye (+cc) wrote
to handle marginfigure and some other Tufte-y things [1].  It looks like
the code is available at ,
though I'm not sure if it still works with the current Org.

As for the proposed patch, while I think the specific code change itself
looks fine, skimming through the above thread makes me think that adding
marginfigure to ox-latex.el without considering similar cases may not be
the right approach.  What do others think?


[0]: https://yhetil.org/orgmode/35aac187-b751-5723-0f15-be6605fb8...@free.fr/
[1]: https://yhetil.org/orgmode/m2h9hsgdo2@tsdye.com/




Re: [PATCH] Add margin option to float for figure in ox-latex.el

2020-05-16 Thread Kyle Meyer
Pablo Palazon writes:

> I've created a path to add a new option to float properties for figures on
> latex. This is my first change for org-mode, and I don't really sure if
> this is the correct way to do it.

Thank you!

> * lisp/ox-latex.el (org-latex--inline-image): Include margin option
> to create marginfigure environment for figures. It's useful for tufte
> latex class, where with this environment shows the figure in the margin.

I wondered if something like this had been proposed or discussed before.
Searching the list, I see a patch [0] very similar to yours from a
couple of months back that didn't get a response (author added to cc).

Further back, there is a thread about an exporter Thomas Dye (+cc) wrote
to handle marginfigure and some other Tufte-y things [1].  It looks like
the code is available at ,
though I'm not sure if it still works with the current Org.

As for the proposed patch, while I think the specific code change itself
looks fine, skimming through the above thread makes me think that adding
marginfigure to ox-latex.el without considering similar cases may not be
the right approach.  What do others think?


[0]: https://yhetil.org/orgmode/35aac187-b751-5723-0f15-be6605fb8...@free.fr/
[1]: https://yhetil.org/orgmode/m2h9hsgdo2@tsdye.com/



Re: [PATCH] Add margin option to float for figure in ox-latex.el

2020-05-15 Thread Pablo Palazon
Thanks eric, I've done the changes and I attach all the patches.

On Fri, May 15, 2020 at 2:21 PM Eric S Fraga  wrote:

> Just a minor point: in the patch for the documentation, change "imagen"
> to "image".
> --
> : Eric S Fraga via Emacs 28.0.50, Org release_9.3.6-631-g48b223
>
From 46a7fcecf5d2735f3f6f18481b302d4b4f887120 Mon Sep 17 00:00:00 2001
From: Pablo Palazon 
Date: Fri, 15 May 2020 18:25:21 +0200
Subject: [PATCH 3/3] org-manual.org: Fix type error

* doc/org-manual.org (Images in LaTeX export): Fix typo error on image
---
 doc/org-manual.org | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/doc/org-manual.org b/doc/org-manual.org
index e0c41f13e..b792f588a 100644
--- a/doc/org-manual.org
+++ b/doc/org-manual.org
@@ -13572,8 +13572,8 @@ attribute to one of the following:
 
 - =margin= ::
 
-  For use the =marginfigure= environment. This environment shows the imagen in
-  the margin
+  For use the =marginfigure= environment. This environment shows the
+  image in the margin
 
 - =nil= ::
 
-- 
2.26.2

From 5c3eee89e501140460ea974195249a432b213bb2 Mon Sep 17 00:00:00 2001
From: Pablo Palazon 
Date: Thu, 14 May 2020 16:55:19 +0200
Subject: [PATCH 2/3] ox-latex.el: Add documentation to margin option in float

* doc/org-manual.org: Add documentation
---
 doc/org-manual.org | 5 +
 1 file changed, 5 insertions(+)

diff --git a/doc/org-manual.org b/doc/org-manual.org
index 673bb11c5..e0c41f13e 100644
--- a/doc/org-manual.org
+++ b/doc/org-manual.org
@@ -13570,6 +13570,11 @@ attribute to one of the following:
   For a new page with the image sideways, rotated ninety degrees, in
   a =sidewaysfigure= environment; overrides =:placement= setting.
 
+- =margin= ::
+
+  For use the =marginfigure= environment. This environment shows the imagen in
+  the margin
+
 - =nil= ::
 
   To avoid a =:float= even if using a caption.
-- 
2.26.2

From a4ff98eb82397721a152b3c3e51f6a993947140d Mon Sep 17 00:00:00 2001
From: Pablo Palazon 
Date: Thu, 14 May 2020 16:33:53 +0200
Subject: [PATCH 1/3] ox-latex.el: Add margin to float option for attr_latex in
 images

* lisp/ox-latex.el (org-latex--inline-image): Include margin option
to create marginfigure environment for figures. It's useful for tufte
latex class, where with this environment shows the figure in the margin.

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

diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el
index 6535d59f8..4b9281e1a 100644
--- a/lisp/ox-latex.el
+++ b/lisp/ox-latex.el
@@ -2374,6 +2374,7 @@ used as a communication channel."
 		  (cond ((string= float "wrap") 'wrap)
 			((string= float "sideways") 'sideways)
 			((string= float "multicolumn") 'multicolumn)
+			((string= float "margin") 'marginfigure)
 			((and (plist-member attr :float) (not float)) 'nonfloat)
 			((or float
 			 (org-element-property :caption parent)
@@ -2494,6 +2495,15 @@ used as a communication channel."
 			(if center "\\centering" "")
 			comment-include image-code
 			(if caption-above-p "" caption)))
+  (`marginfigure (format "\\begin{marginfigure}%s
+%s%s
+%s%s
+%s\\end{marginfigure}"
+			placement
+			(if caption-above-p caption "")
+			(if center "\\centering" "")
+			comment-include image-code
+			(if caption-above-p "" caption)))
   (`figure (format "\\begin{figure}%s
 %s%s
 %s%s
-- 
2.26.2



Re: [PATCH] Add margin option to float for figure in ox-latex.el

2020-05-15 Thread Pablo Palazon
Thanks Eric, I've done the changes and I attach path files again.
From a4ff98eb82397721a152b3c3e51f6a993947140d Mon Sep 17 00:00:00 2001
From: Pablo Palazon 
Date: Thu, 14 May 2020 16:33:53 +0200
Subject: [PATCH 1/3] ox-latex.el: Add margin to float option for attr_latex in
 images

* lisp/ox-latex.el (org-latex--inline-image): Include margin option
to create marginfigure environment for figures. It's useful for tufte
latex class, where with this environment shows the figure in the margin.

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

diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el
index 6535d59f8..4b9281e1a 100644
--- a/lisp/ox-latex.el
+++ b/lisp/ox-latex.el
@@ -2374,6 +2374,7 @@ used as a communication channel."
 		  (cond ((string= float "wrap") 'wrap)
 			((string= float "sideways") 'sideways)
 			((string= float "multicolumn") 'multicolumn)
+			((string= float "margin") 'marginfigure)
 			((and (plist-member attr :float) (not float)) 'nonfloat)
 			((or float
 			 (org-element-property :caption parent)
@@ -2494,6 +2495,15 @@ used as a communication channel."
 			(if center "\\centering" "")
 			comment-include image-code
 			(if caption-above-p "" caption)))
+  (`marginfigure (format "\\begin{marginfigure}%s
+%s%s
+%s%s
+%s\\end{marginfigure}"
+			placement
+			(if caption-above-p caption "")
+			(if center "\\centering" "")
+			comment-include image-code
+			(if caption-above-p "" caption)))
   (`figure (format "\\begin{figure}%s
 %s%s
 %s%s
-- 
2.26.2

From 46a7fcecf5d2735f3f6f18481b302d4b4f887120 Mon Sep 17 00:00:00 2001
From: Pablo Palazon 
Date: Fri, 15 May 2020 18:25:21 +0200
Subject: [PATCH 3/3] org-manual.org: Fix type error

* doc/org-manual.org (Images in LaTeX export): Fix typo error on image
---
 doc/org-manual.org | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/doc/org-manual.org b/doc/org-manual.org
index e0c41f13e..b792f588a 100644
--- a/doc/org-manual.org
+++ b/doc/org-manual.org
@@ -13572,8 +13572,8 @@ attribute to one of the following:
 
 - =margin= ::
 
-  For use the =marginfigure= environment. This environment shows the imagen in
-  the margin
+  For use the =marginfigure= environment. This environment shows the
+  image in the margin
 
 - =nil= ::
 
-- 
2.26.2

From 5c3eee89e501140460ea974195249a432b213bb2 Mon Sep 17 00:00:00 2001
From: Pablo Palazon 
Date: Thu, 14 May 2020 16:55:19 +0200
Subject: [PATCH 2/3] ox-latex.el: Add documentation to margin option in float

* doc/org-manual.org: Add documentation
---
 doc/org-manual.org | 5 +
 1 file changed, 5 insertions(+)

diff --git a/doc/org-manual.org b/doc/org-manual.org
index 673bb11c5..e0c41f13e 100644
--- a/doc/org-manual.org
+++ b/doc/org-manual.org
@@ -13570,6 +13570,11 @@ attribute to one of the following:
   For a new page with the image sideways, rotated ninety degrees, in
   a =sidewaysfigure= environment; overrides =:placement= setting.
 
+- =margin= ::
+
+  For use the =marginfigure= environment. This environment shows the imagen in
+  the margin
+
 - =nil= ::
 
   To avoid a =:float= even if using a caption.
-- 
2.26.2



Re: [PATCH] Add margin option to float for figure in ox-latex.el

2020-05-15 Thread Eric S Fraga
Just a minor point: in the patch for the documentation, change "imagen"
to "image".
-- 
: Eric S Fraga via Emacs 28.0.50, Org release_9.3.6-631-g48b223



[PATCH] Add margin option to float for figure in ox-latex.el

2020-05-14 Thread Pablo Palazon
Hi everyone!.

I've created a path to add a new option to float properties for figures on
latex. This is my first change for org-mode, and I don't really sure if
this is the correct way to do it.

This change add a new latex environment for showing figures in the margin.
It's useful when you are exporting to latex with tufte class.

Please see path files attached with my changes, and tell me what you think.

Thanks for you work on this.
From ccec09203159a46074cc38718b474a9720c6f30d Mon Sep 17 00:00:00 2001
From: Pablo Palazon 
Date: Thu, 14 May 2020 16:33:53 +0200
Subject: [PATCH 1/2] ox-latex.el: Add margin to float option for attr_latex in
 images

* lisp/ox-latex.el (org-latex--inline-image): Include margin option
to create marginfigure environment for figures. It's useful for tufte
latex class, where with this environment shows the figure in the margin.

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

diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el
index 6535d59f8..4b9281e1a 100644
--- a/lisp/ox-latex.el
+++ b/lisp/ox-latex.el
@@ -2374,6 +2374,7 @@ used as a communication channel."
 		  (cond ((string= float "wrap") 'wrap)
 			((string= float "sideways") 'sideways)
 			((string= float "multicolumn") 'multicolumn)
+			((string= float "margin") 'marginfigure)
 			((and (plist-member attr :float) (not float)) 'nonfloat)
 			((or float
 			 (org-element-property :caption parent)
@@ -2494,6 +2495,15 @@ used as a communication channel."
 			(if center "\\centering" "")
 			comment-include image-code
 			(if caption-above-p "" caption)))
+  (`marginfigure (format "\\begin{marginfigure}%s
+%s%s
+%s%s
+%s\\end{marginfigure}"
+			placement
+			(if caption-above-p caption "")
+			(if center "\\centering" "")
+			comment-include image-code
+			(if caption-above-p "" caption)))
   (`figure (format "\\begin{figure}%s
 %s%s
 %s%s
-- 
2.26.2

From 01a6fb8b83f9f488d4c3224d5f58972d66f6b757 Mon Sep 17 00:00:00 2001
From: Pablo Palazon 
Date: Thu, 14 May 2020 16:55:19 +0200
Subject: [PATCH 2/2] ox-latex.el: Add documentation to margin option in float

* doc/org-manual.org: Add documentation
---
 doc/org-manual.org | 5 +
 1 file changed, 5 insertions(+)

diff --git a/doc/org-manual.org b/doc/org-manual.org
index a7bdbab5d..2e6882591 100644
--- a/doc/org-manual.org
+++ b/doc/org-manual.org
@@ -13561,6 +13561,11 @@ attribute to one of the following:
   For a new page with the image sideways, rotated ninety degrees, in
   a =sidewaysfigure= environment; overrides =:placement= setting.
 
+- =margin= ::
+
+  For use the =marginfigure= environment. This environment shows the imagen in
+  the margin
+
 - =nil= ::
 
   To avoid a =:float= even if using a caption.
-- 
2.26.2