emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* when executing a src block with latex construct, display problem because of +
@ 2021-05-15 13:31 Uwe Brauer
  2021-05-15 17:25 ` Berry, Charles via General discussions about Org-mode.
  0 siblings, 1 reply; 7+ messages in thread
From: Uwe Brauer @ 2021-05-15 13:31 UTC (permalink / raw)
  To: emacs-orgmode


Hi 

I have the following src block

#+begin_src matlab :results output raw :exports code  :eval never-export
addpath /home/oub/ALLES/HGs/Matlab-init/Statistic
sens=0.7;
spec=0.95;
aspec=1-spec;
prob=0.1;
sal=1-prob;
[bp,bpinv,bn,bninv]=mibayes(sens,spec,prob);
disp('\begin{align*}')
disp('P(\text{Covid19}|\text{+})&=\frac{P(\text{+}|\text{Covid19})P(\text{Covid19})}{P(\text{+}|\text{Covid19})P(\text{Covid19})+P(\text{+}|\text{No-Covid19})P(\text{No-Covid19})}\\')
fprintf('P(\\text{No-Covid19}) &= 1- P(\\text{Covid19}) = 1-%g=%g\\\\ \n',prob,sal)
fprintf('P(\\text{+}|\\text{No-Covid19}) &= 1-    P(\\text{-}|\\text{No-Covid19}) = 1-%g=%g \\\\ \n',spec,aspec)
fprintf('&=\\frac{%g \\cdot %g}{%g\\cdot%g + (1-%g)\\cdot %g}\\\\ \n',spec,prob,spec,prob,spec,sal)
fprintf('P(\\text{Covid19}|-)&=%g \\\\ \n', bp);
fprintf('P(\\text{No-Covid19}|+)&=1-P(\\text{Covid19}|+)=%g \\\\ \n', bpinv);
disp('\end{align*}')
#+end_src

That is exported to 
#+RESULTS:
\begin{align*}
P(\text{Covid19}|\text{+})&=\frac{P(\text{+}|\text{Covid19})P(\text{Covid19})}{P(\text{+}|\text{Covid19})P(\text{Covid19})+P(\text{+}|\text{No-Covid19})P(\text{No-Covid19})}\\
P(\text{No-Covid19}) &= 1- P(\text{Covid19}) = 1-0.1=0.9\\ 
P(\text{+}|\text{No-Covid19}) &= 1-    P(\text{-}|\text{No-Covid19}) = 1-0.95=0.05 \\ 
&=\frac{0.95 \cdot 0.1}{0.95\cdot0.1 + (1-0.95)\cdot 0.9}\\ 
P(\text{Covid19}|-)&=0.000139982 \\ 
P(\text{No-Covid19}|+)&=1-P(\text{Covid19}|+)=0.99986 \\ 
\end{align*}

Now in my org mode file, the lines between the +

\text{+})&=\frac{P(\text{+}|\text{Covid19})P(\text{Covid19})}{P(\text{+}|\text{Covid19})P(\text{Covid19})+P(\text{+}|\text{No-Covid19})P(\text{No-Covid19})}\\ 

Get a overstrike.

How can I avoid that?

Thanks and regards

Uwe Brauer 



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

* Re: when executing a src block with latex construct, display problem because of +
  2021-05-15 13:31 when executing a src block with latex construct, display problem because of + Uwe Brauer
@ 2021-05-15 17:25 ` Berry, Charles via General discussions about Org-mode.
  2021-05-15 18:10   ` Uwe Brauer
  0 siblings, 1 reply; 7+ messages in thread
From: Berry, Charles via General discussions about Org-mode. @ 2021-05-15 17:25 UTC (permalink / raw)
  To: Uwe Brauer; +Cc: Help Emacs Orgmode

Uwe,

> On May 15, 2021, at 6:31 AM, Uwe Brauer <oub@mat.ucm.es> wrote:
> 
> 
> Hi 
> 
> I have the following src block
> 
> #+begin_src matlab :results output raw :exports code  :eval never-export
> addpath /home/oub/ALLES/HGs/Matlab-init/Statistic
> sens=0.7;
> spec=0.95;
> aspec=1-spec;
> prob=0.1;
> sal=1-prob;
> [bp,bpinv,bn,bninv]=mibayes(sens,spec,prob);
> disp('\begin{align*}')
> disp('P(\text{Covid19}|\text{+})&=\frac{P(\text{+}|\text{Covid19})P(\text{Covid19})}{P(\text{+}|\text{Covid19})P(\text{Covid19})+P(\text{+}|\text{No-Covid19})P(\text{No-Covid19})}\\')
> fprintf('P(\\text{No-Covid19}) &= 1- P(\\text{Covid19}) = 1-%g=%g\\\\ \n',prob,sal)
> fprintf('P(\\text{+}|\\text{No-Covid19}) &= 1-    P(\\text{-}|\\text{No-Covid19}) = 1-%g=%g \\\\ \n',spec,aspec)
> fprintf('&=\\frac{%g \\cdot %g}{%g\\cdot%g + (1-%g)\\cdot %g}\\\\ \n',spec,prob,spec,prob,spec,sal)
> fprintf('P(\\text{Covid19}|-)&=%g \\\\ \n', bp);
> fprintf('P(\\text{No-Covid19}|+)&=1-P(\\text{Covid19}|+)=%g \\\\ \n', bpinv);
> disp('\end{align*}')
> #+end_src
> 
> That is exported to 
> #+RESULTS:
> \begin{align*}
> P(\text{Covid19}|\text{+})&=\frac{P(\text{+}|\text{Covid19})P(\text{Covid19})}{P(\text{+}|\text{Covid19})P(\text{Covid19})+P(\text{+}|\text{No-Covid19})P(\text{No-Covid19})}\\
> P(\text{No-Covid19}) &= 1- P(\text{Covid19}) = 1-0.1=0.9\\ 
> P(\text{+}|\text{No-Covid19}) &= 1-    P(\text{-}|\text{No-Covid19}) = 1-0.95=0.05 \\ 
> &=\frac{0.95 \cdot 0.1}{0.95\cdot0.1 + (1-0.95)\cdot 0.9}\\ 
> P(\text{Covid19}|-)&=0.000139982 \\ 
> P(\text{No-Covid19}|+)&=1-P(\text{Covid19}|+)=0.99986 \\ 
> \end{align*}
> 
> Now in my org mode file, the lines between the +
> 
> \text{+})&=\frac{P(\text{+}|\text{Covid19})P(\text{Covid19})}{P(\text{+}|\text{Covid19})P(\text{Covid19})+P(\text{+}|\text{No-Covid19})P(\text{No-Covid19})}\\ 
> 
> Get a overstrike.
> 
> How can I avoid that?


Customize `org-src-lang-modes' adding ` ("matlab" . octave)'.

