From mboxrd@z Thu Jan 1 00:00:00 1970 From: Uwe Brauer Subject: Re: workflow, matlab+latex in org file Date: Tue, 12 Jul 2016 12:44:59 +0000 Message-ID: <87wpkrqb3o.fsf@mat.ucm.es> References: <87inwcm8hx.fsf@ucl.ac.uk> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:43404) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bMx3r-0006pc-KD for emacs-orgmode@gnu.org; Tue, 12 Jul 2016 08:45:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bMx3m-0003ph-N0 for emacs-orgmode@gnu.org; Tue, 12 Jul 2016 08:45:15 -0400 Received: from plane.gmane.org ([80.91.229.3]:50099) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bMx3m-0003pA-G7 for emacs-orgmode@gnu.org; Tue, 12 Jul 2016 08:45:10 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1bMx3k-0002pI-0V for emacs-orgmode@gnu.org; Tue, 12 Jul 2016 14:45:08 +0200 Received: from gilgamesch.quim.ucm.es ([147.96.12.99]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 12 Jul 2016 14:45:07 +0200 Received: from oub by gilgamesch.quim.ucm.es with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 12 Jul 2016 14:45:07 +0200 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: emacs-orgmode@gnu.org >>> "Eric" == Eric S Fraga writes: > 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: > #+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} Thanks, that is a solution but a bit cumbersome because of the additional latex file. John sent me a hack which seems a bit more flexible. Uwe > I don't have MATLAB so have tested with octave instead...