Closed tmalsburg closed 9 years ago
I don't use epresent, but, FWIW, you can toggle the display of source code exported from org with a sprinkling of java-script/jquery. The following org file, containing R source block which creates a scatter-plot, when exported to HTML, will hide the source if the user hits 's'.
#+HTML_HEAD: <script src="http://code.jquery.com/jquery-1.11.2.min.js"></script>
#+HTML_HEAD: <script type='text/javascript' class="init">
#+HTML_HEAD: case 83 : $('.sourceCode,.sh,.src,src,src-R').slideToggle(2*600); // s
#+HTML_HEAD: $(document).keyup(function(e){
#+HTML_HEAD: //find out which key was pressed
#+HTML_HEAD: switch(e.keyCode){
#+HTML_HEAD: case 83 : $('.sourceCode,.sh,.src,src,src-R').slideToggle(2*600); // s
#+HTML_HEAD: }
#+HTML_HEAD: });
#+HTML_HEAD: </script>
#+begin_src R :results graphics output :exports both :file mtcars_fig1.png
with(mtcars,plot(wt,mpg))
#+end_src
#+RESULTS:
[[file:mtcars_fig1.png]]
This approach might work with some other org exporter for html-based presentations, such as org-reveal. If you try, let us know how it goes!
Hi @malcook thanks for that idea, but I'd like to present the slides in Emacs because I plan to execute code interactively for demonstration purposes.
I agree this would be useful, but I don't have time to implement it now. Take a look at epresent-next-src-block
and the corresponding key binding if you want a starting point to implement this yourself. Patches welcome.
Ok, I'll look into it.
Thanks for working on this issue. Unfortunately, there are some problems remaining. When I set epresent-src-blocks-visible
to non-nil, code blocks behave as expected. But when I set it to nil, the visibility is toggeled when I leave or revisit a page. So when I go back an forth to and from a page the visibility changes every time, I revisit the page.
The second problem is that results from executing the code block are hidden when code block visibility is toggeled. Example:
#+begin_src R :file fwer.png :results graphics :width 700 :height 300 :pointsize 18 :exports results
par(mar=c(4,4,0.1,0.1))
plot(1-(1-0.05)**(1:20), t="l", ylim=0:1, ylab="FWER", xlab="Number of Tests")
grid(); lines(c(0, 21), c(0.05, 0.05), lty=2)
#+end_src
#+RESULTS:
[[file:fwer.png]]
When epresent-src-blocks-visible
is set to t
, the image is hidden when I visit the slide for the first time. When it's nil
, the image is initially visible but vanishes when I toggle code block visibility.
Finally, when I try to use epresent-toggle-hide-src-block
(bound to S
), I get an error message:
No source block to hide at [line number].
Thanks again for looking into this!
Thanks for the feedback, I'll look into this when I get a chance (which sadly may not be soon).
No problem. If I find time, I'll try to fix it.
Thank you for fixing the remaining issues with that! :)
Ah, one problem unfortunately persists:
Finally, when I try to use epresent-toggle-hide-src-block (bound to S), I get an error message:
No source block to hide at 980.
you should only run this command when the cursor is on a specific source block (e.g., after pressing "c").
I'd like to include code in my org presentation file that generates a graph. During the presentation, I like to show the graph but not necessarily the code because it would distract the audience. Is there a way to hide the code, e.g., by adding a keyword to the
begin_src
line? If not, it might be useful to add something along these lines. It would also be useful if the visibility of hidden elements could be toggled. This way I could unhide the code during the presention in order to modify it, execture it to produce the updated graph, and hide the code again.