HTH,

Chuck




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

* Re: when executing a src block with latex construct, display problem because of +
  2021-05-15 17:25 ` Berry, Charles via General discussions about Org-mode.
@ 2021-05-15 18:10   ` Uwe Brauer
  2021-05-15 19:15     ` Berry, Charles via General discussions about Org-mode.
  0 siblings, 1 reply; 7+ messages in thread
From: Uwe Brauer @ 2021-05-15 18:10 UTC (permalink / raw)
  To: Berry, Charles; +Cc: Uwe Brauer, Help Emacs Orgmode


[-- Attachment #1.1: Type: text/plain, Size: 2824 bytes --]

>>> "BC" == Berry, Charles <ccberry@health.ucsd.edu> writes:

> Uwe,
>> On May 15, 2021, at 6:31 AM, Uwe Brauer <oub@mat.ucm.es> wrote:
>> 
>> 
>> Hi 
>> 
>> I have the following src block
>> 
>> #+begin_src matlab :results output raw :exports code  :eval never-export
>> addpath /home/oub/ALLES/HGs/Matlab-init/Statistic
>> sens=0.7;
>> spec=0.95;
>> aspec=1-spec;
>> prob=0.1;
>> sal=1-prob;
>> [bp,bpinv,bn,bninv]=mibayes(sens,spec,prob);
>> disp('\begin{align*}')
>> disp('P(\text{Covid19}|\text{+})&=\frac{P(\text{+}|\text{Covid19})P(\text{Covid19})}{P(\text{+}|\text{Covid19})P(\text{Covid19})+P(\text{+}|\text{No-Covid19})P(\text{No-Covid19})}\\')
>> fprintf('P(\\text{No-Covid19}) &= 1- P(\\text{Covid19}) = 1-%g=%g\\\\ \n',prob,sal)
>> fprintf('P(\\text{+}|\\text{No-Covid19}) &= 1-    P(\\text{-}|\\text{No-Covid19}) = 1-%g=%g \\\\ \n',spec,aspec)
>> fprintf('&=\\frac{%g \\cdot %g}{%g\\cdot%g + (1-%g)\\cdot %g}\\\\ \n',spec,prob,spec,prob,spec,sal)
>> fprintf('P(\\text{Covid19}|-)&=%g \\\\ \n', bp);
>> fprintf('P(\\text{No-Covid19}|+)&=1-P(\\text{Covid19}|+)=%g \\\\ \n', bpinv);
>> disp('\end{align*}')
>> #+end_src
>> 
>> That is exported to 
>> #+RESULTS:
>> \begin{align*}
>> P(\text{Covid19}|\text{+})&=\frac{P(\text{+}|\text{Covid19})P(\text{Covid19})}{P(\text{+}|\text{Covid19})P(\text{Covid19})+P(\text{+}|\text{No-Covid19})P(\text{No-Covid19})}\\
>> P(\text{No-Covid19}) &= 1- P(\text{Covid19}) = 1-0.1=0.9\\ 
>> P(\text{+}|\text{No-Covid19}) &= 1-    P(\text{-}|\text{No-Covid19}) = 1-0.95=0.05 \\ 
>> &=\frac{0.95 \cdot 0.1}{0.95\cdot0.1 + (1-0.95)\cdot 0.9}\\ 
>> P(\text{Covid19}|-)&=0.000139982 \\ 
>> P(\text{No-Covid19}|+)&=1-P(\text{Covid19}|+)=0.99986 \\ 
>> \end{align*}
>> 
>> Now in my org mode file, the lines between the +
>> 
>> \text{+})&=\frac{P(\text{+}|\text{Covid19})P(\text{Covid19})}{P(\text{+}|\text{Covid19})P(\text{Covid19})+P(\text{+}|\text{No-Covid19})P(\text{No-Covid19})}\\
>> 
>> Get a overstrike.
>> 
>> How can I avoid that?


> Customize `org-src-lang-modes' adding ` ("matlab" . octave)'.

