emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [babel] Re: [Orgmode] org-babel: Meta-LaTeX-Python-Environment


From: Thomas S. Dye
Subject: Re: [babel] Re: [Orgmode] org-babel: Meta-LaTeX-Python-Environment
Date: Wed, 28 Oct 2009 08:46:22 -1000

On Oct 28, 2009, at 7:15 AM, Eric Schulte wrote:

"Thomas S. Dye" <address@hidden> 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 <<noweb>> 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 <<noweb-example>>
   \item <<noweb-example()>>
   \item <<noweb-example(a=8)>>
 \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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]