[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[O] export: inserting text between source and its results
From: |
Alan Schmitt |
Subject: |
[O] export: inserting text between source and its results |
Date: |
Fri, 8 Jun 2012 09:48:34 +0200 |
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
- [O] export: inserting text between source and its results,
Alan Schmitt <=