emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [babel] Replace results with ascii package caption
@ 2012-03-05 16:48 Thomas S. Dye
  2012-03-05 17:03 ` Eric Schulte
  0 siblings, 1 reply; 5+ messages in thread
From: Thomas S. Dye @ 2012-03-05 16:48 UTC (permalink / raw)
  To: emacs-orgmode

Aloha all,

The code block at the bottom appends its results, rather than replacing
them.  Here are the header arguments:

Name: test-replace-results
Lang: R
Header Arguments:
	:cache		no
	:exports	code
	:hlines		no
	:noweb		yes
	:padnewline	yes
	:results	raw output replace
	:session	none
	:tangle		no

Everything works fine without the ascii package caption argument.
 
* Babel replace results
#+name: test-replace-results
#+header: :results output raw
#+BEGIN_SRC R
library(ascii)
cap <- "Test replace results"
x <- runif(100)
y <- ascii(quantile(x),include.colnames=T,header=T,caption=cap)
print(y,type="org")
rm(cap,x,y)
#+END_SRC

#+RESULTS: test-replace-results
#+CAPTION: Test replace results
| 0%   | 25%  | 50%  | 75%  | 100% |
|------+------+------+------+------|
| 0.02 | 0.28 | 0.49 | 0.78 | 0.98 |
#+CAPTION: Test replace results
| 0%   | 25%  | 50%  | 75%  | 100% |
|------+------+------+------+------|
| 0.01 | 0.21 | 0.44 | 0.76 | 1.00 |

I'm using Org-mode version 7.8.03 (release_7.8.03.546.gf6ea).

All the best,
Tom
-- 
Thomas S. Dye
http://www.tsdye.com

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [babel] Replace results with ascii package caption
  2012-03-05 16:48 [babel] Replace results with ascii package caption Thomas S. Dye
@ 2012-03-05 17:03 ` Eric Schulte
  2012-03-05 17:25   ` Thomas S. Dye
  0 siblings, 1 reply; 5+ messages in thread
From: Eric Schulte @ 2012-03-05 17:03 UTC (permalink / raw)
  To: Thomas S. Dye; +Cc: emacs-orgmode

Would it be possible to swap the results and caption lines?

e.g., this

> #+RESULTS: test-replace-results
> #+CAPTION: Test replace results
> | 0%   | 25%  | 50%  | 75%  | 100% |
> |------+------+------+------+------|
> | 0.02 | 0.28 | 0.49 | 0.78 | 0.98 |

to this

> #+CAPTION: Test replace results
> #+RESULTS: test-replace-results
> | 0%   | 25%  | 50%  | 75%  | 100% |
> |------+------+------+------+------|
> | 0.02 | 0.28 | 0.49 | 0.78 | 0.98 |

everything following #+results is expected to be part of the results,
and it would be simpler to not add special cases to this behavior for
lines that look like Org-mode comment constructs.

Best,

tsd@tsdye.com (Thomas S. Dye) writes:

> Aloha all,
>
> The code block at the bottom appends its results, rather than replacing
> them.  Here are the header arguments:
>
> Name: test-replace-results
> Lang: R
> Header Arguments:
> 	:cache		no
> 	:exports	code
> 	:hlines		no
> 	:noweb		yes
> 	:padnewline	yes
> 	:results	raw output replace
> 	:session	none
> 	:tangle		no
>
> Everything works fine without the ascii package caption argument.
>  
> * Babel replace results
> #+name: test-replace-results
> #+header: :results output raw
> #+BEGIN_SRC R
> library(ascii)
> cap <- "Test replace results"
> x <- runif(100)
> y <- ascii(quantile(x),include.colnames=T,header=T,caption=cap)
> print(y,type="org")
> rm(cap,x,y)
> #+END_SRC
> #+RESULTS: test-replace-results
> #+CAPTION: Test replace results
> | 0%   | 25%  | 50%  | 75%  | 100% |
> |------+------+------+------+------|
> | 0.02 | 0.28 | 0.49 | 0.78 | 0.98 |
> #+CAPTION: Test replace results
> | 0%   | 25%  | 50%  | 75%  | 100% |
> |------+------+------+------+------|
> | 0.01 | 0.21 | 0.44 | 0.76 | 1.00 |
>
> I'm using Org-mode version 7.8.03 (release_7.8.03.546.gf6ea).
>
> All the best,
> Tom

-- 
Eric Schulte
http://cs.unm.edu/~eschulte/

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [babel] Replace results with ascii package caption
  2012-03-05 17:03 ` Eric Schulte
@ 2012-03-05 17:25   ` Thomas S. Dye
  2012-03-05 17:43     ` Eric Schulte
  0 siblings, 1 reply; 5+ messages in thread
From: Thomas S. Dye @ 2012-03-05 17:25 UTC (permalink / raw)
  To: Eric Schulte; +Cc: emacs-orgmode

