yjwen / org-reveal

Exports Org-mode contents to Reveal.js HTML presentation.
1.41k stars 247 forks source link

Show results of source snippets #431

Closed gdkrmr closed 4 years ago

gdkrmr commented 4 years ago

I would like to generate a presentation, where I show some R source snippets and the result of the evaluation [1]. Is this possible?

In the following, the result is not shown on the slide.

***** Calculator
      #+NAME: snippet_name
      #+BEGIN_SRC R :results output
        runif(1)
      #+END_SRC

      #+RESULTS: snippet_name
      : [1] 0.01863039

image

[1] For an example, see here: https://slides.yihui.org/xaringan/#17

yjwen commented 4 years ago

It should be a matter about org-babel evaluation. I didn't test with R as I don't have R installed, but emacs-lisp works out-of-box for org-babel evaluation. Please check with the example below.


* org-babel example

#+name: square
#+begin_src emacs-lisp
(* x x)
#+end_src

#+call: square(x=6)

Perhaps it is only necessary to enable R for org-babel. See how to enable certain language for org-babel by this link