emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* strange output when executing matlab using babel, strange ,
@ 2019-05-31 13:08 Uwe Brauer
  2019-05-31 13:57 ` John Kitchin
  2019-05-31 14:50 ` Nick Dokos
  0 siblings, 2 replies; 7+ messages in thread
From: Uwe Brauer @ 2019-05-31 13:08 UTC (permalink / raw)
  To: emacs-orgmode



Hi 

I am running Ubuntu 16.06, matlab 2018b and  I am using the python
kernel to use matlab from within org mode


Thanks to John Kitchin, I have the following setting

* Lisp setting
#+BEGIN_SRC emacs-lisp
(setq org-confirm-babel-evaluate nil)   ;don't prompt me to confirm everytime I want to evaluate a block

;;; display/update images in the buffer after I evaluate
(add-hook 'org-babel-after-execute-hook 'org-display-inline-images 'append)
    

(add-to-list 'org-src-lang-modes '("matlab" . matlab))
(setq python-shell-interpreter "python3")

;; set default headers for convenience
(setq org-babel-default-header-args:matlab
      '((:results . "output replace")
	(:session . "matlab")
	(:kernel . "matlab")
	(:exports . "code")
	(:cache .   "no")
	(:noweb . "no")
	(:hlines . "no")
	(:tangle . "no")))

(defalias 'org-babel-execute:matlab 'org-babel-execute:ipython)
(defalias 'org-babel-prep-session:matlab 'org-babel-prep-session:ipython)
(defalias 'org-babel-matlab-initiate-session 'org-babel-ipython-initiate-session)
#+END_SRC


* The problem

When I run 

#+begin_src matlab :results output latex :exports results  :eval never-export 
disp('*Step 3:*')
disp('*Step 3:*  Calculate this')
#+end_src


On obtain 
#+RESULTS:
#+begin_export latex
,*Step 3:*
,*Step 3:*  Calculate this
#+end_export


Instead of 

#+begin_export latex
*Step 3:*
*Step 3:*  Calculate this
#+end_export


Does anybody have an idea what is wrong there?

Uwe Brauer 

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

* Re: strange output when executing matlab using babel, strange ,
  2019-05-31 13:08 strange output when executing matlab using babel, strange , Uwe Brauer
@ 2019-05-31 13:57 ` John Kitchin
  2019-05-31 14:30   ` Uwe Brauer
  2019-05-31 14:50 ` Nick Dokos
  1 sibling, 1 reply; 7+ messages in thread
From: John Kitchin @ 2019-05-31 13:57 UTC (permalink / raw)
  To: org-mode-email

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

I believe you are seeing org's escaping at play. It puts a comma in front
of the leading *. It must think that it is a heading in org-syntax, and so
it escapes it to avoid some issues.

I think here it is a bug since that is not a heading. can you use some
other leading character? I don't think the * have any significance in latex.

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 31, 2019 at 9:11 AM Uwe Brauer <oub@mat.ucm.es> wrote:

>
>
> Hi
>
> I am running Ubuntu 16.06, matlab 2018b and  I am using the python
> kernel to use matlab from within org mode
>
>
> Thanks to John Kitchin, I have the following setting
>
> * Lisp setting
> #+BEGIN_SRC emacs-lisp
> (setq org-confirm-babel-evaluate nil)   ;don't prompt me to confirm
> everytime I want to evaluate a block
>
> ;;; display/update images in the buffer after I evaluate
> (add-hook 'org-babel-after-execute-hook 'org-display-inline-images 'append)
>
>
> (add-to-list 'org-src-lang-modes '("matlab" . matlab))
> (setq python-shell-interpreter "python3")
>
> ;; set default headers for convenience
> (setq org-babel-default-header-args:matlab
>       '((:results . "output replace")
>         (:session . "matlab")
>         (:kernel . "matlab")
>         (:exports . "code")
>         (:cache .   "no")
>         (:noweb . "no")
>         (:hlines . "no")
>         (:tangle . "no")))
>
> (defalias 'org-babel-execute:matlab 'org-babel-execute:ipython)
> (defalias 'org-babel-prep-session:matlab 'org-babel-prep-session:ipython)
> (defalias 'org-babel-matlab-initiate-session
> 'org-babel-ipython-initiate-session)
> #+END_SRC
>
>
> * The problem
>
> When I run
>
> #+begin_src matlab :results output latex :exports results  :eval
> never-export
> disp('*Step 3:*')
> disp('*Step 3:*  Calculate this')
> #+end_src
>
>
> On obtain
> #+RESULTS:
> #+begin_export latex
> ,*Step 3:*
> ,*Step 3:*  Calculate this
> #+end_export
>
>
> Instead of
>
> #+begin_export latex
> *Step 3:*
> *Step 3:*  Calculate this
> #+end_export
>
>
> Does anybody have an idea what is wrong there?
>
> Uwe Brauer
>
>
>

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

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

* Re: strange output when executing matlab using babel, strange ,
  2019-05-31 13:57 ` John Kitchin
@ 2019-05-31 14:30   ` Uwe Brauer
  0 siblings, 0 replies; 7+ messages in thread
From: Uwe Brauer @ 2019-05-31 14:30 UTC (permalink / raw)
  To: emacs-orgmode

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

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

> I believe you are seeing org's escaping at play. It puts a comma in front
> of the leading *. It must think that it is a heading in org-syntax, and so
> it escapes it to avoid some issues.

> I think here it is a bug since that is not a heading. can you use some
> other leading character? I don't think the * have any significance in latex.

The point is after executing the matlab code, I export the org file to
latex and then the * * gets translated to \textbf{} which is what I
want.

I could use / / instead obtaining italics or emp, but I want bold

I could write \textbf but I want to write as little latex commands as
possible (that is the work of the converter) instead I wan to use org
mode syntaxis for the font highlighting.

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

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

* Re: strange output when executing matlab using babel, strange ,
  2019-05-31 13:08 strange output when executing matlab using babel, strange , Uwe Brauer
  2019-05-31 13:57 ` John Kitchin
