From mboxrd@z Thu Jan 1 00:00:00 1970 From: John Kitchin Subject: Re: workflow, matlab+latex in org file Date: Mon, 11 Jul 2016 10:05:53 -0400 Message-ID: References: <8760sc8ids.fsf@mat.ucm.es> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:52809) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bMbqT-0006OD-Vt for emacs-orgmode@gnu.org; Mon, 11 Jul 2016 10:06:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bMbqO-0008FE-Vj for emacs-orgmode@gnu.org; Mon, 11 Jul 2016 10:06:01 -0400 Received: from mail-qk0-x232.google.com ([2607:f8b0:400d:c09::232]:35928) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bMbqO-0008FA-Ra for emacs-orgmode@gnu.org; Mon, 11 Jul 2016 10:05:56 -0400 Received: by mail-qk0-x232.google.com with SMTP id 82so92291921qko.3 for ; Mon, 11 Jul 2016 07:05:56 -0700 (PDT) In-reply-to: <8760sc8ids.fsf@mat.ucm.es> 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: Uwe Brauer Cc: emacs-orgmode@gnu.org 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