From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Sebastien Vauban" Subject: Re: Guidance for preparing document with code Date: Wed, 29 May 2013 19:00:41 +0200 Message-ID: <8638t5iuva.fsf@somewhere.org> References: Mime-Version: 1.0 Content-Type: text/plain Return-path: 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-mXXj517/zsQ@public.gmane.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org-mXXj517/zsQ@public.gmane.org To: emacs-orgmode-mXXj517/zsQ@public.gmane.org Hello, Thomas S. Dye wrote: > SabreWolfy writes: > >> I'm using Org ~7.8 and would like to prepare a document for export to HTML >> to make available to others to read. This document will contain heading, >> text, etc., R code (for my reference) and the output of the R code. Where >> should I look to learn how to do this in R? Org-babel? > > Org mode should do what you want pretty much out of the box. Note that > the exporters all changed with Org 8, so you'll want to distinguish > between the old and new exporters if you look for information on line. > >> Is this literate programming? > > I don't think so. The end result of literate programming is typically a > computer program rather than a document. Just for the sake of accuracy, I'd say that "the end result of literate programming is typically both a computer program *and* its documentation". Getting the code out of the mixed source is called "tangling", while generating the documentation (which shows both the code and explains it at the same time) is called "weaving". For the rest, you've received all the needed information so far, I guess. Little starter for your R code: #+BEGIN_SRC R :results graphics :file testout.png plot(1:10, (1:10)^2) #+END_SRC produces (when evaluated in the buffer): #+results: [[file:testout.png]] Up to you to see whether you want to export (when generating the HTML document) the code, its results, both or none, by setting correctly the ":exports" header argument. Best regards, Seb -- Sebastien Vauban