From: Dan Davison <davison@stats.ox.ac.uk>
To: Torsten Wagner <torsten.wagner@gmail.com>
Cc: emacs org-mode mailing list <emacs-orgmode@gnu.org>
Subject: Re: org-babel: Meta-LaTeX-Python-Environment
Date: Wed, 28 Oct 2009 12:57:28 -0400 [thread overview]
Message-ID: <871vknlamf.fsf@stats.ox.ac.uk> (raw)
In-Reply-To: <4edb2bbc0910270625ybce9255nf569b5e250d061e1@mail.gmail.com> (Torsten Wagner's message of "Tue, 27 Oct 2009 22:25:15 +0900")
[cc'ing list who were accidentally omitted]
Torsten Wagner <torsten.wagner@gmail.com> writes:
> Hi Dan,
>
>
>
> > 1. Hiding of the source code blocks for export
> > I like to export the results of the source code block to LaTeX only.
> However,
>
> Using ':exports results' specifies that only the results should appear
> in the exported document. This
>
> #+begin_src python :exports results
> 6 + 6
> #+end_src
>
>
Hi Torsten
> I tried this but the result is first the source code block followed by the
> result:
If it's not working, could you provide the exact example and tell us
your operating system, git version etc?
> Furthermore, I tried to create some LaTeX code as result of the code block
You need to use the ':results latex' header if you want the result to be
output as latex.
<...>
> In general I could try to use org-mode as much as possible. However, in that
> special case I like to merge three (or more) documents together.
> 1. The source code (e.g. python)
> 2. A laboratory journal (this would use org-mode magic)
> 3. An official report e.g. a manuscript to be submitted to a journal (this
> would be a LaTeX file)
>
> The idea is to be able to merge all this together to make sure data
> manipulation and calculus (source code) are as close as possible to the
> specific journal entry, which may supply additional important information and
> the final manuscript snippets which presents officially the particular result.
> A short example would be (without real headers)
>
> --8<-------------------------------------------------------------->8---
> * 23.10.09
> Measurement this morning was performed as usual but this time without warm up
> of device foo.
> Measurement file is saved under _link_.
> TODO: Don't forget to prepare for meeting tomorrow
>
> <<Python>>
> for foo import *
> a = load("data.csv")
> b = apply_filter(a,lp)
> plot(b)
> saveplot(bar.pdf)
> <<Python>>
OK, currently, the way to do that is something like
#+srcname: pyplot(file="bar.pdf")
#+begin_src python :results file
plot(outfile=file)
file
#+end_src
#+resname: pyplot
[[file:bar.pdf]]
Note that for a generalist language like python (which does not always
create output to file) you currently need to
1. specify that it outputs a file with ':results file'
2. explicitly send output to the file in your python code
3. explicitly return the filepath as a string at the end of the
block. it will get inserted as a link.
You have the option of not hard-wiring the filepath in the python code
by using a variable as I did there.
[We may want to change this so that (3) happens automatically when
':file filepath' or ':results file' is provided]
>
> First low pass filter was applied then a plot is generated
> This plot will be used in publication for journal foo
> DEADLINE: <2009-12-14 Mo>
> <<LaTeX>>
> \begin{figure}
> \includegraphics{bar.pdf}
> \end{figure}
> <<LaTeX>>
To avoid hard-wiring the filename into the latex block you could use the
org-babel-latex.el that Eric has posted.
> --8<-------------------------------------------------------------->8---
>
> Text outside should be org-mode text.
> Now I like to export with three scenarios
> 1. Only the LaTeX part (e.g. by using tangle) resulting in a pure native
> LaTeX-file ready for submission
See emails in the concurrent main thread on this topic.
> Above example will result in
>
> \begin{figure}
> \includegraphics{bar.pdf}
> \end{figure}
>
> 2. The LaTeX part and the org-mode parts whereas the LaTeX blocks should be
> somehow verbatim
> or in a some way marked inline. Above example should result in a LaTeX export
> like
'begin_src latex' blocks are exported as code blocks with appropriate
fontification under org-mode.
I hope this is getting clearer now :)
Dan
>
> \section{23.10.09}
> Measurement this morning was performed as usual but this time without warm up
> time.
> Measurement file is saved under \footnote[/home/foo/data.csv]{link}.
> First low pass filter was applied then a plot is generated
> This plot will be used in publication for journal foo
> \begin{minipage}
> \begin{figure}
> \includegraphics{bar.pdf}
> \end{figure}
> \end{minipage}
>
> 3. Export of all which will include the python blocks in a inline form as well.
>
> First of all I would be happy if I could avoid to have the source code blocks
> in the export file.
> I simply like to generate LaTeX-snipplets in python and export a LaTeX file
> finally.
>
> Thus,
>
> #+srcname: LaTeX
> #+begin_src python :session :exports results
> plot([1,2,3,4,5],[2,4,6,8,10])
> savefig(file,f-acecolor='w', edgecolor='w',format=None)
> param1 = 19.7
> perf = 77
> #+end_src
next prev parent reply other threads:[~2009-10-28 16:57 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-26 4:27 org-babel: Meta-LaTeX-Python-Environment Torsten Wagner
2009-10-27 0:24 ` Dan Davison
2009-10-27 8:23 ` Thomas S. Dye
2009-10-27 14:57 ` Torsten Wagner
2009-10-27 22:55 ` Eric Schulte
2009-10-28 0:40 ` Thomas S. Dye
2009-10-28 15:19 ` Eric Schulte
2009-10-28 16:10 ` [babel] " Dan Davison
2009-10-28 16:49 ` Dan Davison
2009-10-28 16:52 ` Thomas S. Dye
2009-10-28 17:15 ` Eric Schulte
2009-10-28 18:46 ` Thomas S. Dye
2009-10-28 22:19 ` Eric Schulte
2009-10-29 6:55 ` Thomas S. Dye
2009-10-28 16:25 ` Thomas S. Dye
2009-10-27 13:29 ` Torsten Wagner
2009-10-29 15:52 ` [babel] Meta-LaTeX-Python-Environment Dan Davison
[not found] ` <4edb2bbc0910270625ybce9255nf569b5e250d061e1@mail.gmail.com>
2009-10-28 16:57 ` Dan Davison [this message]
2009-10-29 4:52 ` [babel]org-babel: Meta-LaTeX-Python-Environment Torsten Wagner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=871vknlamf.fsf@stats.ox.ac.uk \
--to=davison@stats.ox.ac.uk \
--cc=emacs-orgmode@gnu.org \
--cc=torsten.wagner@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).