Hi Eric,

Eric Schulte <eric.schulte@gmx.com> writes:

> Would it be possible to swap the results and caption lines?

The caption lines are part of the ascii output.  I think I'd have to
swap them manually.
>
> e.g., this
>
>> #+RESULTS: test-replace-results
>> #+CAPTION: Test replace results
>> | 0%   | 25%  | 50%  | 75%  | 100% |
>> |------+------+------+------+------|
>> | 0.02 | 0.28 | 0.49 | 0.78 | 0.98 |
>
> to this
>
>> #+CAPTION: Test replace results
>> #+RESULTS: test-replace-results
>> | 0%   | 25%  | 50%  | 75%  | 100% |
>> |------+------+------+------+------|
>> | 0.02 | 0.28 | 0.49 | 0.78 | 0.98 |
>
> everything following #+results is expected to be part of the results,
> and it would be simpler to not add special cases to this behavior for
> lines that look like Org-mode comment constructs.
>

This is an interesting case.  As other packages start to provide Org
Mode output this kind of problem might crop up again.  Is there any
limit to the Org Mode output a third party might produce?

All the best,
Tom

> Best,
>
> tsd@tsdye.com (Thomas S. Dye) writes:
>
>> Aloha all,
>>
>> The code block at the bottom appends its results, rather than replacing
>> them.  Here are the header arguments:
>>
>> Name: test-replace-results
>> Lang: R
>> Header Arguments:
>> 	:cache		no
>> 	:exports	code
>> 	:hlines		no
>> 	:noweb		yes
>> 	:padnewline	yes
>> 	:results	raw output replace
>> 	:session	none
>> 	:tangle		no
>>
>> Everything works fine without the ascii package caption argument.
>>  
>> * Babel replace results
>> #+name: test-replace-results
>> #+header: :results output raw
>> #+BEGIN_SRC R
>> library(ascii)
>> cap <- "Test replace results"
>> x <- runif(100)
>> y <- ascii(quantile(x),include.colnames=T,header=T,caption=cap)
>> print(y,type="org")
>> rm(cap,x,y)
>> #+END_SRC
>> #+RESULTS: test-replace-results
>> #+CAPTION: Test replace results
>> | 0%   | 25%  | 50%  | 75%  | 100% |
>> |------+------+------+------+------|
>> | 0.02 | 0.28 | 0.49 | 0.78 | 0.98 |
>> #+CAPTION: Test replace results
>> | 0%   | 25%  | 50%  | 75%  | 100% |
>> |------+------+------+------+------|
>> | 0.01 | 0.21 | 0.44 | 0.76 | 1.00 |
>>
>> I'm using Org-mode version 7.8.03 (release_7.8.03.546.gf6ea).
>>
>> All the best,
>> Tom

-- 
Thomas S. Dye
http://www.tsdye.com

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [babel] Replace results with ascii package caption
  2012-03-05 17:25   ` Thomas S. Dye
@ 2012-03-05 17:43     ` Eric Schulte
  2012-03-05 17:56       ` Thomas S. Dye
  0 siblings, 1 reply; 5+ messages in thread
From: Eric Schulte @ 2012-03-05 17:43 UTC (permalink / raw)
  To: Thomas S. Dye; +Cc: emacs-orgmode

tsd@tsdye.com (Thomas S. Dye) writes:

> Hi Eric,
>
> Eric Schulte <eric.schulte@gmx.com> writes:
>
>> Would it be possible to swap the results and caption lines?
>
> The caption lines are part of the ascii output.  I think I'd have to
> swap them manually.

I didn't realize that this was being produced by an external package
called from the code block.  If this is the case then the package itself
will need a special setting for appending results so that it doesn't
output a caption line.

[...]
>
> This is an interesting case.  As other packages start to provide Org
> Mode output this kind of problem might crop up again.  Is there any
> limit to the Org Mode output a third party might produce?
>

There need be no limit on what types of results are output by code
blocks.  You could always use ":results org" to wrap the results in an
Org-mode block to make the extent of the results clear regardless of
their contents.

Best,

>
> All the best,
> Tom
>
>> Best,
>>
>> tsd@tsdye.com (Thomas S. Dye) writes:
>>
>>> Aloha all,
>>>
>>> The code block at the bottom appends its results, rather than replacing
>>> them.  Here are the header arguments:
>>>
>>> Name: test-replace-results
>>> Lang: R
>>> Header Arguments:
>>> 	:cache		no
>>> 	:exports	code
>>> 	:hlines		no
>>> 	:noweb		yes
>>> 	:padnewline	yes
>>> 	:results	raw output replace
>>> 	:session	none
>>> 	:tangle		no
>>>
>>> Everything works fine without the ascii package caption argument.
>>>  
>>> * Babel replace results
>>> #+name: test-replace-results
>>> #+header: :results output raw
>>> #+BEGIN_SRC R
>>> library(ascii)
>>> cap <- "Test replace results"
>>> x <- runif(100)
>>> y <- ascii(quantile(x),include.colnames=T,header=T,caption=cap)
>>> print(y,type="org")
>>> rm(cap,x,y)
>>> #+END_SRC
>>> #+RESULTS: test-replace-results
>>> #+CAPTION: Test replace results
>>> | 0%   | 25%  | 50%  | 75%  | 100% |
>>> |------+------+------+------+------|
>>> | 0.02 | 0.28 | 0.49 | 0.78 | 0.98 |
>>> #+CAPTION: Test replace results
>>> | 0%   | 25%  | 50%  | 75%  | 100% |
>>> |------+------+------+------+------|
>>> | 0.01 | 0.21 | 0.44 | 0.76 | 1.00 |
>>>
>>> I'm using Org-mode version 7.8.03 (release_7.8.03.546.gf6ea).
>>>
>>> All the best,
>>> Tom

-- 
Eric Schulte
http://cs.unm.edu/~eschulte/

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [babel] Replace results with ascii package caption
  2012-03-05 17:43     ` Eric Schulte
