From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Eric Schulte" Subject: Re: [babel] Variable support for ob-maxima Date: Wed, 23 Mar 2011 11:44:37 -0600 Message-ID: <878vw5enov.fsf@gmail.com> References: <.ywodd3lh3mjt@de.bosch.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from [140.186.70.92] (port=39812 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q2S7c-0004qq-Lh for emacs-orgmode@gnu.org; Wed, 23 Mar 2011 13:45:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q2S78-0004cw-6o for emacs-orgmode@gnu.org; Wed, 23 Mar 2011 13:44:59 -0400 Received: from mail-iy0-f169.google.com ([209.85.210.169]:33722) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q2S78-0004cp-1F for emacs-orgmode@gnu.org; Wed, 23 Mar 2011 13:44:58 -0400 Received: by iyf13 with SMTP id 13so11456053iyf.0 for ; Wed, 23 Mar 2011 10:44:57 -0700 (PDT) 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: Thomas Holst Cc: "emacs-orgmode@gnu.org" Thomas Holst writes: > Hello, > > recent org-mode versions have support for maxima via org-babel. But > there is no support vor variables. I implemented basic support for > variables. A header =var: eq="x^2"= is translated to: > > #+begin_src maxima > eq : x^2; > #+end_src > > I attached a patch to this eMail. > Great, thanks for sharing this patch, I'd very much like to apply this. Have you seen the instructions for contributing to Org-mode [1]? Any patch over 10 lines long requires signed FSF copyright attribution papers. Please let me know if you are able to complete the copyright assignment, once that is done I will apply this patch. > > Now I can use the output from one maxima block and make a LaTeX equation > out of it with one maxima code block and reuse the output and make further > maipulations with it. I find it dificult to explain what I want to do, > so here is an example: > The example below like a nice application, you may also want to use "begin_src latex" blocks to display equations resulting from maxima code blocks. Cheers -- Eric > > * Reuse Output of maxima code blocks > > #+source: eq1() > #+begin_src maxima :exports none :results output verbatim > display2d:false; > eq1: x**2; > print(eq1); > #+end_src > #+results: eq1 > : x^2 > > Pretty print equation with LaTeX: > > #+source: eq1-latex > #+begin_src maxima :exports results :results output latex :var eq=eq1() > print("\\begin{equation}"); > print(tex1(eq)); > print("\\end{equation}"); > #+end_src > > #+results: eq1-latex > #+BEGIN_LaTeX > \begin{equation} > x^2 > \end{equation} > #+END_LaTeX > > Do some further calculation / maipulation to equation > > #+source: eq2() > #+begin_src maxima :exports none :results output verbatim :var eq=eq1() > display2d:false; > eq2 : eq + sin(x); > print(eq2); > #+end_src > #+results: eq5 > : sin(x)+x^2 > > Pretty print second equation: > > #+source: eq2-latex > #+begin_src maxima :exports results :results output latex :var eq=eq2() > print("\\begin{equation}"); > print(tex1(eq)); > print("\\end{equation}"); > #+end_src > > #+results: > #+BEGIN_LaTeX > \begin{equation} > \sin x+x^2 > \end{equation} > #+END_LaTeX > > With this workflow I have all org features for docmentation of math or > engineering works. > > I am a lisp beginner so my lisp code may not be the best. If there are > better ways to accomplish variable support please let me know. Footnotes: [1] http://orgmode.org/worg/org-contribute.php