Thanks, it did not help. To make this clear the problem occurs in the
result block, not in the source block. 



 That is exported to 
 #+RESULTS:
 \begin{align*}
 P(\text{Covid19}|\text{+})&=\frac{P(\text{+}|\text{Covid19})P(\text{Covid19})}{P(\text{+}|\text{Covid19})P(\text{Covid19})+P(\text{+}|\text{No-Covid19})P(\text{No-Covid19})}\\
 P(\text{No-Covid19}) &= 1- P(\text{Covid19}) = 1-0.1=0.9\\ 
 P(\text{+}|\text{No-Covid19}) &= 1-    P(\text{-}|\text{No-Covid19}) = 1-0.95=0.05 \\ 
 &=\frac{0.95 \cdot 0.1}{0.95\cdot0.1 + (1-0.95)\cdot 0.9}\\ 
 P(\text{Covid19}|-)&=0.000139982 \\ 
 P(\text{No-Covid19}|+)&=1-P(\text{Covid19}|+)=0.99986 \\ 
 \end{align*}


I attach a screenshot just in case

Uwe 


[-- Attachment #1.2: org-src.png --]
[-- Type: image/png, Size: 247913 bytes --]

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

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

* Re: when executing a src block with latex construct, display problem because of +
  2021-05-15 18:10   ` Uwe Brauer
@ 2021-05-15 19:15     ` Berry, Charles via General discussions about Org-mode.
  2021-05-15 20:18       ` Uwe Brauer
  0 siblings, 1 reply; 7+ messages in thread
From: Berry, Charles via General discussions about Org-mode. @ 2021-05-15 19:15 UTC (permalink / raw)
  To: Uwe Brauer; +Cc: Help Emacs Orgmode

Uwe,

[snip]

> On May 15, 2021, at 11:10 AM, Uwe Brauer <oub@mat.ucm.es> wrote:
> 
> Thanks, it did not help. To make this clear the problem occurs in the
> result block, not in the source block. 
> 
> 
> 
> That is exported to 
> #+RESULTS:
> \begin{align*}
> P(\text{Covid19}|\text{+})&=\frac{P(\text{+}|\text{Covid19})P(\text{Covid19})}{P(\text{+}|\text{Covid19})P(\text{Covid19})+P(\text{+}|\text{No-Covid19})P(\text{No-Covid19})}\\
> P(\text{No-Covid19}) &= 1- P(\text{Covid19}) = 1-0.1=0.9\\ 
> P(\text{+}|\text{No-Covid19}) &= 1-    P(\text{-}|\text{No-Covid19}) = 1-0.95=0.05 \\ 
> &=\frac{0.95 \cdot 0.1}{0.95\cdot0.1 + (1-0.95)\cdot 0.9}\\ 
> P(\text{Covid19}|-)&=0.000139982 \\ 
> P(\text{No-Covid19}|+)&=1-P(\text{Covid19}|+)=0.99986 \\ 
> \end{align*}
> 
> 
> I attach a screenshot just in case
> 
> Uwe 

[screenshot deleted]

Oh, I misunderstood.

The result looks like latex. So why not use `:results output latex' ?

HTH,
Chuck 





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

* Re: when executing a src block with latex construct, display problem because of +
  2021-05-15 19:15     ` Berry, Charles via General discussions about Org-mode.
@ 2021-05-15 20:18       ` Uwe Brauer
  2021-05-15 22:44         ` Berry, Charles via General discussions about Org-mode.
  0 siblings, 1 reply; 7+ messages in thread
From: Uwe Brauer @ 2021-05-15 20:18 UTC (permalink / raw)
  To: Berry, Charles; +Cc: Uwe Brauer, Help Emacs Orgmode

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

Chuck, 
   > Uwe,
   > [snip]


   > [screenshot deleted]

   > Oh, I misunderstood.

   > The result looks like latex. So why not use `:results output latex' ?

I tried that also, then however the result is 
#+RESULTS:
#+begin_export latex
\begin{align*}
P(\text{Covid19}|\text{+})&=\frac{P(\text{+}|\text{Covid19})P(\text{Covid19})}{P(\text{+}|\text{Covid19})P(\text{Covid19})+P(\text{+}|\text{No-Covid19})P(\text{No-Covid19})}\\
P(\text{No-Covid19}) &= 1- P(\text{Covid19}) = 1-0.1=0.9\\ 
P(\text{+}|\text{No-Covid19}) &= 1-    P(\text{-}|\text{No-Covid19}) = 1-0.95=0.05 \\ 
&=\frac{0.95 \cdot 0.1}{0.95\cdot0.1 + (1-0.95)\cdot 0.9}\\ 
P(\text{Covid19}|-)&=0.608696 \\ 
P(\text{No-Covid19}|+)&=1-P(\text{Covid19}|+)=0.391304 \\ 
\end{align*}
#+end_export

That is ok for displaying, but if I now want also to export this org
file to latex, the align construct is not exported, sigh. 

As the great philosopher M. Jagger said:

«You Can't Always Get What You Want»

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

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

* Re: when executing a src block with latex construct, display problem because of +
  2021-05-15 20:18       ` Uwe Brauer
@ 2021-05-15 22:44         ` Berry, Charles via General discussions about Org-mode.
  2021-05-16  7:13           ` Uwe Brauer
  0 siblings, 1 reply; 7+ messages in thread
From: Berry, Charles via General discussions about Org-mode. @ 2021-05-15 22:44 UTC (permalink / raw)
  To: Uwe Brauer; +Cc: Help Emacs Orgmode

Uwe,

You used `:exports code :eval never-export' (from an earlier posting). 

I think you want `:exports both :eval never-export' to keep babel from removing the results.

HTH,
Chuck

> On May 15, 2021, at 1:18 PM, Uwe Brauer <oub@mat.ucm.es> wrote:
> 
> Chuck, 
>> Uwe,
>> [snip]
> 
> 
>> [screenshot deleted]
> 
>> Oh, I misunderstood.
> 
>> The result looks like latex. So why not use `:results output latex' ?
> 
> I tried that also, then however the result is 
> #+RESULTS:
> #+begin_export latex
> \begin{align*}
> P(\text{Covid19}|\text{+})&=\frac{P(\text{+}|\text{Covid19})P(\text{Covid19})}{P(\text{+}|\text{Covid19})P(\text{Covid19})+P(\text{+}|\text{No-Covid19})P(\text{No-Covid19})}\\
> P(\text{No-Covid19}) &= 1- P(\text{Covid19}) = 1-0.1=0.9\\ 
> P(\text{+}|\text{No-Covid19}) &= 1-    P(\text{-}|\text{No-Covid19}) = 1-0.95=0.05 \\ 
> &=\frac{0.95 \cdot 0.1}{0.95\cdot0.1 + (1-0.95)\cdot 0.9}\\ 
> P(\text{Covid19}|-)&=0.608696 \\ 
> P(\text{No-Covid19}|+)&=1-P(\text{Covid19}|+)=0.391304 \\ 
> \end{align*}
> #+end_export
> 
> That is ok for displaying, but if I now want also to export this org
> file to latex, the align construct is not exported, sigh. 
> 
> As the great philosopher M. Jagger said:
> 
> «You Can't Always Get What You Want»


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

* Re: when executing a src block with latex construct, display problem because of +
  2021-05-15 22:44         ` Berry, Charles via General discussions about Org-mode.
@ 2021-05-16  7:13           ` Uwe Brauer
  0 siblings, 0 replies; 7+ messages in thread
From: Uwe Brauer @ 2021-05-16  7:13 UTC (permalink / raw)
  To: Berry, Charles; +Cc: Uwe Brauer, Help Emacs Orgmode

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

>>> "BC" == Berry, Charles <ccberry@health.ucsd.edu> writes:
Chuck


> Uwe,
> You used `:exports code :eval never-export' (from an earlier posting). 

> I think you want `:exports both :eval never-export' to keep babel from removing the results.

Thanks very much, that was the essential bit of code. Solved!

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

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

end of thread, other threads:[~2021-05-16  7:14 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-15 13:31 when executing a src block with latex construct, display problem because of + Uwe Brauer
2021-05-15 17:25 ` Berry, Charles via General discussions about Org-mode.
2021-05-15 18:10   ` Uwe Brauer
2021-05-15 19:15     ` Berry, Charles via General discussions about Org-mode.
2021-05-15 20:18       ` Uwe Brauer
2021-05-15 22:44         ` Berry, Charles via General discussions about Org-mode.
2021-05-16  7:13           ` Uwe Brauer

Code repositories for project(s) associated with this 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).