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 <pablo.pala...@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

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

Reply via email to