From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Schulte Subject: Re: Exporting caption with raw results from inline source blocks Date: Fri, 26 Apr 2013 09:34:19 -0600 Message-ID: <87a9oli9vo.fsf@gmail.com> References: <87ehe0xu10.fsf@med.uni-goettingen.de> <87k3npwlym.fsf@med.uni-goettingen.de> <87fvydwjkc.fsf@med.uni-goettingen.de> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([208.118.235.92]:41621) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UVl42-00085K-3i for emacs-orgmode@gnu.org; Fri, 26 Apr 2013 11:59:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UVkfB-0006Mi-Mj for emacs-orgmode@gnu.org; Fri, 26 Apr 2013 11:34:59 -0400 Received: from mail-pd0-f177.google.com ([209.85.192.177]:60566) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UVkfB-0006MK-CY for emacs-orgmode@gnu.org; Fri, 26 Apr 2013 11:34:17 -0400 Received: by mail-pd0-f177.google.com with SMTP id p11so2480067pdj.8 for ; Fri, 26 Apr 2013 08:34:16 -0700 (PDT) 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: Andreas Leha Cc: emacs-orgmode@gnu.org --=-=-= Content-Type: text/plain Andreas Leha writes: > John Hendy writes: > >> On Fri, Apr 26, 2013 at 6:49 AM, Andreas Leha >> wrote: >>> Andreas Leha writes: >>> >>>> Hi all, >>>> >>>> I am experiencing problems when exporting a document with inline source >>>> blocks in captions, when I want to export raw results. >>>> >>>> I guess the culprit are the 'raw' results. What should I do instead? >>>> >>>> Here is a MWE that does not export properly to LaTeX: >>>> >>>> >>>> #+PROPERTY: exports results >>>> #+PROPERTY: results raw >>>> >>>> * Caption with inline source >>>> >>>> #+name: theplot >>>> #+begin_src R :results graphics :file someplot.pdf >>>> plot(1:(10+1), 1:(10+1)) >>>> #+end_src >>>> >>>> #+caption: There are src_R{10+1} points in this plot >>>> #+results: theplot >>>> [[file:someplot.pdf]] >>>> >> >> Do you need raw results? It works for me if I just remove the >> =#+PROPERTY: results raw= line. I'm wondering if that property and the >> =:results graphics= in your code block conflict? >> >> My file: >> >> >> #+PROPERTY: exports results >> >> >> * Caption with inline source >> >> >> #+name: theplot >> #+begin_src R :results graphics :file someplot.pdf >> >> plot(1:(10+1), 1:(10+1)) >> #+end_src >> >> >> #+caption: There are src_R{10+1} points in this plot >> #+results: theplot >> >> [[file:someplot.pdf]] >> >> PDF output attached. With the results raw property line, I got goofy >> caption alignment and it just said "points in this plot" instead of >> the full line. >> >> > > Hi John, > > thanks for testing. You see the same behaviour that I see. This is a > bug, IMO. > Well, this may not be desirable behavior, but everything is operating according to the spec. Execute your inline code block manually, and you'll see exactly what is happening during export. The R code returns (as a "raw" result) the following string "11\n". When that string is inserted into the caption, the newline breaks the caption. The following example by contrast does work as expected. --=-=-= Content-Type: text/x-org Content-Disposition: inline; filename=no-caption.org #+PROPERTY: exports results #+PROPERTY: results raw * Caption lost at export #+name: theplot #+begin_src R :results graphics :file someplot.pdf plot(1:(10+1), 1:(10+1)) #+end_src Execute the following manually to see what happened at export. #+caption: There are src_sh{echo -n $((10+1))} points in this plot #+results: theplot [[file:someplot.pdf]] --=-=-= Content-Type: text/plain I'm loath to add /another/ results keyword, but perhaps it would be nice to be able to specify that you want the results processed (e.g, stripping the newline), but you don't want them to be wrapped as an example. An alternate approach which may be preferable would be to expose a defcustom along the lines of org-babel-inline-result-wrapper, which could be used by org-babel-examplize-region instead of "=%s=". Regards, -- Eric Schulte http://cs.unm.edu/~eschulte --=-=-=--