emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] workflow, matlab+latex in org file


From: John Kitchin
Subject: Re: [O] workflow, matlab+latex in org file
Date: Mon, 11 Jul 2016 10:05:53 -0400
User-agent: mu4e 0.9.16; emacs 25.1.50.1

Here is an example using sympy. I think you will have to wrap the matlab
output in $$ yourself if that is what you want. Otherwise, the :exports 
header below specifies to only export the results, and the :results
header wraps the output in a latex environment.

#+BEGIN_SRC python :results output latex :exports results
from sympy import Integral, sqrt, symbols, latex

x = symbols('x')
 
print(latex(Integral(sqrt(1/x), x), mode='equation'))
#+END_SRC

#+RESULTS:
#+BEGIN_LaTeX
\begin{equation}\int \sqrt{\frac{1}{x}}\, dx\end{equation}
#+END_LaTeX




Uwe Brauer writes:

> Hello
>
> I want in a org file, to include matlab code and run it (that I know how
> to do)
>
> Then I want certain results, which are symbolic variables, expressed in
> latex, we I achieve  using matlab's latex command.
>
> Like
> #+begin_src matlab :results output
> clear all
> syms e p R g w K K2
> phi=[(e + (e+p)*R^2)^((g-1)/2);((e+p)*R*sqrt(1+R^2))/(e+(e+p)*R^2)]
>
> jac=jacobian(phi,[e,p])
> ltxjac=latex(jac)
> #+end_src
>
>
> This result should of course also be included in the orgfile.
>
> But then I want to export the org file to latex, such that only the
> results, which have been converted to latex are exported and all the
> matlab command should be ignored, that is in that case:
> ltxjac but nicely surrounded by say $.
>
> Anybody has an idea how to do this efficiently?
>
> thanks
>
> regards
>
>
>
> Uwe Brauer 


-- 
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu



reply via email to

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