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: --8<---------------cut here---------------start------------->8--- #+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]] --8<---------------cut here---------------end--------------->8--- Best, Andreas
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]]
>
>
Is it just me, or can someone reproduce this?
Regards,
Andreas
[-- Attachment #1: Type: text/plain, Size: 1471 bytes --] 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. Best regards, John >> > > > Is it just me, or can someone reproduce this? > > Regards, > Andreas > > [-- Attachment #2: test.pdf --] [-- Type: application/pdf, Size: 55294 bytes --]
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.
Do I need the raw results? Well, it only differs in the typeface, so I
can hardly say, I 'need' them. But in longer and more elaborate
captions as for scientific publications, the results should appear as
ordinary text, I think.
Thanks again for the confirmation.
Best,
Andreas
On Fri, Apr 26, 2013 at 7:41 AM, Andreas Leha <andreas.leha@med.uni-goettingen.de> wrote: > 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. > > Do I need the raw results? Well, it only differs in the typeface, so I > can hardly say, I 'need' them. But in longer and more elaborate > captions as for scientific publications, the results should appear as > ordinary text, I think. > I don't get anything with =:results output raw= even from a normal block... #+begin_src R :results output raw :exports results 10+1 #+end_src #+RESULTS: [1] 11 That exports a blank LaTeX document for me: \section*{Caption with inline source} \label{sec-1} % Emacs 24.3.1 (Org mode 8.0.1) \end{document} Perhaps that's the problem? There was some discussion recently about the point of raw results; This makes me wonder if it was removed? If I change to =:results value= and add =:wrap latex= above, I get regular text exported (not inside =\texttt=). It doesn't seem that =:wrap latex= works for inline blocks, though? John > Thanks again for the confirmation. > > Best, > Andreas > >
[-- 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
[-- Attachment #1: Type: text/plain, Size: 523 bytes --] > 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=". > I think this is a good idea. I've just pushed up a patch which exposes a new defcustom named `org-babel-inline-result-wrap'. If you set this to say the following. ;; emacs-lisp (setq org-babel-inline-result-wrap "$%s$") Then you original example will work as expected, exporting the following Org-mode, [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: no-caption.org --] [-- Type: text/x-org, Size: 278 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 #+caption: There are src_R{10+1} points in this plot #+results: theplot [[file:someplot.pdf]] [-- Attachment #3: Type: text/plain, Size: 25 bytes --] to the following latex [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #4: no-caption.tex --] [-- Type: text/x-tex, Size: 801 bytes --] % Created 2013-04-26 Fri 09:43 \documentclass[11pt]{article} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage{fixltx2e} \usepackage{graphicx} \usepackage{longtable} \usepackage{float} \usepackage{wrapfig} \usepackage{soul} \usepackage{textcomp} \usepackage{marvosym} \usepackage{wasysym} \usepackage{latexsym} \usepackage{amssymb} \usepackage{hyperref} \tolerance=1000 \date{\today} \title{} \hypersetup{ pdfkeywords={}, pdfsubject={}, pdfcreator={Emacs 24.3.1 (Org mode 8.0-pre)}} \begin{document} \tableofcontents \section[Caption lost at export]{Caption lost at export} \label{sec-1} \begin{figure}[htb] \centering \includegraphics[width=.9\linewidth]{someplot.pdf} \caption{There are $11$ points in this plot} \end{figure} % Emacs 24.3.1 (Org mode 8.0-pre) \end{document} [-- Attachment #5: Type: text/plain, Size: 46 bytes --] -- Eric Schulte http://cs.unm.edu/~eschulte
Hello,
Eric Schulte <schulte.eric@gmail.com> writes:
> 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=".
What about always removing trailing newline characters in _inline_ src
blocks results?
Regards,
--
Nicolas Goaziou
Nicolas Goaziou <n.goaziou@gmail.com> writes: > Hello, > > Eric Schulte <schulte.eric@gmail.com> writes: > >> 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=". > > What about always removing trailing newline characters in _inline_ src > blocks results? > That is certainly an option. It could be argued that the point of "raw" is to not change the output at all, and sometimes people use (abuse) inline results expecting to be able to have them insert multi-line results (e.g., they support tabular output). There are a number of solutions here which I personally would be happy with. -- Eric Schulte http://cs.unm.edu/~eschulte
Hi Eric, Eric Schulte wrote: > Nicolas Goaziou <n.goaziou-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes: >> Eric Schulte <schulte.eric-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes: >> >>> 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=". >> >> What about always removing trailing newline characters in _inline_ src >> blocks results? > > That is certainly an option. It could be argued that the point of "raw" > is to not change the output at all That was one point I tried to attract attention onto: since short, we already modify the "raw" output (by "cycling" on tables-alike results). We don't have anymore a real "raw" results which would completely stay untouched. > and sometimes people use (abuse) inline results expecting to be able to have > them insert multi-line results (e.g., they support tabular output). > > There are a number of solutions here which I personally would be happy > with. Best regards, Seb -- Sebastien Vauban
"Sebastien Vauban" <sva-news@mygooglest.com>
writes:
> Hi Eric,
>
> Eric Schulte wrote:
>> Nicolas Goaziou <n.goaziou@gmail.com> writes:
>>> Eric Schulte <schulte.eric@gmail.com> writes:
>>>
>>>> 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=".
>>>
>>> What about always removing trailing newline characters in _inline_ src
>>> blocks results?
>>
>> That is certainly an option. It could be argued that the point of "raw"
>> is to not change the output at all
>
> That was one point I tried to attract attention onto: since short, we already
> modify the "raw" output (by "cycling" on tables-alike results). We don't have
> anymore a real "raw" results which would completely stay untouched.
>
I'd also vote for not modifying raw results -- at least in the inline
case.
In the case of the added linebreak, I think it is easy to add from
inside the code block it if I want it, but hard to remove. For me it
seems really weird that I have to post-process a 'raw' result to get a
'really raw' result.
Also the added newline is inconsistent with the non-raw result, which
gets exported as \texttt{11} and not \texttt{11\\}.
And the added '\n' breaks (at least) inline results in captions.
Does not adding the '\n' break anything at all?
Having said all that, I am also ok with the org-babel-inline-result-wrap
defcustom. Thanks for implementing that, Eric.
Regards,
Andreas