@ 2012-03-05 17:56       ` Thomas S. Dye
  0 siblings, 0 replies; 5+ messages in thread
From: Thomas S. Dye @ 2012-03-05 17:56 UTC (permalink / raw)
  To: Eric Schulte; +Cc: emacs-orgmode

Eric Schulte <eric.schulte@gmx.com> writes:

> tsd@tsdye.com (Thomas S. Dye) writes:
>
>> Hi Eric,
>>
>> Eric Schulte <eric.schulte@gmx.com> writes:
>>
>>> Would it be possible to swap the results and caption lines?
>>
>> The caption lines are part of the ascii output.  I think I'd have to
>> swap them manually.
>
> I didn't realize that this was being produced by an external package
> called from the code block.  If this is the case then the package itself
> will need a special setting for appending results so that it doesn't
> output a caption line.
>
> [...]
>>
>> This is an interesting case.  As other packages start to provide Org
>> Mode output this kind of problem might crop up again.  Is there any
>> limit to the Org Mode output a third party might produce?
>>
>
> There need be no limit on what types of results are output by code
> blocks.  You could always use ":results org" to wrap the results in an
> Org-mode block to make the extent of the results clear regardless of
> their contents.

Thanks Eric.  This was the missing piece to my puzzle.

Tom
>
> Best,
>
>>
>> All the best,
>> Tom
>>
>>> Best,
>>>
>>> tsd@tsdye.com (Thomas S. Dye) writes:
>>>
>>>> Aloha all,
>>>>
>>>> The code block at the bottom appends its results, rather than replacing
>>>> them.  Here are the header arguments:
>>>>
>>>> Name: test-replace-results
>>>> Lang: R
>>>> Header Arguments:
>>>> 	:cache		no
>>>> 	:exports	code
>>>> 	:hlines		no
>>>> 	:noweb		yes
>>>> 	:padnewline	yes
>>>> 	:results	raw output replace
>>>> 	:session	none
>>>> 	:tangle		no
>>>>
>>>> Everything works fine without the ascii package caption argument.
>>>>  
>>>> * Babel replace results
>>>> #+name: test-replace-results
>>>> #+header: :results output raw
>>>> #+BEGIN_SRC R
>>>> library(ascii)
>>>> cap <- "Test replace results"
>>>> x <- runif(100)
>>>> y <- ascii(quantile(x),include.colnames=T,header=T,caption=cap)
>>>> print(y,type="org")
>>>> rm(cap,x,y)
>>>> #+END_SRC
>>>> #+RESULTS: test-replace-results
>>>> #+CAPTION: Test replace results
>>>> | 0%   | 25%  | 50%  | 75%  | 100% |
>>>> |------+------+------+------+------|
>>>> | 0.02 | 0.28 | 0.49 | 0.78 | 0.98 |
>>>> #+CAPTION: Test replace results
>>>> | 0%   | 25%  | 50%  | 75%  | 100% |
>>>> |------+------+------+------+------|
>>>> | 0.01 | 0.21 | 0.44 | 0.76 | 1.00 |
>>>>
>>>> I'm using Org-mode version 7.8.03 (release_7.8.03.546.gf6ea).
>>>>
>>>> All the best,
>>>> Tom

-- 
Thomas S. Dye
http://www.tsdye.com

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-03-05 17:56 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-05 16:48 [babel] Replace results with ascii package caption Thomas S. Dye
2012-03-05 17:03 ` Eric Schulte
2012-03-05 17:25   ` Thomas S. Dye
2012-03-05 17:43     ` Eric Schulte
2012-03-05 17:56       ` Thomas S. Dye

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).