From: "Jérémy Compostella" <jeremy.compostella@gmail.com>
To: Jambunathan K <kjambunathan@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: [odt] [PATCH] Anchoring image to a page
Date: Thu, 24 Nov 2011 22:31:19 +0100 [thread overview]
Message-ID: <86zkflxl5k.fsf@gmail.com> (raw)
In-Reply-To: <817h2pxodk.fsf_-_@gmail.com> (Jambunathan K.'s message of "Fri, 25 Nov 2011 01:51:43 +0530")
Jambunathan K <kjambunathan@gmail.com> writes:
> Jeremy
>
>> What about the second patch ? I'm very interested in seeing it
>> merged.
>
> I did a quick run of the attached patch (authored by you).
>
> When I do this:
>
> #+ATTR_ODT: :anchor page
> [[./org-mode-unicorn.png]]
>
> I see that the image is anchored to the page as expected. But the moment
> I attach a caption and label to it like this:
>
> #+CAPTION: caption
> #+LABEL: label
> #+ATTR_ODT: :anchor page
> [[./org-mode-unicorn.png]]
>
> the image is no longer anchored to the page. I need to make additional
> modifications to achieve the desired effect for captioned images. (Let
> me do this modification myself.)
OK.
> I am wondering what your use case is. For example, when someone does
> this:
>
> #+ATTR_ODT: :anchor page
> [[./org-mode-unicorn.png]]
>
> some text
>
> #+ATTR_ODT: :anchor page
> [[./org-mode-unicorn.png]]
>
> what do you think should be the desired behaviour. Practically, I see
> that the images get super-posed one on top of the other on the same page
> (i.e, effectively I see only one image). I am wondering what the trick
> is to embed multiple page anchored images in the document.
You get the "correct" behavior :) The trick is : you write text and text
and text. Sometimes, you want to add a picture but you don't want a page
break. For example, you want to add a big illustration. To render
correctly, the picture needs its own page but you don't want to break
the page. In this case you need to anchor the picture to the "page". I
made an example based on the road book I'm working on :
http://www.jerryland.fr/tatw/WorldTrip.odt. Quick example visible on
pages 20 and 23. For information, the first map inclusion was at the
beginning of 2.1.1 and the second map inclusion at the beginning of
2.3.1.
Obviously if you anchor consecutively two pictures to the "same page",
you could be disappointed by the result but it's an issue you have to
address with some others parameters which I do not know actually.
Finally the patch I was talking about is not this one but the one
attached to http://comments.gmane.org/gmane.emacs.orgmode/49548. I
really need it because this bug lead to at least 50 seconds more to
generate my ODT file.
> From 213cfc2a9c44a93639afe460fe2f8dbee793bcd1 Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Compostella?= <jeremy.compostella@gmail.com>
> Date: Fri, 18 Nov 2011 16:39:17 +0100
> Subject: [PATCH] org-odt.el: Add page anchor image type support.
>
> This patch enables :
> - The possibility to select the image anchor type with the ATTR_ODT tag
> - The "page" anchor type
> This patch is very useful to get "floating pictures".
> ---
> contrib/lisp/org-odt.el | 15 +++++++++------
> contrib/odt/styles/OrgOdtStyles.xml | 5 +++++
> 2 files changed, 14 insertions(+), 6 deletions(-)
>
> diff --git a/contrib/lisp/org-odt.el b/contrib/lisp/org-odt.el
> index 81abf5d..1d60b13 100644
> --- a/contrib/lisp/org-odt.el
> +++ b/contrib/lisp/org-odt.el
> @@ -1495,12 +1495,12 @@ ATTR is a string of other attributes of the a element."
> (latex-frag (org-find-text-property-in-string
> 'org-latex-src src))
> (category (and latex-frag "__DvipngImage__"))
> - (embed-as (or embed-as
> - (if latex-frag
> - (or (org-find-text-property-in-string
> - 'org-latex-src-embed-type src) 'character)
> - 'paragraph)))
> (attr-plist (org-lparse-get-block-params attr))
> + (embed-as (cond (embed-as)
> + (latex-frag (or (org-find-text-property-in-string
> + 'org-latex-src-embed-type src) 'character))
> + ((plist-get attr-plist :anchor))
> + ('paragraph)))
> (size (org-odt-image-size-from-file
> src (plist-get attr-plist :width)
> (plist-get attr-plist :height)
> @@ -1514,6 +1514,7 @@ ATTR is a string of other attributes of the a element."
> (case embed-as
> (paragraph (org-odt-format-entity "DisplayImage" href width height))
> (character (org-odt-format-entity "InlineImage" href width height))
> + (page (org-odt-format-entity "PageImage" href width height))
> (t (error "Unknown value for embed-as %S" embed-as))))
> (t
> (org-odt-format-entity
> @@ -1565,6 +1566,7 @@ ATTR is a string of other attributes of the a element."
> (defvar org-odt-entity-frame-styles
> '(("InlineImage" "__Figure__" ("OrgInlineImage" nil "as-char"))
> ("DisplayImage" "__Figure__" ("OrgDisplayImage" nil "paragraph"))
> + ("PageImage" "__Figure__" ("OrgPageImage" nil "page"))
> ("CaptionedDisplayImage" "__Figure__"
> ("OrgCaptionedImage"
> " style:rel-width=\"100%\" style:rel-height=\"scale\"" "paragraph")
> @@ -1619,7 +1621,8 @@ ATTR is a string of other attributes of the a element."
>
> (defvar org-export-odt-default-image-sizes-alist
> '(("character" . (5 . 0.4))
> - ("paragraph" . (5 . 5)))
> + ("paragraph" . (5 . 5))
> + ("page" . (5 . 5)))
> "Hardcoded image dimensions one for each of the anchor
> methods.")
>
> diff --git a/contrib/odt/styles/OrgOdtStyles.xml b/contrib/odt/styles/OrgOdtStyles.xml
> index 5ec868a..df4f3f4 100644
> --- a/contrib/odt/styles/OrgOdtStyles.xml
> +++ b/contrib/odt/styles/OrgOdtStyles.xml
> @@ -375,6 +375,11 @@
> <style:graphic-properties text:anchor-type="paragraph" style:wrap="none" style:vertical-pos="top" style:vertical-rel="paragraph" style:horizontal-pos="center" style:horizontal-rel="paragraph"/>
> </style:style>
>
> + <!-- Page Images -->
> + <style:style style:name="OrgPageImage" style:family="graphic" style:parent-style-name="Graphics">
> + <style:graphic-properties text:anchor-type="page" style:wrap="none" style:vertical-pos="middle" style:vertical-rel="page" style:horizontal-pos="center" style:horizontal-rel="page"/>
> + </style:style>
> +
> <!-- Captioned Images -->
> <style:style style:name="OrgCaptionedImage" style:family="graphic" style:parent-style-name="Graphics">
> <style:graphic-properties style:rel-width="100%" text:anchor-type="paragraph" fo:margin-left="0cm" fo:margin-right="0cm" fo:margin-top="0cm" fo:margin-bottom="0cm" style:run-through="foreground" style:wrap="none" style:vertical-pos="from-top" style:vertical-rel="paragraph-content" style:horizontal-pos="from-left" style:horizontal-rel="paragraph-content" fo:padding="0cm" fo:border="none" style:shadow="none"/>
> --
> 1.7.5.4
--
Sent from my Emacs
next prev parent reply other threads:[~2011-11-24 21:31 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-24 15:56 [PATCH] org-babel-exp-lob-one-liners should not parse the entire buffer Jérémy Compostella
2011-11-24 18:28 ` Jambunathan K
2011-11-24 19:40 ` Jérémy Compostella
2011-11-24 20:21 ` [odt] [PATCH] Anchoring image to a page Jambunathan K
2011-11-24 21:31 ` Jérémy Compostella [this message]
2011-12-26 11:01 ` Jambunathan K
2011-11-25 16:33 ` [PATCH] org-babel-exp-lob-one-liners should not parse the entire buffer Eric Schulte
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=86zkflxl5k.fsf@gmail.com \
--to=jeremy.compostella@gmail.com \
--cc=emacs-orgmode@gnu.org \
--cc=kjambunathan@gmail.com \
/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).