emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Eric Schulte <schulte.eric@gmail.com>
To: Andreas Leha <andreas.leha@med.uni-goettingen.de>
Cc: emacs-orgmode@gnu.org
Subject: Re: Exporting caption with raw results from inline source blocks
Date: Fri, 26 Apr 2013 09:34:19 -0600	[thread overview]
Message-ID: <87a9oli9vo.fsf@gmail.com> (raw)
In-Reply-To: 87fvydwjkc.fsf@med.uni-goettingen.de

[-- Attachment #1: Type: text/plain, Size: 2116 bytes --]

Andreas Leha <andreas.leha@med.uni-goettingen.de> writes:

> John Hendy <jw.hendy@gmail.com> writes:
>
>> On Fri, Apr 26, 2013 at 6:49 AM, Andreas Leha
>> <andreas.leha@med.uni-goettingen.de> wrote:
>>> Andreas Leha <andreas.leha@med.uni-goettingen.de> 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.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: no-caption.org --]
[-- Type: text/x-org, Size: 356 bytes --]

#+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]]

[-- Attachment #3: Type: text/plain, Size: 470 bytes --]


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

  parent reply	other threads:[~2013-04-26 15:59 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-24  7:33 Exporting caption with raw results from inline source blocks Andreas Leha
2013-04-26 11:49 ` Andreas Leha
2013-04-26 12:28   ` John Hendy
2013-04-26 12:41     ` Andreas Leha
2013-04-26 12:56       ` John Hendy
2013-04-26 15:34       ` Eric Schulte [this message]
2013-04-26 15:44         ` Eric Schulte
2013-04-26 19:56         ` Nicolas Goaziou
2013-04-26 20:20           ` Eric Schulte
2013-04-27  6:30             ` Sebastien Vauban
2013-04-27 11:18               ` Andreas Leha

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=87a9oli9vo.fsf@gmail.com \
    --to=schulte.eric@gmail.com \
    --cc=andreas.leha@med.uni-goettingen.de \
    --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).