From: Ken Mankoff <mankoff@gmail.com>
To: Max Linke <max_linke@gmx.de>
Cc: Org Mode <emacs-orgmode@gnu.org>
Subject: Re: Literate programming in org
Date: Wed, 26 Aug 2015 08:21:55 -0400 [thread overview]
Message-ID: <m2mvxeutng.fsf@gmail.com> (raw)
In-Reply-To: <55DD7A44.2030006@gmx.de>
Hi Max,
This is one bit of literate programming I haven't mastered myself yet. I generally have code blocks and print results, and then manually re-enter them in the paragraph below. I would like what you are looking for. The best solution I have, which I don't use often, is to use sessions and inline code.
On 2015-08-26 at 04:35, Max Linke <max_linke@gmx.de> wrote:
> * How can I use computed variables (string/int/float) in floating text?
>
> I have for example calculated a autocorrelation time and now want to
> use that calculated number in the text. The best solution I have
> found so far is
>
> #+name: print_acf_time
> #+begin_src ipython :session :exports none
> print(acf_time)
> #+end_src
>
> The autocorrelation time for the process is call_print_acf_time().
> That is OK-ish but I have to write a special code cell for every
> variable that I want to reference in my document. Is there another
> method to export variables to be easily accessible in org-mode?
For example, to insert the number three I could do the following, if a = 1 and b = 2, defined previously in session "foo": src_octave[:session foo]{a+b} {{{results(=3=)}}}
I've been thinking about other ways to achieve this... perhaps my code blocks update a table. That table might be included in the text for the reader. Then one code session reads it all in, so I have access to all results in one session and can use them in the text...
-k.
prev parent reply other threads:[~2015-08-26 12:22 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-26 8:35 Literate programming in org Max Linke
2015-08-26 10:36 ` Sebastien Vauban
2015-08-26 19:40 ` Max Linke
2015-08-26 20:07 ` Sebastien Vauban
2015-08-26 12:21 ` Ken Mankoff [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m2mvxeutng.fsf@gmail.com \
--to=mankoff@gmail.com \
--cc=emacs-orgmode@gnu.org \
--cc=max_linke@gmx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.