emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] Guidance for preparing document with code


From: Nick Dokos
Subject: Re: [O] Guidance for preparing document with code
Date: Wed, 29 May 2013 13:47:00 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

SabreWolfy <address@hidden> writes:

> Nick Dokos <ndokos <at> gmail.com> writes:
>
>> org-babel is the right tool. Getting the headers right might involve
>> some fiddling: there have been many question on the ML about those so
>> you can try searching, but if after some effort you are still running
>> into a wall, just post what you have, what you want to accomplish and
>> how your purported solution fails: there are lots of people able and
>> willing to help. The only thing to keep in mind is that the shorter the
>> example, the better: don't post your 100-page org file; extract the
>> example(s) that you want help with.
>
> Thanks. Apologies -- I meant *headers* (ie: a structured/outline-type
> document), not *headings*.
>

I think you used the right terminology the first time: those are usually
referred to as ``headings''.

The ``headers'' I was referring to are the header arguments in a code
block. I should have said ``header arguments'' explicitly - see e.g.

(info "(org) Working with source code")

>> If you are using the R code for your reference, and only presenting the
>> results, that's *not* literate programming: you don't have to worry
>> about the noweb stuff.
>> 
>
> I wanted to include explanatory text, the R code, then the output of the
> code, all in the same document. The R code will not be relevant to the
> reader, but I'd like it included and executed to produce output.
>

You can do that with babel: the ":exports both" header argument allows
both code and results to be exported.

We can argue whether this is literate programming but it's probably not
a useful argument: it's not black and white, there is a continuous
spectrum. As Seb explained, literate programming is (usually) about
presenting a program (usually a *large* program) in logical pieces,
interleaving the explanations with program fragments and depending on
the system to a) "tangle" all the program fragments into a program that
can actually be run without any modifications and b) "weave" the code
fragments and explanations into a document (e.g. a book).

-- 
Nick




reply via email to

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