From mboxrd@z Thu Jan 1 00:00:00 1970 From: Torsten Wagner Subject: org-babel: Meta-LaTeX-Python-Environment Date: Mon, 26 Oct 2009 13:27:09 +0900 Message-ID: <200910261327.09576.torsten.wagner@googlemail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1N2HB0-0002yF-T1 for emacs-orgmode@gnu.org; Mon, 26 Oct 2009 00:27:26 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1N2HAv-0002x0-6l for Emacs-orgmode@gnu.org; Mon, 26 Oct 2009 00:27:25 -0400 Received: from [199.232.76.173] (port=59559 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N2HAv-0002wx-3z for Emacs-orgmode@gnu.org; Mon, 26 Oct 2009 00:27:21 -0400 Received: from mail-yx0-f191.google.com ([209.85.210.191]:46212) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1N2HAu-0006wT-NR for Emacs-orgmode@gnu.org; Mon, 26 Oct 2009 00:27:20 -0400 Received: by yxe29 with SMTP id 29so7074173yxe.14 for ; Sun, 25 Oct 2009 21:27:19 -0700 (PDT) Content-Disposition: inline List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Emacs-orgmode@gnu.org Hi, I started working on an little latex-package to allow the execution of python code in LaTeX a while ago. It stopped at some point and now it is on my pending project lists for a while already. When I read about org-babel I saw a lot of similarities. I like to start again on the basis of org-babel and trying to accomplish the following idea. Within a LaTeX-file (org-file) I like to use python snippets to perform calculus and other tasks which are otherwise extremely difficult or time consuming to perform directly in LaTeX. E.g. on-the-fly-generation of graphs or calculus of statistical values (e.g., (very simple) the mean value of n numbers). I guess org-mode together with org-babel can do most of this already. I played around with it and it is very nice, many thanks to the developers. However, I found the following point which I wasn't able to figure out yet. 1. Hiding of the source code blocks for export I like to export the results of the source code block to LaTeX only. However, I tried different options all resulting in embedding the source-code itself inside the final LaTeX file. I guess this is more due to the org-export function rather then org-babel 2. Inline source code blocks I guess this was discussed once already. Instead of a verbose source code block a single short command to elaborate a python variable or a one line calculus would be nice e.g., "#:session_name a#" to replace this command by the results of variable a of the session session_name during the export to LaTeX. I like to combine this with a little python module specialised in creating proper LaTeX export for all kind of python data types. E.g. tab_export([1,2,3,4,5]) could generate the string "1 & 2 & 3 & 4 & 5 \\" The idea is to use this as a form of reproducible research allowing the data evaluation together with the textual and graphical representation. Furthermore, I would like to use org as a publication system with meta- description capabilities. This would allow to commentary what someone is doing "between the lines". By this one could merge somehow the lab-book, data analysis and the final paper into one org-file (or org-project) and keep always all infos and data close together Something like (pseudo code): /---------------------------------------------------------------------------------/ 12.03.2148: Scotty I'm going to create a better warp drive system: ... First measurements should show the better efficiency. The old set-up is moved to the lab downstairs .... the old measurement files back-up is at .... First lets load the values and calculate the performance: #+srcname: measurement #+begin_src python data=load(measurement.csv) perf = calculate_performance(data.values) #+end_src This was the final measurement performed with the new set-up. It shows already the nice improvements... Just some infos of the measurement Measurement date: #:measurement data.date# Measurement parameter: #:measurement data.param1# 13.3.2148: Scotty Spoke told me it could be better by performing a new warp-core calibration... However, I could write the abstract already: #+srcname: paper_for_star_fleet_physics_journal #+begin_src LaTeX \begin{abstract} .... the new set-up shows a $#:measurement perf#,/%$ better perfomance then the old warp drive... \end{abstract} #+end_src 13.04.2148: Scotty Finally I applied the calibration as Spoke said but results are not better. Results can be found here _link_ but will not be published yet... lost one month... will kick some Vulcans ass ... Let's continuous with the graphs I need for figure 4... ... ... ... /--------------------------------------------------------------------------------------------/ I hope this gives an idea of what I like to do. :) Export should allow selections like "export all" (including comment texts and source code blocks), "export without source code blocks" and "export results only". The last one would produce the native LaTeX code ready for submission. This would allow to process the file with any standard LaTeX environment. I know there is the tangle function. However, it would require a LaTeX-source block for org-babel. Creating one would result in the problem that I have to replace spaceholders within the LaTeX-code blocks with the results of python- blocks (as shown in the example). It would be nice to hear if someone is doing something similar or if somebody has some ideas how to accomplish this with org-mode and org-babel Best regards, Torsten CC. Sorry for the long mail