emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* export: inserting text between source and its results
@ 2012-06-08  7:48 Alan Schmitt
  2012-06-08  8:57 ` Sebastien Vauban
  0 siblings, 1 reply; 3+ messages in thread
From: Alan Schmitt @ 2012-06-08  7:48 UTC (permalink / raw)
  To: emacs-orgmode Mode

Hello,

I'm writing a presentation with some source code blocks. At the moment I can easily evaluate them and have them display in a pretty way (using the :results code flag). For instance, the following

> Evaluating
> 
> #+name: with_example
> #+begin_src js :results code output :exports both
> var x = 1
> var f = function(o){ with(o){ return x } }
> var o2 = { x : 2 }
> var o3 = { x : 3 }
> console.log(f({}))
> console.log(f(o2))
> console.log(f(o3))
> #+end_src

gives me something very nice in LaTeX

> Evaluating
> 
> \begin{minted}[frame=lines,fontsize=\scriptsize]{js}
> var x = 1
> var f = function(o){ with(o){ return x } }
> var o2 = { x : 2 }
> var o3 = { x : 3 }
> console.log(f({}))
> console.log(f(o2))
> console.log(f(o3))
> \end{minted}
> 
> \begin{minted}[frame=lines,fontsize=\scriptsize]{js}
> 1
> 2
> 3
> \end{minted}
> \end{frame}

Now I would like to insert some text between the source part and the result part. For this it seems that I need to use a "call", but then I can't see how to get it to display nicely in a minted environment. Here is what I tried:

> Evaluating
> 
> #+name: with_example
> #+begin_src js :results output :exports source
> var x = 1
> var f = function(o){ with(o){ return x } }
> var o2 = { x : 2 }
> var o3 = { x : 3 }
> console.log(f({}))
> console.log(f(o2))
> console.log(f(o3))
> #+end_src
> 
> Results
> 
> #+call: with_example() :results code

yields

> Evaluating
> 
> \begin{minted}[frame=lines,fontsize=\scriptsize]{js}
> var x = 1
> var f = function(o){ with(o){ return x } }
> var o2 = { x : 2 }
> var o3 = { x : 3 }
> console.log(f({}))
> console.log(f(o2))
> console.log(f(o3))
> \end{minted}
> 
> Results
> 
> \begin{minted}[frame=lines,fontsize=\scriptsize]{common-lisp}
> "1\n2\n3\n"
> \end{minted}
> \end{frame}

(It seems the ":results code" evaluates again the output of the call.)

Any suggestion?

Thanks a lot,

Alan

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

* Re: export: inserting text between source and its results
  2012-06-08  7:48 export: inserting text between source and its results Alan Schmitt
@ 2012-06-08  8:57 ` Sebastien Vauban
  2012-06-08 14:06   ` Alan Schmitt
  0 siblings, 1 reply; 3+ messages in thread
From: Sebastien Vauban @ 2012-06-08  8:57 UTC (permalink / raw)
  To: emacs-orgmode-mXXj517/zsQ

Hello Alan,

Alan Schmitt wrote:
> Now I would like to insert some text between the source part and the result
> part. For this it seems that I need to use a "call"

No, simply use named code blocks, and put "#+results: the-name-I-choose"
wherever you want the results to be located.

That way, you can completely separate where the block is, from where the
results will be "posted" to.

Best regards,
  Seb

-- 
Sebastien Vauban

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

* Re: export: inserting text between source and its results
  2012-06-08  8:57 ` Sebastien Vauban
@ 2012-06-08 14:06   ` Alan Schmitt
  0 siblings, 0 replies; 3+ messages in thread
From: Alan Schmitt @ 2012-06-08 14:06 UTC (permalink / raw)
  To: emacs-orgmode Mode

On 8 juin 2012, at 10:57, Sebastien Vauban wrote:

> Hello Alan,
> 
> Alan Schmitt wrote:
>> Now I would like to insert some text between the source part and the result
>> part. For this it seems that I need to use a "call"
> 
> No, simply use named code blocks, and put "#+results: the-name-I-choose"
> wherever you want the results to be located.
> 
> That way, you can completely separate where the block is, from where the
> results will be "posted" to.

It worked great, thanks a lot!

Alan

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

end of thread, other threads:[~2012-06-08 14:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-08  7:48 export: inserting text between source and its results Alan Schmitt
2012-06-08  8:57 ` Sebastien Vauban
2012-06-08 14:06   ` Alan Schmitt

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