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/




MarginFigure environment in LaTeX export

2020-03-06 Thread Louis Gostiaux

Hello,

Here is a patch to allow the margin value for float option in figure 
environment.


The marginfigure environment is proposed by the LateX sidenotes package 
and is commonly used in book editions. I needed it to edit with 
EmacsOrgmode a book with the Tufte-book class. I could use this new 
export properly and I now want to propose it to the OrgMode users.


Please tell me if the submission procedure is correct,

Louis Gostiaux.

>From 45f1484c390276fd714ae91ca5dcc489e9b3ef16 Mon Sep 17 00:00:00 2001
From: lgostiau 
Date: Fri, 6 Mar 2020 10:50:53 +0100
Subject: [PATCH] Included margin float value for figure environment, to be
 used with LaTeX sidenotes package

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

diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el
index c0af8157d..4d391c2fa 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") 'margin)
 			((and (plist-member attr :float) (not float)) 'nonfloat)
 			((or float
 			 (org-element-property :caption parent)
@@ -2491,6 +2492,14 @@ used as a communication channel."
 			(if center "\\centering" "")
 			comment-include image-code
 			(if caption-above-p "" caption)))
+	(`margin (format "\\begin{marginfigure}
+%s%s
+%s%s
+%s\\end{marginfigure}"
+			   (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.17.1