From mboxrd@z Thu Jan 1 00:00:00 1970 From: William =?UTF-8?B?TMOJQ0hFTExF?= Subject: Re: Selective export of Babel code blocks Date: Mon, 18 Jun 2012 13:37:47 -0400 Message-ID: <87395sttas.wl%william.lechelle@ens-lyon.fr> References: Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([208.118.235.92]:38917) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sgftm-0004c8-9f for emacs-orgmode@gnu.org; Mon, 18 Jun 2012 13:37:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Sgftk-0004Mp-II for emacs-orgmode@gnu.org; Mon, 18 Jun 2012 13:37:57 -0400 Received: from jabiru.ens-lyon.fr ([140.77.51.2]:38807) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sgftk-0004MT-8R for emacs-orgmode@gnu.org; Mon, 18 Jun 2012 13:37:56 -0400 Received: from localhost (localhost [127.0.0.1]) by jabiru.ens-lyon.fr (Postfix) with ESMTP id 7FBB71EB3F4 for ; Mon, 18 Jun 2012 19:37:54 +0200 (CEST) Received: from jabiru.ens-lyon.fr ([127.0.0.1]) by localhost (jabiru.ens-lyon.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ZYXpH5ghWIIp for ; Mon, 18 Jun 2012 19:37:54 +0200 (CEST) Received: from villian.umontreal.ca (x-132-204-242-178.xtpr.umontreal.ca [132.204.242.178]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (Client did not present a certificate) by jabiru.ens-lyon.fr (Postfix) with ESMTPSA id 9DE601EB37B for ; Mon, 18 Jun 2012 19:37:53 +0200 (CEST) In-Reply-To: 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: emacs-orgmode@gnu.org > On Mon, Jun 18, 2012 at 6:50 PM, John Hendy wrote: > > #+name: preamble > > #+begin_src R :exports none > > tikzDevice("file-name") > > #+end_src >=20 > Are you trying to use "file-name" as a variable? if so I think the > source block header should include this: ":var file-name" and the sourc= e > block can refer to the variable as $file-name. It seems to me one of both ,----[ insert preamble ] | <> | with the preamble having the header | :var file-name=3D"file_1.tex" `---- or ,----[ eval preamble ] | <> | without any :var header `---- would be correct syntax, but using :var without assigning it s= hould fail (though I didn't test it). Both wouldn't give the same result=E2=80=A6 > > And by the org-mode Babel documentation it looks like I can do > > something like: > > > > <> >=20 > I'm not sure about this. The syntax seems correct but I don't quite > understand the following statement from the manual: >=20 > It is possible to include the _results_ of a code block rather than > the body. This is done by appending parenthesis to the code block nam= e > which may optionally contain arguments to the code block as shown > below. >=20 > <> =E2=80=A6 as I read this as=20 "the noweb reference will expand in either=20 1. The litteral of the code-block if there are no parenthesis 2. The results of the block (as obtained with C-c C-c or org-babel-execute-src-block) (which may depend of a :results header, mayb= e), if parenthesis are present. " So if the OP wants to call the preamble block with an argument in the now= eb reference, then the preamble block might have to be more like #+name: preamble #+begin_src R :results output print(tikzDevice(file-name)) #+end_src called with=20 <> (but I don't know any R either, I just went myself through variable substitution over the weekend) Last alternative, which I use, is putting the file name in some named tab= le, and then passing it as an argument to ,----[ insert preamble ] | <> | with the preamble having the header | :var file-name=3Dsome-table[0,1] `---- (Like #+tblname: some-table | file | "file_1.tex" | ) HTH, William