From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Dynerman Subject: Include sections of org document in tangled files Date: Fri, 02 Dec 2016 14:05:44 -0800 Message-ID: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:54508) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cD1Qx-0004ee-Ry for emacs-orgmode@gnu.org; Fri, 02 Dec 2016 22:56:20 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cD1Qt-0006Dw-Ri for emacs-orgmode@gnu.org; Fri, 02 Dec 2016 22:56:19 -0500 Received: from poitras.block-party.net ([107.170.248.157]:53521) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cD1Qt-0006Di-LQ for emacs-orgmode@gnu.org; Fri, 02 Dec 2016 22:56:15 -0500 Received: from ucbvpn-209-109.vpn.berkeley.edu (ucbvpn-209-109.vpn.berkeley.edu [136.152.209.109]) by poitras.block-party.net (Postfix) with ESMTPSA id 82FB11203A6 for ; Fri, 2 Dec 2016 19:56:14 -0800 (PST) Resent-To: emacs-orgmode@gnu.org Resent-Message-ID: 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: emacs-orgmode@gnu.org Dear list, Is it possible to include sections of an org document while tangling. I have in mind something like the following: * Some section <> This is an introduction. We're going to write some code that implements (a finite version of) the formula \[ f(x) = 1 + x + \frac{x^2}{2} + \frac{x^3}{6} + \ldots + \frac{x^n}{n!} + \ldots \] Here's some background about the exponential function. #+BEGIN_SRC python :tangle myfunction.py from math import factorial def f(x,n): """<>""" y = 0 for i in range(n+1): y = y + x**i/factorial(i) return y #+END_SRC The idea would be that when I export this to HTML, I get a nice literate programming math jax'd section introduction that explains what the function is doing. Then, when I tangle to generate the python file, the org section introduction would be included as the python docstring of the function. This would be really useful, because currently I find myself repeating information when I use org for literate programming. First, I explain what a python function is doing in the org file, but then I also want to include a docstring in the tangled output that basically contains the same information as the org file. Thank you, David