From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ken Mankoff Subject: Re: Literate programming in org Date: Wed, 26 Aug 2015 08:21:55 -0400 Message-ID: References: <55DD7A44.2030006@gmx.de> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:46208) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZUZiM-00056T-92 for emacs-orgmode@gnu.org; Wed, 26 Aug 2015 08:22:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZUZiI-0000kx-Bt for emacs-orgmode@gnu.org; Wed, 26 Aug 2015 08:22:02 -0400 Received: from mail-qg0-x234.google.com ([2607:f8b0:400d:c04::234]:34985) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZUZiI-0000kp-6q for emacs-orgmode@gnu.org; Wed, 26 Aug 2015 08:21:58 -0400 Received: by qgj62 with SMTP id 62so124763339qgj.2 for ; Wed, 26 Aug 2015 05:21:57 -0700 (PDT) In-reply-to: <55DD7A44.2030006@gmx.de> 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-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Max Linke Cc: Org Mode 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 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.