emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [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 related	[flat|nested] 11+ messages in thread
[parent not found: <mailman.39.1589558407.15748.emacs-orgmode@gnu.org>]

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 --
2020-05-14 16:06 [PATCH] Add margin option to float for figure in ox-latex.el 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
     [not found] <mailman.39.1589558407.15748.emacs-orgmode@gnu.org>
2020-05-15 16:47 ` Pablo Palazon

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