emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Pablo Palazon <pablo.palazon@gmail.com>
To: emacs-orgmode@gnu.org
Subject: [PATCH] Add margin option to float for figure in ox-latex.el
Date: Thu, 14 May 2020 18:06:44 +0200	[thread overview]
Message-ID: <CAOKwhjswgMvE4jkTXgMeEg7G9s9R2jkJf==Zt=dew1PJcdt2Eg@mail.gmail.com> (raw)


[-- 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


             reply	other threads:[~2020-05-14 16:07 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-14 16:06 Pablo Palazon [this message]
2020-05-15 12:21 ` [PATCH] Add margin option to float for figure in ox-latex.el 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAOKwhjswgMvE4jkTXgMeEg7G9s9R2jkJf==Zt=dew1PJcdt2Eg@mail.gmail.com' \
    --to=pablo.palazon@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).