emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Proposal/request for input: slidify export for html slides


From: Andreas Leha
Subject: Re: [O] Proposal/request for input: slidify export for html slides
Date: Fri, 07 Feb 2014 08:58:06 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

Hi John,

John Hendy <address@hidden> writes:

> An interesting update on this. Aside from some image and code block
> stuff, the following works surprisingly well!
> - Export Org -> markdown (md)
> - Start an R session and `setwd("/path/to/file.md")`
> - Run `library(slidify)` and `author("deck")
> - Copy the deck/assets folder into the parent directory
> - Copy the header code from the resultant deck/index.Rmd file into
> exported .md file
> - Add three hyphens before each heading (headings are # Slide title)
> - Save the file as file.Rmd (vs. file.md)
> - From the R session, do `setwd("../")` (running `author("deck")`
> changes the working directory to deck/
> - Run `slidify("file.Rmd")`
>
> I was coming from Beamer, so all of my generated plots are .pdfs. I
> plan to create a new directory and use imagemagic to convert them all
> to png or jpg, and then modify my original .org file tailored for
> Beamer to use the images vs. pdfs, as well as adding #+attr_html
> headings instead of the existent #+attr_latex ones in my current file.

Are your pdf plots generated (by R) through babel?  In that case (and
given that you do not rely on absolute positioning) you can make Org /do
the right thing/ for you without the need to call imagemagick manually
in the end.

Making images export correctly across multiple backends is a lot of work
(#+attr_latex and #+attr_html should live happily together), so I'll
stick to a simple example ;-)


--8<---------------cut here---------------start------------->8---
* R plot for multiple backends
You might even consider tikz for the LaTeX route instead of pdf.

#+name: demoplot
#+header: :exports results
#+header: :results graphics
#+header: :file (by-backend (latex "demoplot.pdf") (html "demoplot.svg") (t 
"demoplot.png"))
#+begin_src R
  ## taken from ?plot
  plot(table(rpois(100, 5)), type = "h", col = "red", lwd = 10,
       main = "rpois(100, lambda = 5)")
#+end_src

#+results: demoplot
[[file:demoplot.png]]
--8<---------------cut here---------------end--------------->8---


This relies on the by-backend macro from Eric Schulte:

--8<---------------cut here---------------start------------->8---
#+begin_src emacs-lisp
  (defmacro by-backend (&rest body)
    `(case (if (boundp 'backend) (org-export-backend-name backend) nil) ,@body))
#+end_src
--8<---------------cut here---------------end--------------->8---




>
> I'll post a test file and the process if anyone is interested in replicating!

Please do so.  I guess that somehow such a process should be
automatable in the end.

[ ... ]

Regards,
Andreas




reply via email to

[Prev in Thread] Current Thread [Next in Thread]