From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Thomas S. Dye" Subject: Re: Babel R source blocks problem Date: Mon, 13 Mar 2017 12:37:29 -1000 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:58704) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cnYg4-0002zJ-Qf for emacs-orgmode@gnu.org; Mon, 13 Mar 2017 18:43:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cnYfz-0006C7-SE for emacs-orgmode@gnu.org; Mon, 13 Mar 2017 18:42:56 -0400 Received: from qproxy5-pub.mail.unifiedlayer.com ([69.89.21.30]:59145) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1cnYfz-00062F-HM for emacs-orgmode@gnu.org; Mon, 13 Mar 2017 18:42:51 -0400 In-reply-to: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: "Charles C. Berry" Cc: org mode Aloha Chuck, Charles C. Berry writes: > On Fri, 10 Feb 2017, Thomas S. Dye wrote: > >> Aloha Chuck, >> >> Charles C. Berry writes: >>> >>> A look at the `slidify-example.org' file in the `org-9-plus' branch of my >>> (chasberry) `orgmode-accessories' github repo might be a good start with >>> .Rmd exports even if you do not want to use `slidify'. >> >> Your ox-ravel exporter is a pleasure to use. I'm farther along than I >> thought I'd be at this point. >> > > Thanks. I am glad to hear this. > > >> I'm new to much of the R ecosystem, including slidify, so forgive some >> noob ignorance in the following three questions: >> >> 1) I've specified the properties EXPORT_TITLE and EXPORT_AUTHOR, but >> they don't show up in the .Rmd file. Is this a limitation of ox-ravel, >> or do I need to learn how to insert them in the Org mode source? >> > > Both, I guess. > > Arguably, it is a limitation in the markdown backends available that > there isn't one that will create the yaml header from the export > options in the org buffer. I think the long term fix is to create a > backend derived from 'md, but this is far down my todo list. For now, > either hand tool a yaml header like that in > > : slidify-example.org::#tds-headline > > (If you are viewing that on my github repo, be sure to click 'raw' or the > yaml header will not be visible!) > > or create a src block that will pull the title, author, et cetera and wrap > them as a yaml header in an md export block and put it at the top of the > output. If you want to do the src block, I can provide a skeleton version. > > >> 2) How do I instruct ox-ravel to include the graphics output of a source >> code block? I tried :ravel fig=TRUE as a header to the source code >> block, but no dice. Most of my experience is with ox-latex, so that >> colors my expectations here; i.e. I'm expecting a [[file:myfile.pdf]] >> link to produce a graphic in the output. > > Often it `just works', but it depends on the vignette engine. `fig=TRUE' > is correct for Sweave. See > > : demos.org::#36234656-157D-4F1D-B441-E727DFCC0251 > > for an example of that. For knitr, you usually do not need to include > anything if there is just one plot produced, but there are loads of > options. See > > https://yihui.name/knitr/options/#plots > > > I find myself using ~:ravel fig.cap=my_caption~ (where `my_caption' is > an R string from an earlier src block) a lot. See > > : demos.org::#C341969B-90F3-4C27-AA7F-5352A9669506 > > for an example of a lengthy caption done in latex. > > There is a src block that produces a plot in the slidify-example.org file. > No special header was needed for ~slidify()~ to render it. But I cannot > be sure whether the yaml block does something special for the graphics. > >> >> 3) I've been knitting the .Rmd output using RStudio, which is also new >> to me. I don't mind doing this (it is what the session organizer is >> going to do with the .Rmd file I send next week), but I'm wondering >> if you have an emacs-only solution? >> > > I don't know RStudio, but here is a start: > > #+BEGIN_SRC R :exports none :results silent > require(rmarkdown) > render("my-file.Rmd") > #+END_SRC > > If you look at the =demos.org= file, you will see examples and the src > blocks used to run ~knitr::knit2pdf()~. If you export some of the > examples to *.Rmd files and run the equivalent ~render(...)~ on the .Rmd > files, you will get html by default. > > --- > > Let me know how it works out! Just a short note to let you know that ox-ravel was a terrific tool for my project of producing a workable R Markdown file for an upcoming conference. I was dreading the requirement to provide .Rmd source for a handout, but ox-ravel made it one of the easiest steps. Thanks for your contribution to Org mode and your support when I was flailing around last month. All the best, Tom -- Thomas S. Dye http://www.tsdye.com