emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Re: [PATCH] Add margin option to float for figure in ox-latex.el
       [not found] <mailman.39.1589558407.15748.emacs-orgmode@gnu.org>
@ 2020-05-15 16:47 ` Pablo Palazon
  0 siblings, 0 replies; 11+ messages in thread
From: Pablo Palazon @ 2020-05-15 16:47 UTC (permalink / raw)
  To: emacs-orgmode


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

Thanks Eric, I've done the changes and I attach path files again.

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

[-- Attachment #2: 0001-ox-latex.el-Add-margin-to-float-option-for-attr_late.patch --]
[-- Type: text/x-patch, Size: 1528 bytes --]

From a4ff98eb82397721a152b3c3e51f6a993947140d Mon Sep 17 00:00:00 2001
From: Pablo Palazon <pablo.palazon@gmail.com>
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


[-- Attachment #3: 0003-org-manual.org-Fix-type-error.patch --]
[-- Type: text/x-patch, Size: 792 bytes --]

From 46a7fcecf5d2735f3f6f18481b302d4b4f887120 Mon Sep 17 00:00:00 2001
From: Pablo Palazon <pablo.palazon@gmail.com>
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


[-- Attachment #4: 0002-ox-latex.el-Add-documentation-to-margin-option-in-fl.patch --]
[-- Type: text/x-patch, Size: 865 bytes --]

From 5c3eee89e501140460ea974195249a432b213bb2 Mon Sep 17 00:00:00 2001
From: Pablo Palazon <pablo.palazon@gmail.com>
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


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

* Re: [PATCH] Add margin option to float for figure in ox-latex.el
  2020-05-17 16:48       ` Thomas S. Dye
@ 2020-05-23  9:12         ` Bastien
  0 siblings, 0 replies; 11+ messages in thread
From: Bastien @ 2020-05-23  9:12 UTC (permalink / raw)
  To: Thomas S. Dye; +Cc: emacs-orgmode, Pablo Palazon, Louis Gostiaux

Hello,

"Thomas S. Dye" <tsd@tsdye.online> 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


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

* Re: [PATCH] Add margin option to float for figure in ox-latex.el
  2020-05-16 20:35     ` Kyle Meyer
@ 2020-05-17 16:48       ` Thomas S. Dye
  2020-05-23  9:12         ` Bastien
  0 siblings, 1 reply; 11+ messages in thread
From: Thomas S. Dye @ 2020-05-17 16:48 UTC (permalink / raw)
  To: Kyle Meyer; +Cc: emacs-orgmode, Pablo Palazon, Louis Gostiaux, 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.fsf@gmx.us/


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


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

* Re: [PATCH] Add margin option to float for figure in ox-latex.el
  2020-05-16 18:00   ` Thomas S. Dye
@ 2020-05-16 20:35     ` Kyle Meyer
  2020-05-17 16:48       ` Thomas S. Dye
  0 siblings, 1 reply; 11+ messages in thread
From: Kyle Meyer @ 2020-05-16 20:35 UTC (permalink / raw)
  To: Thomas S. Dye; +Cc: emacs-orgmode, Pablo Palazon, Louis Gostiaux, Thomas S. Dye

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.fsf@gmx.us/


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

* Re: [PATCH] Add margin option to float for figure in ox-latex.el
  2020-05-16  6:37 ` Kyle Meyer
  2020-05-16  7:17   ` Louis Gostiaux
@ 2020-05-16 18:00   ` Thomas S. Dye
  2020-05-16 20:35     ` Kyle Meyer
  1 sibling, 1 reply; 11+ messages in thread
From: Thomas S. Dye @ 2020-05-16 18:00 UTC (permalink / raw)
  To: Kyle Meyer; +Cc: emacs-orgmode, Pablo Palazon, Louis Gostiaux, 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 
> <https://github.com/tsdye/tufte-org-mode>,
> 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-be6605fb8ea2@free.fr/
> [1]: https://yhetil.org/orgmode/m2h9hsgdo2.fsf@tsdye.com/


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


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

* Re: [PATCH] Add margin option to float for figure in ox-latex.el
  2020-05-16  7:17   ` Louis Gostiaux
@ 2020-05-16 16:46     ` Kyle Meyer
  0 siblings, 0 replies; 11+ messages in thread
From: Kyle Meyer @ 2020-05-16 16:46 UTC (permalink / raw)
  To: Louis Gostiaux; +Cc: emacs-orgmode, Thomas S. Dye, Pablo Palazon

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:
<CAOKwhjswgMvE4jkTXgMeEg7G9s9R2jkJf==Zt=dew1PJcdt2Eg@mail.gmail.com>

You can see the message at

  https://yhetil.org/CAOKwhjswgMvE4jkTXgMeEg7G9s9R2jkJf==Zt=dew1PJcdt2Eg@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.fsf@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.


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

* Re: [PATCH] Add margin option to float for figure in ox-latex.el
  2020-05-16  6:37 ` Kyle Meyer
