* org-babel src block generated graphics included twice if CAPTION is added @ 2013-03-17 13:10 ` Li Bowen 2013-03-17 22:08 ` Jay Kerns 2013-03-17 22:21 ` Nick Dokos 0 siblings, 2 replies; 9+ messages in thread From: Li Bowen @ 2013-03-17 13:10 UTC (permalink / raw) To: emacs-orgmode 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. -- Sincerely, Li Bowen. ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: org-babel src block generated graphics included twice if CAPTION is added 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 1 sibling, 0 replies; 9+ messages in thread From: Jay Kerns @ 2013-03-17 22:08 UTC (permalink / raw) To: Li Bowen; +Cc: emacs-orgmode Greetings Li, On Sun, Mar 17, 2013 at 9:10 AM, 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] > For that particular example maybe the quickest way to get rid of the extra figure (that is caption-less) would be to use ":exports code" instead of ":exports both". I hope this helps, -- Jay ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: org-babel src block generated graphics included twice if CAPTION is added 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 2013-03-17 23:20 ` Jay Kerns 1 sibling, 1 reply; 9+ messages in thread From: Nick Dokos @ 2013-03-17 22:21 UTC (permalink / raw) To: Li Bowen; +Cc: emacs-orgmode 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 ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: org-babel src block generated graphics included twice if CAPTION is added 2013-03-17 22:21 ` Nick Dokos @ 2013-03-17 23:20 ` Jay Kerns 2013-03-18 0:32 ` John Hendy 0 siblings, 1 reply; 9+ messages in thread From: Jay Kerns @ 2013-03-17 23:20 UTC (permalink / raw) To: nicholas.dokos; +Cc: emacs-orgmode, Li Bowen On Sun, Mar 17, 2013 at 6:21 PM, Nick Dokos <nicholas.dokos@hp.com> wrote: [snip] > I think the best way to deal with problems like this is to name your code blocks (and results blocks). > [snip] I can't speak for Li, but it works on my system and I like Nick's solution better than mine. Cheers, -- Jay ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: org-babel src block generated graphics included twice if CAPTION is added 2013-03-17 23:20 ` Jay Kerns @ 2013-03-18 0:32 ` John Hendy 2013-03-18 0:59 ` Eric Schulte [not found] ` <87620pcxuo.fsf@nus.edu.sg> 0 siblings, 2 replies; 9+ messages in thread From: John Hendy @ 2013-03-18 0:32 UTC (permalink / raw) To: Jay Kerns; +Cc: Li Bowen, nicholas.dokos, emacs-orgmode On Sun, Mar 17, 2013 at 6:20 PM, Jay Kerns <gjkernsysu@gmail.com> wrote: > On Sun, Mar 17, 2013 at 6:21 PM, Nick Dokos <nicholas.dokos@hp.com> wrote: > > [snip] > >> I think the best way to deal with problems like this is to name your code blocks (and results blocks). >> > > [snip] > > I can't speak for Li, but it works on my system and I like Nick's > solution better than mine. This is my preferred syntax as well. This has come up before on the list; essentially any #+options syntax before an un-named #+results block will cause the results to be re-inserted. #+begin_center or any #+attr_backend options result in the same duplicate insertion of results. Also, just in case it's not known, you don't have to manually name the #+results block. Just create your babel block with a #+name: attribute and when you run it with C-c C-c, a named #+result will automatically be created. John > > Cheers, > > -- > Jay > ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: org-babel src block generated graphics included twice if CAPTION is added 2013-03-18 0:32 ` John Hendy @ 2013-03-18 0:59 ` Eric Schulte 2013-03-18 6:38 ` Achim Gratz [not found] ` <87620pcxuo.fsf@nus.edu.sg> 1 sibling, 1 reply; 9+ messages in thread From: Eric Schulte @ 2013-03-18 0:59 UTC (permalink / raw) To: John Hendy; +Cc: Li Bowen, nicholas.dokos, Jay Kerns, emacs-orgmode I just pushed up a patch which should allow code blocks to find un-named results even when there are comment lines (such as #+options or #+attr_backend) between the code block and the results. Hope this helps, John Hendy <jw.hendy@gmail.com> writes: > On Sun, Mar 17, 2013 at 6:20 PM, Jay Kerns <gjkernsysu@gmail.com> wrote: >> On Sun, Mar 17, 2013 at 6:21 PM, Nick Dokos <nicholas.dokos@hp.com> wrote: >> >> [snip] >> >>> I think the best way to deal with problems like this is to name your code blocks (and results blocks). >>> >> >> [snip] >> >> I can't speak for Li, but it works on my system and I like Nick's >> solution better than mine. > > This is my preferred syntax as well. This has come up before on the > list; essentially any #+options syntax before an un-named #+results > block will cause the results to be re-inserted. #+begin_center or any > #+attr_backend options result in the same duplicate insertion of > results. > > > Also, just in case it's not known, you don't have to manually name the > #+results block. Just create your babel block with a #+name: attribute > and when you run it with C-c C-c, a named #+result will automatically > be created. > > John > >> >> Cheers, >> >> -- >> Jay >> > -- Eric Schulte http://cs.unm.edu/~eschulte ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: org-babel src block generated graphics included twice if CAPTION is added 2013-03-18 0:59 ` Eric Schulte @ 2013-03-18 6:38 ` Achim Gratz 2013-03-18 12:23 ` Eric Schulte 0 siblings, 1 reply; 9+ messages in thread From: Achim Gratz @ 2013-03-18 6:38 UTC (permalink / raw) To: emacs-orgmode Eric Schulte writes: > I just pushed up a patch which should allow code blocks to find > un-named results even when there are comment lines (such as #+options > or #+attr_backend) between the code block and the results. Shouldn't babel use org-element for things like this? Regards, Achim. -- +<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+ DIY Stuff: http://Synth.Stromeko.net/DIY.html ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: org-babel src block generated graphics included twice if CAPTION is added 2013-03-18 6:38 ` Achim Gratz @ 2013-03-18 12:23 ` Eric Schulte 0 siblings, 0 replies; 9+ messages in thread From: Eric Schulte @ 2013-03-18 12:23 UTC (permalink / raw) To: Achim Gratz; +Cc: emacs-orgmode Achim Gratz <Stromeko@nexgo.de> writes: > Eric Schulte writes: >> I just pushed up a patch which should allow code blocks to find >> un-named results even when there are comment lines (such as #+options >> or #+attr_backend) between the code block and the results. > > Shouldn't babel use org-element for things like this? > Yes, and many many many other things. -- Eric Schulte http://cs.unm.edu/~eschulte ^ permalink raw reply [flat|nested] 9+ messages in thread
[parent not found: <87620pcxuo.fsf@nus.edu.sg>]
* Re: org-babel src block generated graphics included twice if CAPTION is added [not found] ` <87620pcxuo.fsf@nus.edu.sg> @ 2013-03-18 2:53 ` John Hendy 0 siblings, 0 replies; 9+ messages in thread From: John Hendy @ 2013-03-18 2:53 UTC (permalink / raw) To: Li Bowen; +Cc: emacs-orgmode, nicholas.dokos, Jay Kerns [-- Attachment #1: Type: text/plain, Size: 1839 bytes --] On Sun, Mar 17, 2013 at 8:15 PM, Li Bowen <a0050726@nus.edu.sg> wrote: > Thanks, John. > > I also noticed that #+options can lead to re-insertion. > > Your piece of instruction should go to the online documentation. It will > save people hours of time from trouble-shooting. I suppose any one who writes a report with figures using org-babel will face the same problem. I've got some other changes to make to Worg... I'll look for a place to put this as well, though Eric's patch probably makes this obsolete now! At least your post, the nth inquiry about it to the mailing list, has gotten us a patch! That counts for something! By the way, I've run into this very thing before as well :) - http://osdir.com/ml/emacs-orgmode-gnu/2012-07/msg00230.html John > > John Hendy <jw.hendy@gmail.com> writes: > >> On Sun, Mar 17, 2013 at 6:20 PM, Jay Kerns <gjkernsysu@gmail.com> wrote: >>> On Sun, Mar 17, 2013 at 6:21 PM, Nick Dokos <nicholas.dokos@hp.com> wrote: >>> >>> [snip] >>> >>>> I think the best way to deal with problems like this is to name your code blocks (and results blocks). >>>> >>> >>> [snip] >>> >>> I can't speak for Li, but it works on my system and I like Nick's >>> solution better than mine. >> >> This is my preferred syntax as well. This has come up before on the >> list; essentially any #+options syntax before an un-named #+results >> block will cause the results to be re-inserted. #+begin_center or any >> #+attr_backend options result in the same duplicate insertion of >> results. >> >> >> Also, just in case it's not known, you don't have to manually name the >> #+results block. Just create your babel block with a #+name: attribute >> and when you run it with C-c C-c, a named #+result will automatically >> be created. >> >> John >> >>> >>> Cheers, >>> >>> -- >>> Jay >>> > > -- > Sincerely, > Li Bowen. [-- Attachment #2: Type: text/html, Size: 2717 bytes --] ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2013-03-18 12:24 UTC | newest] Thread overview: 9+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- [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 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
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).