emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* org file: export matlab to latex, then to html
@ 2018-05-25 13:15 Uwe Brauer
  2018-05-25 15:20 ` John Kitchin
  0 siblings, 1 reply; 3+ messages in thread
From: Uwe Brauer @ 2018-05-25 13:15 UTC (permalink / raw)
  To: emacs-orgmode



Hello

Please consider the following example


This is a test
#+begin_src matlab :results output latex :exports results
X=[1,2,3,4,5,6,7];
p=[1/7 1/7 1/7 1/7 1/7 1/7 1/7];
E=X*p';
x2=X.*X;
E2=x2*p';
V=E2-E^2;
disp('\begin{align}')
fprintf('E[X]&=%g\\\\ \n', E)
fprintf('E^2[X]&=%g\\\\\n', E2)
fprintf('V[X]&=%g\n', V)
disp('\end{align}')
#+end_src

Executing the src block leads

#+RESULTS:
#+BEGIN_EXPORT latex
\begin{align}
E[X]&=4\\ 
E^2[X]&=20\\
V[X]&=4
\end{align}
#+END_EXPORT

But if I now want to export the org file to html, the latex constructs
are not exported.

I have to remove the 
#+BEGIN_EXPORT latex
#+END_EXPORT

Manually which is cumbersome. 

So I need to modify the line
#+begin_src matlab :results output latex :exports results

But whatever I tried either there was not result exported, or when when
it was the result was not converted to HTML.

Any help is appreciated

Regards

Uwe Brauer 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: org file: export matlab to latex, then to html
  2018-05-25 13:15 org file: export matlab to latex, then to html Uwe Brauer
@ 2018-05-25 15:20 ` John Kitchin
  2018-05-26  8:28   ` Uwe Brauer
  0 siblings, 1 reply; 3+ messages in thread
From: John Kitchin @ 2018-05-25 15:20 UTC (permalink / raw)
  To: org-mode-email

[-- Attachment #1: Type: text/plain, Size: 1436 bytes --]

what if you use :wrap latex in the header? That should wrap the output in a
latex block, which seems to export to html for me.

John

-----------------------------------
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


On Fri, May 25, 2018 at 6:15 AM, Uwe Brauer <oub@mat.ucm.es> wrote:

>
>
> Hello
>
> Please consider the following example
>
>
> This is a test
> #+begin_src matlab :results output latex :exports results
> X=[1,2,3,4,5,6,7];
> p=[1/7 1/7 1/7 1/7 1/7 1/7 1/7];
> E=X*p';
> x2=X.*X;
> E2=x2*p';
> V=E2-E^2;
> disp('\begin{align}')
> fprintf('E[X]&=%g\\\\ \n', E)
> fprintf('E^2[X]&=%g\\\\\n', E2)
> fprintf('V[X]&=%g\n', V)
> disp('\end{align}')
> #+end_src
>
> Executing the src block leads
>
> #+RESULTS:
> #+BEGIN_EXPORT latex
> \begin{align}
> E[X]&=4\\
> E^2[X]&=20\\
> V[X]&=4
> \end{align}
> #+END_EXPORT
>
> But if I now want to export the org file to html, the latex constructs
> are not exported.
>
> I have to remove the
> #+BEGIN_EXPORT latex
> #+END_EXPORT
>
> Manually which is cumbersome.
>
> So I need to modify the line
> #+begin_src matlab :results output latex :exports results
>
> But whatever I tried either there was not result exported, or when when
> it was the result was not converted to HTML.
>
> Any help is appreciated
>
> Regards
>
> Uwe Brauer
>
>
>

[-- Attachment #2: Type: text/html, Size: 2357 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: org file: export matlab to latex, then to html
  2018-05-25 15:20 ` John Kitchin
@ 2018-05-26  8:28   ` Uwe Brauer
  0 siblings, 0 replies; 3+ messages in thread
From: Uwe Brauer @ 2018-05-26  8:28 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 551 bytes --]

>>> "John" == John Kitchin <jkitchin@andrew.cmu.edu> writes:

   > what if you use :wrap latex in the header? That should wrap the
   > output in a latex block, which seems to export to html for me.

Hi

I presume you mean:

#+begin_src matlab :results output latex :exports results :wrap latex
X=[1,2,3,4,5,6,7];
p=[1/7 1/7 1/7 1/7 1/7 1/7 1/7];
E=X*p';
x2=X.*X;
E2=x2*p';
V=E2-E^2;
disp('\begin{align}')
fprintf('E[X]&=%g\\\\ \n', E)
fprintf('E^2[X]&=%g\\\\\n', E2)
fprintf('V[X]&=%g\n', V)
disp('\end{align}')
#+end_src


That works nicely thanks!

[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5025 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-05-26  8:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-25 13:15 org file: export matlab to latex, then to html Uwe Brauer
2018-05-25 15:20 ` John Kitchin
2018-05-26  8:28   ` Uwe Brauer

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).