From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nick Dokos Subject: Re: org-babel src block generated graphics included twice if CAPTION is added Date: Sun, 17 Mar 2013 18:21:29 -0400 Message-ID: <4211.1363558889@alphaville> References: <87obei18b9.fsf@nus.edu.sg> Reply-To: nicholas.dokos@hp.com Return-path: Received: from eggs.gnu.org ([208.118.235.92]:59388) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UHLxS-0002VQ-LF for emacs-orgmode@gnu.org; Sun, 17 Mar 2013 18:21:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UHLxR-00078P-Ib for emacs-orgmode@gnu.org; Sun, 17 Mar 2013 18:21:38 -0400 Received: from g4t0017.houston.hp.com ([15.201.24.20]:28648) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UHLxR-00076b-Bd for emacs-orgmode@gnu.org; Sun, 17 Mar 2013 18:21:37 -0400 In-Reply-To: Message from Li Bowen of "Sun, 17 Mar 2013 21:10:02 +0800." <87obei18b9.fsf@nus.edu.sg> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Li Bowen Cc: emacs-orgmode Li Bowen 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