[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Orgmode] org-babel: Meta-LaTeX-Python-Environment
From: |
Dan Davison |
Subject: |
Re: [Orgmode] org-babel: Meta-LaTeX-Python-Environment |
Date: |
Wed, 28 Oct 2009 12:57:28 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.0.91 (gnu/linux) |
[cc'ing list who were accidentally omitted]
Torsten Wagner <address@hidden> 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
- [babel] Re: [Orgmode] org-babel: Meta-LaTeX-Python-Environment, (continued)
- [babel] Re: [Orgmode] org-babel: Meta-LaTeX-Python-Environment, Dan Davison, 2009/10/28
- Re: [babel] Re: [Orgmode] org-babel: Meta-LaTeX-Python-Environment, Dan Davison, 2009/10/28
- [babel] Re: [Orgmode] org-babel: Meta-LaTeX-Python-Environment, Thomas S. Dye, 2009/10/28
- Re: [babel] Re: [Orgmode] org-babel: Meta-LaTeX-Python-Environment, Eric Schulte, 2009/10/28
- Re: [babel] Re: [Orgmode] org-babel: Meta-LaTeX-Python-Environment, Thomas S. Dye, 2009/10/28
- Re: [babel] Re: [Orgmode] org-babel: Meta-LaTeX-Python-Environment, Eric Schulte, 2009/10/28
- Re: [babel] Re: [Orgmode] org-babel: Meta-LaTeX-Python-Environment, Thomas S. Dye, 2009/10/29
- Re: [Orgmode] org-babel: Meta-LaTeX-Python-Environment, Thomas S. Dye, 2009/10/28
Re: [Orgmode] org-babel: Meta-LaTeX-Python-Environment, Torsten Wagner, 2009/10/27
Message not available