@ 2019-05-31 14:50 ` Nick Dokos
  2019-05-31 14:56   ` Uwe Brauer
  1 sibling, 1 reply; 7+ messages in thread
From: Nick Dokos @ 2019-05-31 14:50 UTC (permalink / raw)
  To: emacs-orgmode

Uwe Brauer <oub@mat.ucm.es> writes:

> Hi 
>
> I am running Ubuntu 16.06, matlab 2018b and  I am using the python
> kernel to use matlab from within org mode
>
> ....
>
> * The problem
>
> When I run 
>
> #+begin_src matlab :results output latex :exports results  :eval never-export 
> disp('*Step 3:*')
> disp('*Step 3:*  Calculate this')
> #+end_src
>
> On obtain 
> #+RESULTS:
>
> #+begin_export latex
> ,*Step 3:*
> ,*Step 3:*  Calculate this
> #+end_export
>
> Instead of 
>
> #+begin_export latex
> *Step 3:*
> *Step 3:*  Calculate this
> #+end_export
>

> Does anybody have an idea what is wrong there?
>

I don't think anything is wrong: org quotes lines that look like
headlines in the babel output by prepending the comma.

-- 
Nick

"There are only two hard problems in computer science: cache
invalidation, naming things, and off-by-one errors." -Martin Fowler

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

* Re: strange output when executing matlab using babel, strange ,
  2019-05-31 14:50 ` Nick Dokos
@ 2019-05-31 14:56   ` Uwe Brauer
  2019-05-31 15:59     ` John Kitchin
  0 siblings, 1 reply; 7+ messages in thread
From: Uwe Brauer @ 2019-05-31 14:56 UTC (permalink / raw)
  To: emacs-orgmode

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


   > Uwe Brauer <oub@mat.ucm.es> writes:


   > I don't think anything is wrong: org quotes lines that look like
   > headlines in the babel output by prepending the comma.

But it shouldn't I want the output to be surrounded by * * because then
it is exported to latex as \textbf 

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

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

* Re: strange output when executing matlab using babel, strange ,
  2019-05-31 14:56   ` Uwe Brauer
@ 2019-05-31 15:59     ` John Kitchin
  2019-05-31 16:46       ` Uwe Brauer
  0 siblings, 1 reply; 7+ messages in thread
From: John Kitchin @ 2019-05-31 15:59 UTC (permalink / raw)
  To: org-mode-email

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

you are putting it in :results output latex though, so it won't be changed
on export. The contents of that block will be used verbatim I think in the
latex export. Maybe you can change latex to raw instead. Then the org
syntax will get converted to \textbf.

Otherwise, I think you have to put the latex markup in the output.

I still think it is a bug though, *step3:* does not act like a headline,
and isn't valid headline syntax even at the beginning of a line. I don't
think it should be getting escaped here.



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 31, 2019 at 10:59 AM Uwe Brauer <oub@mat.ucm.es> wrote:

>
>    > Uwe Brauer <oub@mat.ucm.es> writes:
>
>
>    > I don't think anything is wrong: org quotes lines that look like
>    > headlines in the babel output by prepending the comma.
>
> But it shouldn't I want the output to be surrounded by * * because then
> it is exported to latex as \textbf
>

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

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

* Re: strange output when executing matlab using babel, strange ,
  2019-05-31 15:59     ` John Kitchin
@ 2019-05-31 16:46       ` Uwe Brauer
  0 siblings, 0 replies; 7+ messages in thread
From: Uwe Brauer @ 2019-05-31 16:46 UTC (permalink / raw)
  To: emacs-orgmode

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

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

> you are putting it in :results output latex though, so it won't be changed
> on export. The contents of that block will be used verbatim I think in the
> latex export. Maybe you can change latex to raw instead. Then the org
> syntax will get converted to \textbf.

Right! Raw is the solution

#+begin_src matlab :results output raw :exports results :eval never-export 

#+end_src

Does precisely what I want, thanks a lot

> Otherwise, I think you have to put the latex markup in the output.

> I still think it is a bug though, *step3:* does not act like a headline,
> and isn't valid headline syntax even at the beginning of a line. I don't
> think it should be getting escaped here.

That is what I think, it is a bug, Nick does not agree.


> 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 31, 2019 at 10:59 AM Uwe Brauer <oub@mat.ucm.es> wrote:

>> 
>> > Uwe Brauer <oub@mat.ucm.es> writes:
>> 
>> 
>> > I don't think anything is wrong: org quotes lines that look like
>> > headlines in the babel output by prepending the comma.
>> 
>> But it shouldn't I want the output to be surrounded by * * because then
>> it is exported to latex as \textbf
>> 

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

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

end of thread, other threads:[~2019-05-31 16:50 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-05-31 13:08 strange output when executing matlab using babel, strange , Uwe Brauer
2019-05-31 13:57 ` John Kitchin
2019-05-31 14:30   ` Uwe Brauer
2019-05-31 14:50 ` Nick Dokos
2019-05-31 14:56   ` Uwe Brauer
2019-05-31 15:59     ` John Kitchin
2019-05-31 16:46       ` 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).