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

2009-10-29 Thread Thomas S. Dye

On Oct 28, 2009, at 12:19 PM, Eric Schulte wrote:


Thomas S. Dye t...@tsdye.com writes:

[...]


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


This has now been implemented.  To try it out grab the most recent
version of Org-mode.  Changes include
- the ability to insert the *results* of source-code blocks through  
the

 use of noweb references in which the source-name is followed by ()s,
 and
- the addition of the org-babel-latex.el file which should make it
 easier to add latex to the languages known to org-babel

To try this out please run org-babel-tangle on the attached org-mode
file.

noweb-eval.org
which should result in the attached .tex file

somewhere.tex
Let me know if I should make any changes to this new setup.  Thanks  
for

the ideas. -- Eric


Eric,

Yes, the expanded noweb syntax works here as advertised.  Wonderful.   
I look forward to making use of it and will take you up on your offer  
to make changes as new possibilities make themselves known.


All the best,
Tom

Thomas S. Dye, Ph.D.
T. S. Dye  Colleagues, Archaeologists, Inc.
Phone: (808) 529-0866 Fax: (808) 529-0884
http://www.tsdye.com


___
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


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

2009-10-28 Thread Dan Davison
Dan Davison davi...@stats.ox.ac.uk writes:

 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?)

Sorry, I see. 'begin_latex' is inserted directly into latex export and
omitted from other export targets. Still, it might sometimes be useful
to use the tangling machinery in which case ':results code' is what is
needed.

Dan


 Dan





 In response to the implicit question in your comment, perhaps there
 isn't a need to embed LaTeX inside source blocks and the uses to which
 I put them could be accomplished in org-mode without them.  My
 programming skills are pretty crude and I'm aware that I'm a long way
 from understanding org-mode and its vast potential.  With that caveat,
 here is my $0.02.


 I'm also very far from taking full advantage of Org-mode export


 First, practical reasons:

 1) I'm comfortable writing LaTeX and am particular about the results;
 it is hard for me to map the inverse transformation through the org- 
 mode LaTeX exporter to express in org the particular LaTeX result I'm
 after.

 2) Someone on the list (Carsten?) mentioned a couple of days ago that
 it wasn't reasonable to expect the org LaTeX exporter to capture the
 full complexity of LaTeX (I'm paraphrasing, but I think that was the
 gist); I ran up against an example of this (or so I think) when trying
 to configure export to beamer code, where beamer's use of columns
 tripped me up.


 I fully understand your point.  I guess that given my personal paucity
 of latex knowledge and abilities the same need has never occurred to
 me.  In my case the Org-mode exported generally knows more about latex
 than I do.


 Second, conceptual reasons:

 1) I consider writing LaTeX to be programming (here I mean no
 disrespect to real programmers) and appreciate being able to do
 literate LaTeX programming; the LaTeX source blocks let me write my
 beamer presentation a slide or two at a time, just as I want them,
 along with an adjacent source block for my print document, just as i
 want it, that covers the same conceptual space, while I use the
 surrounding org entries to document why I am doing things a particular
 way, etc.


 I see, you are using the org-mode file a level above the direct
 export.  Maybe another option here would be to tag headlines based on
 which export target they are included within, and then base your exports
 on the headline tags (using #+EXPORT_INCLUDE_TAGS:), although I agree
 this also seems like an appropriate place to use the tangle
 functionality.


 2) I think this workflow, with an org-mode meta-document that
 encapsulates the print document and presentation materials, along with
 the SQL, R, and Python code used to create the datasets and analyze
 them, takes org-babel a step closer to realizing its potential as a
 tool for reproducible research.  Here, I am thinking of an org
 document that captures the ways in which a piece of research is one
 logical path among many possibilities, implemented and expressed in
 one particular way (or two, if you want to distinguish print from
 presentation) among many possibilities.

 The LaTeX source blocks in org-babel give me an easy and natural way
 to accomplish these things.  In the short time I've used them, they've
 yielded results that impress me.  I'm confident they hold much more
 potential than I've been able to tap.


 I didn't mean to imply that because I didn't understand the need for
 direct inclusion of latex code there *wasn't* a need for direct
 inclusion of latex code :) Thanks for the explanation.


 It is a real pleasure leveraging your good work.


 It is a pleasure to be able to participate in such a nice open-source
 community. -- Eric


 Tom


 ___
 Emacs-orgmode mailing list
 Remember: use `Reply All' to send replies to the list.
 Emacs-orgmode@gnu.org
 http://lists.gnu.org/mailman/listinfo/emacs-orgmode


 ___
 Emacs-orgmode mailing list
 Remember: use `Reply All' to send replies to the list.
 Emacs-orgmode@gnu.org
 http://lists.gnu.org/mailman/listinfo/emacs-orgmode


___
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


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

2009-10-28 Thread Eric Schulte
Thomas S. Dye t...@tsdye.com 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



___
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


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

2009-10-28 Thread Thomas S. Dye

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


Thomas S. Dye t...@tsdye.com 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


___
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


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

2009-10-28 Thread Eric Schulte
Thomas S. Dye t...@tsdye.com writes:

[...]

 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

This has now been implemented.  To try it out grab the most recent
version of Org-mode.  Changes include
- the ability to insert the *results* of source-code blocks through the
  use of noweb references in which the source-name is followed by ()s,
  and
- the addition of the org-babel-latex.el file which should make it
  easier to add latex to the languages known to org-babel

To try this out please run org-babel-tangle on the attached org-mode
file.



noweb-eval.org
Description: Binary data

which should result in the attached .tex file



somewhere.tex
Description: TeX document

Let me know if I should make any changes to this new setup.  Thanks for
the ideas. -- Eric
___
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode