From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Thomas S. Dye" Subject: Re: [babel] Re: org-babel: Meta-LaTeX-Python-Environment Date: Wed, 28 Oct 2009 08:46:22 -1000 Message-ID: References: <200910261327.09576.torsten.wagner@googlemail.com> <878wexheeq.fsf@stats.ox.ac.uk> <4edb2bbc0910270757i3911f817jd99bc68eb4639e31@mail.gmail.com> <87aazblctf.fsf_-_@stats.ox.ac.uk> <794E6720-7BB4-4AE9-BCDF-C5714E2808DA@tsdye.com> Mime-Version: 1.0 (Apple Message framework v936) Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1N3DXa-0004hh-1L for emacs-orgmode@gnu.org; Wed, 28 Oct 2009 14:46:38 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1N3DXV-0004eW-3f for Emacs-orgmode@gnu.org; Wed, 28 Oct 2009 14:46:37 -0400 Received: from [199.232.76.173] (port=59927 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N3DXU-0004eP-Pn for Emacs-orgmode@gnu.org; Wed, 28 Oct 2009 14:46:32 -0400 Received: from outbound-mail-36.bluehost.com ([69.89.20.190]:59093) by monty-python.gnu.org with smtp (Exim 4.60) (envelope-from ) id 1N3DXT-00069L-LV for Emacs-orgmode@gnu.org; Wed, 28 Oct 2009 14:46:32 -0400 In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Eric Schulte Cc: Dan Davison , Emacs-orgmode@gnu.org On Oct 28, 2009, at 7:15 AM, Eric Schulte wrote: > "Thomas S. Dye" writes: > >> On Oct 28, 2009, at 6:10 AM, Dan Davison wrote: > >>> Am I right in thinking that one issue remaining in this thread is >>> that >>> we currently have no means of tangling the output of org-babel- >>> latex? >>> Thus the 'begin_src latex' blocks that we can tangle have >>> unevaluated >>> variables, and the resulting 'begin_latex' blocks have evaluated >>> variables but can't be tangled? (We could extend tangling to cover >>> such >>> blocks, or perhaps preferably use ':results code' to generate >>> begin_src >>> latex' blocks?) >>> >>> Dan >> >> Hi Dan, >> >> I haven't found time to evaluate org-babel-latex, but, yes, the >> example provided with the code raised a concern that the >> 'begin_latex' >> blocks are divorced from the literate programming structure built up >> by the named 'begin_src latex' blocks. Ideally, I think, the >> begin_latex' blocks would replace <> references to their >> source 'begin_src latex' blocks, or would employ some other mechanism >> that doesn't break the literate programming structure I create. >> > > I just started a new branch [1] in the org-mode/babel [2] repository > where we should be able to implement a solution without too much > trouble. If we expand the noweb syntax such that if a source-code > block > name has parenthesis "()" appended to the end of it's name, then the > block will be evaluated during noweb reference expansion and it's > results will be placed in the source-code block. That structure > should > even allow simple literal arguments to be passed to the referenced > block. > > So for example what I'm proposing is that in the following case this > > --8<---------------cut here---------------start------------->8--- > #+srcname: noweb-example > #+begin_src python :var a=0 > a+10 > #+end_src > > #+begin_src latex :tangle somewhere > \begin{itemize} > \item <> > \item <> > \item <> > \end{itemize} > #+end_src > --8<---------------cut here---------------end--------------->8--- > > would tangle to somewhere.tex as > > --8<---------------cut here---------------start------------->8--- > \begin{itemize} > \item a+10 > \item 10 > \item 18 > \end{itemize} > --8<---------------cut here---------------end--------------->8--- > > Does that sound appropriate? -- Eric > > Footnotes: > [1] http://repo.or.cz/w/org-mode/babel.git?a=shortlog;h=refs/heads/noweb-evaluate > > [2] http://repo.or.cz/w/org-mode/babel.git > Eric, I think Torsten has a clearer idea than I do about what kinds of programming structures might be appropriate here, but your suggestion looks to me like an elegant replacement for the file based technique I'm using to pass information into 'begin_src latex' blocks now. Expanding the noweb syntax in the way you propose looks extremely useful. I think it introduces an exciting range of possibilities into the workflow I'm developing with org-babel. So, yes, your proposal sounds appropriate to me. Tom