@ 2020-05-16  7:17   ` Louis Gostiaux
  2020-05-16 16:46     ` Kyle Meyer
  2020-05-16 18:00   ` Thomas S. Dye
  1 sibling, 1 reply; 11+ messages in thread
From: Louis Gostiaux @ 2020-05-16  7:17 UTC (permalink / raw)
  To: Kyle Meyer, Pablo Palazon, emacs-orgmode; +Cc: Thomas S. Dye

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 <https://github.com/tsdye/tufte-org-mode>,
> 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-be6605fb8ea2@free.fr/
> [1]: https://yhetil.org/orgmode/m2h9hsgdo2.fsf@tsdye.com/


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

* Re: [PATCH] Add margin option to float for figure in ox-latex.el
  2020-05-14 16:06 Pablo Palazon
  2020-05-15 12:21 ` Eric S Fraga
@ 2020-05-16  6:37 ` Kyle Meyer
  2020-05-16  7:17   ` Louis Gostiaux
  2020-05-16 18:00   ` Thomas S. Dye
  1 sibling, 2 replies; 11+ messages in thread
From: Kyle Meyer @ 2020-05-16  6:37 UTC (permalink / raw)
  To: Pablo Palazon, emacs-orgmode; +Cc: Thomas S. Dye, Louis Gostiaux

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 <https://github.com/tsdye/tufte-org-mode>,
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-be6605fb8ea2@free.fr/
[1]: https://yhetil.org/orgmode/m2h9hsgdo2.fsf@tsdye.com/


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

* Re: [PATCH] Add margin option to float for figure in ox-latex.el
  2020-05-15 12:21 ` Eric S Fraga
@ 2020-05-15 17:02   ` Pablo Palazon
  0 siblings, 0 replies; 11+ messages in thread
From: Pablo Palazon @ 2020-05-15 17:02 UTC (permalink / raw)
  To: Pablo Palazon, emacs-orgmode


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

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 <e.fraga@ucl.ac.uk> 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
>

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

[-- Attachment #2: 0003-org-manual.org-Fix-type-error.patch --]
[-- Type: text/x-patch, Size: 792 bytes --]

From 46a7fcecf5d2735f3f6f18481b302d4b4f887120 Mon Sep 17 00:00:00 2001
From: Pablo Palazon <pablo.palazon@gmail.com>
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


[-- Attachment #3: 0002-ox-latex.el-Add-documentation-to-margin-option-in-fl.patch --]
[-- Type: text/x-patch, Size: 865 bytes --]

From 5c3eee89e501140460ea974195249a432b213bb2 Mon Sep 17 00:00:00 2001
From: Pablo Palazon <pablo.palazon@gmail.com>
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


[-- Attachment #4: 0001-ox-latex.el-Add-margin-to-float-option-for-attr_late.patch --]
[-- Type: text/x-patch, Size: 1528 bytes --]

From a4ff98eb82397721a152b3c3e51f6a993947140d Mon Sep 17 00:00:00 2001
From: Pablo Palazon <pablo.palazon@gmail.com>
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


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

* Re: [PATCH] Add margin option to float for figure in ox-latex.el
  2020-05-14 16:06 Pablo Palazon
@ 2020-05-15 12:21 ` Eric S Fraga
  2020-05-15 17:02   ` Pablo Palazon
  2020-05-16  6:37 ` Kyle Meyer
  1 sibling, 1 reply; 11+ messages in thread
From: Eric S Fraga @ 2020-05-15 12:21 UTC (permalink / raw)
  To: Pablo Palazon; +Cc: emacs-orgmode

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


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

* [PATCH] Add margin option to float for figure in ox-latex.el
@ 2020-05-14 16:06 Pablo Palazon
  2020-05-15 12:21 ` Eric S Fraga
  2020-05-16  6:37 ` Kyle Meyer
  0 siblings, 2 replies; 11+ messages in thread
From: Pablo Palazon @ 2020-05-14 16:06 UTC (permalink / raw)
  To: emacs-orgmode


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

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.

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

[-- Attachment #2: 0001-ox-latex.el-Add-margin-to-float-option-for-attr_late.patch --]
[-- Type: text/x-patch, Size: 1528 bytes --]

From ccec09203159a46074cc38718b474a9720c6f30d Mon Sep 17 00:00:00 2001
From: Pablo Palazon <pablo.palazon@gmail.com>
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


[-- Attachment #3: 0002-ox-latex.el-Add-documentation-to-margin-option-in-fl.patch --]
[-- Type: text/x-patch, Size: 865 bytes --]

From 01a6fb8b83f9f488d4c3224d5f58972d66f6b757 Mon Sep 17 00:00:00 2001
From: Pablo Palazon <pablo.palazon@gmail.com>
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


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

end of thread, other threads:[~2020-05-23  9:13 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <mailman.39.1589558407.15748.emacs-orgmode@gnu.org>
2020-05-15 16:47 ` [PATCH] Add margin option to float for figure in ox-latex.el Pablo Palazon
2020-05-14 16:06 Pablo Palazon
2020-05-15 12:21 ` Eric S Fraga
2020-05-15 17:02   ` Pablo Palazon
2020-05-16  6:37 ` Kyle Meyer
2020-05-16  7:17   ` Louis Gostiaux
2020-05-16 16:46     ` Kyle Meyer
2020-05-16 18:00   ` Thomas S. Dye
2020-05-16 20:35     ` Kyle Meyer
2020-05-17 16:48       ` Thomas S. Dye
2020-05-23  9:12         ` Bastien

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