emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nick Dokos <nicholas.dokos@hp.com>
To: Li Bowen <a0050726@nus.edu.sg>
Cc: emacs-orgmode <emacs-orgmode@gnu.org>
Subject: Re: org-babel src block generated graphics included twice if CAPTION is added
Date: Sun, 17 Mar 2013 18:21:29 -0400	[thread overview]
Message-ID: <4211.1363558889@alphaville> (raw)
In-Reply-To: Message from Li Bowen <a0050726@nus.edu.sg> of "Sun, 17 Mar 2013 21:10:02 +0800." <87obei18b9.fsf@nus.edu.sg>

Li Bowen <a0050726@nus.edu.sg> wrote:

> Hi, 
> 
> If #+CAPTION is added, the figure will be included in the exported pdf
> file twice. 
> 
> #+begin_src R :exports both :results graphics :file img.pdf
> hist(rnorm(100))
> #+end_src
> 
> #+CAPTION: Some description
> #+RESULTS:
> [[file:img.pdf]
> 
> Many thanks.
> 

I think the problem is that the code block does not "see" the previously
produced #RESULTS: (because of the intervening #CAPTION:), so when run
again it adds another #RESULTS: section.

I think the best way to deal with problems like this is to name your code blocks
(and results blocks).

Try the following:

--8<---------------cut here---------------start------------->8---
#+name: foo
#+begin_src R :exports both :results graphics :file img.pdf
hist(rnorm(100))
#+end_src

#+CAPTION: Some description
#+RESULTS: foo
[[file:img.pdf]]
--8<---------------cut here---------------end--------------->8---

Does it solve the problem?

Nick

  parent reply	other threads:[~2013-03-17 22:21 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <a0050726@nus.edu.sg>
2013-03-17 13:10 ` org-babel src block generated graphics included twice if CAPTION is added Li Bowen
2013-03-17 22:08   ` Jay Kerns
2013-03-17 22:21   ` Nick Dokos [this message]
2013-03-17 23:20     ` Jay Kerns
2013-03-18  0:32       ` John Hendy
2013-03-18  0:59         ` Eric Schulte
2013-03-18  6:38           ` Achim Gratz
2013-03-18 12:23             ` Eric Schulte
     [not found]         ` <87620pcxuo.fsf@nus.edu.sg>
2013-03-18  2:53           ` John Hendy

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=4211.1363558889@alphaville \
    --to=nicholas.dokos@hp.com \
    --cc=a0050726@nus.edu.sg \
    --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).