emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [babel] Literate Programming for publication
@ 2012-04-11 14:35 Torsten Wagner
  2012-04-11 15:29 ` Thomas S. Dye
  0 siblings, 1 reply; 3+ messages in thread
From: Torsten Wagner @ 2012-04-11 14:35 UTC (permalink / raw)
  To: Org Mode Mailing List

Hi,

I just try (again) to use org-mode and babel for literate programming
finally resulting in a camera ready manuscript for publication.

I noticed that there are different ways of achieving this and wonder
what others use or what others think might be the best.

What I want do
Ideally, I would like to separate the org-file into three parts
1. org-mode itself containing all kind of infos, notes, dates,
links,etc -> for me and possibly co-authors
2. latex stuff, the parts which should present the final manuscript ->
to the publisher, colleagues, etc
3. code, all the code to munch all input data into some graphs and to
distill the final results -> for me, coauthors and people who request
it.

What I managed to do
Today I started again combining python resp. pylab and matplotlib
together with org-mode
I managed to use
* python source code blocks in session mode -> generation of graphs in
png format
* org-mode native text -> all text of the manuscript including the
generated figures

At this point I noticed I could use latex source code blocks or latex
code blocks but I had the following problem with both of them.

In python I define certain variables
e.g.

#+begin_src python
U = 3 # applied voltage
t  = pl.arange(0,3.1,0.1) # time
#many more...
#+end_src

later in the text I have to write this parameters as well.
e.g.

.... as shown in figure 3 the current increase after applying a
voltage pulse with an amplitude of 3 V for 3 seconds....

Now here comes the problem. If I start playing around with my python
code I might end up with different values in the calculation and in
the text. This is very hard to spot and hence very dangerous to
overlook.

Thus, I used something like
 .... as shown in figure 3 the current increase after applying a
voltage pulse with an amplitude of src_python[:session name]{print(U)}
V for  src_python[:session]{print(t[-1]} seconds....

The code blocks will be replaced on export and the original text will
be the exported.

Now, I have only one place to change parameters all numbers would be
valid for both code and text.
However, this did not work within latex code blocks or latex blocks.
Having all text in org mode outline, however does not allow me to
separate easily publishable text and notes.
Maybe I could use drawers and property nodes etc. but I think this
looks to make thinks even more complex.
Finally, the biggest problem is the fact that I can't tangle the
entire org-file into different files. I really would like to get
* a tex/pdf/odt manuscript file for the publishers
* a pdf/org/html/odt file including all and everything
* a python source file.

How can I manage to use different code blocks (latex and python) but
still be able to inject results from python into the latex code
blocks? noweb and vars looked good but it did not work for me.

Thanks for all input

Torsten
src_<language>{<body>}

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-04-12 10:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-11 14:35 [babel] Literate Programming for publication Torsten Wagner
2012-04-11 15:29 ` Thomas S. Dye
2012-04-12 10:55   ` Olaf.Hamann

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).