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: Eric S Fraga
Subject: Re: [O] workflow, matlab+latex in org file
Date: Mon, 11 Jul 2016 17:42:34 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.94 (gnu/linux)

On Monday, 11 Jul 2016 at 12:32, Uwe Brauer wrote:
> 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

A bit of a kludge but, if you don't want to modify the ob-matlab code,
you can explicitly generate LaTeX into a file and use it directly:

--8<---------------cut here---------------start------------->8---
#+begin_src octave :exports none :results output
  clear all
  pkg load symbolic
  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);
  fid = fopen("jacobian.tex","w");
  fprintf(fid, "%s\n", ltxjac);
  fclose(fid);
  ltxjac
#+end_src

\begin{equation}
\input{jacobian}
\end{equation}
--8<---------------cut here---------------end--------------->8---

I don't have MATLAB so have tested with octave instead...

-- 
: Eric S Fraga (0xFFFCF67D), Emacs 25.0.94.1, Org release_8.3.4-869-gf2c421



reply via email to

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