emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] [babel] Variable support for ob-maxima


From: Eric Schulte
Subject: Re: [O] [babel] Variable support for ob-maxima
Date: Wed, 23 Mar 2011 11:44:37 -0600
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

Thomas Holst <address@hidden> 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]