Michael Bach <pha...@gmail.com> writes: > Andreas Leha <andreas.l...@med.uni-goettingen.de> writes: > >> would this noweb-based approach work for you: >> >> #+name: inner_test >> #+begin_src R >> 4 + 4 >> #+end_src >> >> #+name: test >> #+begin_src latex :noweb yes >> \begin{equation} >> <<inner_test()>> >> \end{equation} >> #+end_src >> > > Yes, that works. Thanks for your thoughts on this, Andreas. > > I am just thinking of another benefit: Is it correct that I can use > caching with this approach? So that the call to <<inner_test()>> does > not evaluate the `inner_test' block but instead takes its results > directly from the cached `#+results[6099...]: inner_test' block? This > would be speedier than src_R usage...
yes, that should work. Try to export the following several times. The first number should not change. (note: maybe you'd have to execute the inner_test_cached once on your system) #+name: inner_test_cached #+begin_src R :cache yes :exports none rnorm(1) #+end_src #+results[dbeb7280be41fdc949815808cf601a6d01a400bb]: inner_test_cached : 1.12399967834262 #+name: inner_test_not_cached #+begin_src R :exports none rnorm(1) #+end_src #+results: inner_test_not_cached : -0.562660468468834 #+name: test #+begin_src latex :noweb yes \begin{equation} <<inner_test_cached()>> != <<inner_test_not_cached()>> \end{equation} #+end_src Cheers, Andreas