emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* displaying equations with ob-latex
@ 2021-05-06  9:54 michael-franzese
  2021-05-06 12:37 ` Christopher Dimech
  2021-05-06 12:44 ` pietru
  0 siblings, 2 replies; 19+ messages in thread
From: michael-franzese @ 2021-05-06  9:54 UTC (permalink / raw)
  To: Help Emacs Orgmode


I am trying to use ob-latex but equations are not being displayed in emacs
when I try to execute with "C-c C-c".






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

* Re: displaying equations with ob-latex
  2021-05-06  9:54 displaying equations with ob-latex michael-franzese
@ 2021-05-06 12:37 ` Christopher Dimech
  2021-05-06 12:44 ` pietru
  1 sibling, 0 replies; 19+ messages in thread
From: Christopher Dimech @ 2021-05-06 12:37 UTC (permalink / raw)
  To: michael-franzese; +Cc: Help Emacs Orgmode

I am unsure about this, but mathjax could be able to display
math format in emacs.  Never tried this in emacs though, using
ob-latex.  Had a go, but the display is not right.


> Sent: Thursday, May 06, 2021 at 9:54 PM
> From: michael-franzese@gmx.com
> To: "Help Emacs Orgmode" <emacs-orgmode@gnu.org>
> Subject: displaying equations with ob-latex
>
>
> I am trying to use ob-latex but equations are not being displayed in emacs
> when I try to execute with "C-c C-c".
>
>
>
>
>
>


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

* Re: displaying equations with ob-latex
  2021-05-06  9:54 displaying equations with ob-latex michael-franzese
  2021-05-06 12:37 ` Christopher Dimech
@ 2021-05-06 12:44 ` pietru
  1 sibling, 0 replies; 19+ messages in thread
From: pietru @ 2021-05-06 12:44 UTC (permalink / raw)
  To: michael-franzese; +Cc: Help Emacs Orgmode

I've got the same problem.




> Sent: Thursday, May 06, 2021 at 9:54 PM
> From: michael-franzese@gmx.com
> To: "Help Emacs Orgmode" <emacs-orgmode@gnu.org>
> Subject: displaying equations with ob-latex
>
>
> I am trying to use ob-latex but equations are not being displayed in emacs
> when I try to execute with "C-c C-c".
>
>
>
>
>
>


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

* Displaying equations with ob-latex
  2021-05-07  3:36               ` michael-franzese
@ 2021-05-07  4:40                 ` Christopher Dimech
  0 siblings, 0 replies; 19+ messages in thread
From: Christopher Dimech @ 2021-05-07  4:40 UTC (permalink / raw)
  To: michael-franzese; +Cc: Berry, Charles, Help Emacs Orgmode, Ihor Radchenko

Barry has shown how to use "C-c C-x C-l" (org-latex-preview &optional ARG)
to preview a latex fragment at point.

I then see no point in enclosing latex commands in "#+begin_src" and "#+end_src";
because one can just write any lates expression an a line such as below, them slamming
it with "C-c C-x C-l".

\(y = x\beta + \epsilon\)

Is there a related command that previews all equations in the buffer, rather than
only for a latex fragment at point.

With a bit more work ob-latex can be pleasantly improved.

Another comment is to allow the use of "plain tex", because one can then copy
from texinfo math commands. In the last few months, texinfo was greatly improved
for working with math (e.g. preview with mathjax, easy scaling with mouse wheel).

The same could happen with ob-latex.

> Sent: Friday, May 07, 2021 at 3:36 PM
> From: michael-franzese@gmx.com
> To: "Ihor Radchenko" <yantar92@gmail.com>
> Cc: "Berry, Charles" <ccberry@health.ucsd.edu>, "Help Emacs Orgmode" <emacs-orgmode@gnu.org>
> Subject: Re: displaying equations with ob-latex
>
> Another downside is that you got to slam "C-c C-x C-l" for every equation one writes
> in the drawer.  The solution is not very usable but at least I could display equations
> as I do with texinfo from org.  But for serious work, I need to be fast.  Currently
> it will be frustrating enough for users.
>
> > Sent: Friday, May 07, 2021 at 3:14 PM
> > From: "Ihor Radchenko" <yantar92@gmail.com>
> > To: michael-franzese@gmx.com
> > Cc: "Berry, Charles" <ccberry@health.ucsd.edu>, "Help Emacs Orgmode" <emacs-orgmode@gnu.org>
> > Subject: Re: displaying equations with ob-latex
> >
> > michael-franzese@gmx.com writes:
> >
> > > Ok, I got some progress, I did "C-C C-x C-l" and got the equation.
> > >
> > > The equation in extremely small though.
> >
> > By default, it should have the same height with you text line.
> > You can change it though. I have the following snippet in my config:
> >
> > (setq org-format-latex-options
> >       (quote
> >        (:foreground default :background default :scale 2.0 :justify center :html-foreground "Black" :html-background "Transparent" :html-scale 1.0 :matchers
> > 		    ("begin" "$1" "$" "$$" "\\(" "\\["))));; 2x height of formulas
> >
>
>


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

* Re: displaying equations with ob-latex
  2021-05-07  3:14             ` Ihor Radchenko
  2021-05-07  3:20               ` michael-franzese
@ 2021-05-07  3:36               ` michael-franzese
  2021-05-07  4:40                 ` Displaying " Christopher Dimech
  1 sibling, 1 reply; 19+ messages in thread
From: michael-franzese @ 2021-05-07  3:36 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Berry, Charles, Help Emacs Orgmode

Another downside is that you got to slam "C-c C-x C-l" for every equation one writes
in the drawer.  The solution is not very usable but at least I could display equations
as I do with texinfo from org.  But for serious work, I need to be fast.  Currently
it will be frustrating enough for users.

> Sent: Friday, May 07, 2021 at 3:14 PM
> From: "Ihor Radchenko" <yantar92@gmail.com>
> To: michael-franzese@gmx.com
> Cc: "Berry, Charles" <ccberry@health.ucsd.edu>, "Help Emacs Orgmode" <emacs-orgmode@gnu.org>
> Subject: Re: displaying equations with ob-latex
>
> michael-franzese@gmx.com writes:
>
> > Ok, I got some progress, I did "C-C C-x C-l" and got the equation.
> >
> > The equation in extremely small though.
>
> By default, it should have the same height with you text line.
> You can change it though. I have the following snippet in my config:
>
> (setq org-format-latex-options
>       (quote
>        (:foreground default :background default :scale 2.0 :justify center :html-foreground "Black" :html-background "Transparent" :html-scale 1.0 :matchers
> 		    ("begin" "$1" "$" "$$" "\\(" "\\["))));; 2x height of formulas
>


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

* Re: displaying equations with ob-latex
  2021-05-07  3:18             ` displaying " Berry, Charles via General discussions about Org-mode.
@ 2021-05-07  3:22               ` michael-franzese
  0 siblings, 0 replies; 19+ messages in thread
From: michael-franzese @ 2021-05-07  3:22 UTC (permalink / raw)
  To: Berry, Charles; +Cc: Help Emacs Orgmode

Would people help me have a keybinding that changes the scale in
cyclic sequence, e.g. 2 3 4 5 4 3 2

Regards

> Sent: Friday, May 07, 2021 at 3:18 PM
> From: "Berry, Charles" <ccberry@health.ucsd.edu>
> To: "michael-franzese@gmx.com" <michael-franzese@gmx.com>
> Cc: "Help Emacs Orgmode" <emacs-orgmode@gnu.org>
> Subject: Re: displaying equations with ob-latex
>
>
>
> > On May 6, 2021, at 7:39 PM, michael-franzese@gmx.com wrote:
> >
> > Ok, I got some progress, I did "C-C C-x C-l" and got the equation.
> >
>
> Great!
>
>
> > The equation in extremely small though.
> >
>
>
> Try customizing `org-format-latex-options'. The :scale element controls size. I tried 2.0 and it seems like a good value for my screen.
>
> Best,
>
> Chuck
>
> >> Sent: Friday, May 07, 2021 at 1:36 PM
> >> From: "Berry, Charles" <ccberry@health.ucsd.edu>
> >> To: "michael-franzese@gmx.com" <michael-franzese@gmx.com>
> >> Cc: "Help Emacs Orgmode" <emacs-orgmode@gnu.org>
> >> Subject: Re: displaying equations with ob-latex
> >>
> >>
> >>
> >>> On May 6, 2021, at 4:20 PM, michael-franzese@gmx.com wrote:
> >>>
> >>> After I do "C-c C-c", I just get a message saying "Code block evaluation complete."
> >>>
> >>
> >>
> >> Are you doing this in a buffer that has ONLY the text between the `cut here' lines and exactly that?
> >>
> >> If not, please try it in such a buffer.
> >>
> >> It may help to copy and paste as typos in header names or values can be unnoticed and drastically alter behavior. If your mail client reformats text, maybe try copy and paste from the mail list archive.
> >>
> >> Also, check with point in the src block using C-c C-v C-i that the header args got processed properly. You should see lines like these in the *Help* buffer:
> >>
> >> :	:exports	none
> >>
> >> :	:results	drawer replace
> >>
> >>
> >> If you did it in such a buffer and the buffer is unaltered but still displays the message, I have to admit that I cannot tell from here what the problem might be.
> >>
> >> On my setup, things behave just as outlined.
> >>
> >> When I start emacs with -q, then M-S-; (require 'ob-latex) RET, then paste the text to *scratch* and delete the lisp comment at the top, then M-x org-mode RET, then C-c C-c with point in the src block, answer 'y e s RET' to the query, I get the equation displayed in the results drawer. And the export goes OK.
> >>
> >> I am using org-version 9.4.5.
> >>
> >> HTH,
> >>
> >> Chuck
> >>
> >>
> >>
>
>
>


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

* Re: displaying equations with ob-latex
  2021-05-07  3:14             ` Ihor Radchenko
@ 2021-05-07  3:20               ` michael-franzese
  2021-05-07  3:36               ` michael-franzese
  1 sibling, 0 replies; 19+ messages in thread
From: michael-franzese @ 2021-05-07  3:20 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Berry, Charles, Help Emacs Orgmode

The default does not work very well because as I zoom the text, the equation
remains the same height.

Could this playing around with drawers be eliminated, so things will behave as when
using texinfo with @display using mathjax.  It also allows you to zoom in and out
hard without any harm.


> Sent: Friday, May 07, 2021 at 3:14 PM
> From: "Ihor Radchenko" <yantar92@gmail.com>
> To: michael-franzese@gmx.com
> Cc: "Berry, Charles" <ccberry@health.ucsd.edu>, "Help Emacs Orgmode" <emacs-orgmode@gnu.org>
> Subject: Re: displaying equations with ob-latex
>
> michael-franzese@gmx.com writes:
>
> > Ok, I got some progress, I did "C-C C-x C-l" and got the equation.
> >
> > The equation in extremely small though.
>
> By default, it should have the same height with you text line.
> You can change it though. I have the following snippet in my config:
>
> (setq org-format-latex-options
>       (quote
>        (:foreground default :background default :scale 2.0 :justify center :html-foreground "Black" :html-background "Transparent" :html-scale 1.0 :matchers
> 		    ("begin" "$1" "$" "$$" "\\(" "\\["))));; 2x height of formulas
>


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

* Re: displaying equations with ob-latex
  2021-05-07  2:39           ` michael-franzese
  2021-05-07  3:14             ` Ihor Radchenko
@ 2021-05-07  3:18             ` Berry, Charles via General discussions about Org-mode.
  2021-05-07  3:22               ` michael-franzese
  1 sibling, 1 reply; 19+ messages in thread
From: Berry, Charles via General discussions about Org-mode. @ 2021-05-07  3:18 UTC (permalink / raw)
  To: michael-franzese; +Cc: Help Emacs Orgmode



> On May 6, 2021, at 7:39 PM, michael-franzese@gmx.com wrote:
> 
> Ok, I got some progress, I did "C-C C-x C-l" and got the equation.
> 

Great!


> The equation in extremely small though.
> 


Try customizing `org-format-latex-options'. The :scale element controls size. I tried 2.0 and it seems like a good value for my screen.

Best,

Chuck

>> Sent: Friday, May 07, 2021 at 1:36 PM
>> From: "Berry, Charles" <ccberry@health.ucsd.edu>
>> To: "michael-franzese@gmx.com" <michael-franzese@gmx.com>
>> Cc: "Help Emacs Orgmode" <emacs-orgmode@gnu.org>
>> Subject: Re: displaying equations with ob-latex
>> 
>> 
>> 
>>> On May 6, 2021, at 4:20 PM, michael-franzese@gmx.com wrote:
>>> 
>>> After I do "C-c C-c", I just get a message saying "Code block evaluation complete."
>>> 
>> 
>> 
>> Are you doing this in a buffer that has ONLY the text between the `cut here' lines and exactly that?
>> 
>> If not, please try it in such a buffer.
>> 
>> It may help to copy and paste as typos in header names or values can be unnoticed and drastically alter behavior. If your mail client reformats text, maybe try copy and paste from the mail list archive.
>> 
>> Also, check with point in the src block using C-c C-v C-i that the header args got processed properly. You should see lines like these in the *Help* buffer:
>> 
>> :	:exports	none
>> 
>> :	:results	drawer replace
>> 
>> 
>> If you did it in such a buffer and the buffer is unaltered but still displays the message, I have to admit that I cannot tell from here what the problem might be.
>> 
>> On my setup, things behave just as outlined.
>> 
>> When I start emacs with -q, then M-S-; (require 'ob-latex) RET, then paste the text to *scratch* and delete the lisp comment at the top, then M-x org-mode RET, then C-c C-c with point in the src block, answer 'y e s RET' to the query, I get the equation displayed in the results drawer. And the export goes OK.
>> 
>> I am using org-version 9.4.5.
>> 
>> HTH,
>> 
>> Chuck
>> 
>> 
>> 




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

* Re: displaying equations with ob-latex
  2021-05-07  2:39           ` michael-franzese
@ 2021-05-07  3:14             ` Ihor Radchenko
  2021-05-07  3:20               ` michael-franzese
  2021-05-07  3:36               ` michael-franzese
  2021-05-07  3:18             ` displaying " Berry, Charles via General discussions about Org-mode.
  1 sibling, 2 replies; 19+ messages in thread
From: Ihor Radchenko @ 2021-05-07  3:14 UTC (permalink / raw)
  To: michael-franzese; +Cc: Berry, Charles, Help Emacs Orgmode

michael-franzese@gmx.com writes:

> Ok, I got some progress, I did "C-C C-x C-l" and got the equation.
>
> The equation in extremely small though.

By default, it should have the same height with you text line.
You can change it though. I have the following snippet in my config:

(setq org-format-latex-options
      (quote
       (:foreground default :background default :scale 2.0 :justify center :html-foreground "Black" :html-background "Transparent" :html-scale 1.0 :matchers
		    ("begin" "$1" "$" "$$" "\\(" "\\["))));; 2x height of formulas


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

* Re: displaying equations with ob-latex
  2021-05-07  1:36         ` Berry, Charles via General discussions about Org-mode.
  2021-05-07  2:33           ` michael-franzese
@ 2021-05-07  2:39           ` michael-franzese
  2021-05-07  3:14             ` Ihor Radchenko
  2021-05-07  3:18             ` displaying " Berry, Charles via General discussions about Org-mode.
  1 sibling, 2 replies; 19+ messages in thread
From: michael-franzese @ 2021-05-07  2:39 UTC (permalink / raw)
  To: Berry, Charles; +Cc: Help Emacs Orgmode

Ok, I got some progress, I did "C-C C-x C-l" and got the equation.

The equation in extremely small though.

> Sent: Friday, May 07, 2021 at 1:36 PM
> From: "Berry, Charles" <ccberry@health.ucsd.edu>
> To: "michael-franzese@gmx.com" <michael-franzese@gmx.com>
> Cc: "Help Emacs Orgmode" <emacs-orgmode@gnu.org>
> Subject: Re: displaying equations with ob-latex
>
>
>
> > On May 6, 2021, at 4:20 PM, michael-franzese@gmx.com wrote:
> >
> > After I do "C-c C-c", I just get a message saying "Code block evaluation complete."
> >
>
>
> Are you doing this in a buffer that has ONLY the text between the `cut here' lines and exactly that?
>
> If not, please try it in such a buffer.
>
> It may help to copy and paste as typos in header names or values can be unnoticed and drastically alter behavior. If your mail client reformats text, maybe try copy and paste from the mail list archive.
>
> Also, check with point in the src block using C-c C-v C-i that the header args got processed properly. You should see lines like these in the *Help* buffer:
>
> :	:exports	none
>
> :	:results	drawer replace
>
>
> If you did it in such a buffer and the buffer is unaltered but still displays the message, I have to admit that I cannot tell from here what the problem might be.
>
> On my setup, things behave just as outlined.
>
> When I start emacs with -q, then M-S-; (require 'ob-latex) RET, then paste the text to *scratch* and delete the lisp comment at the top, then M-x org-mode RET, then C-c C-c with point in the src block, answer 'y e s RET' to the query, I get the equation displayed in the results drawer. And the export goes OK.
>
> I am using org-version 9.4.5.
>
> HTH,
>
> Chuck
>
>
>


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

* Re: displaying equations with ob-latex
  2021-05-07  1:36         ` Berry, Charles via General discussions about Org-mode.
@ 2021-05-07  2:33           ` michael-franzese
  2021-05-07  2:39           ` michael-franzese
  1 sibling, 0 replies; 19+ messages in thread
From: michael-franzese @ 2021-05-07  2:33 UTC (permalink / raw)
  To: ccberry; +Cc: Help Emacs Orgmode

I get

#+RESULTS: eqn1
:results:
\(y = x\beta + \epsilon\)
:end:



> Sent: Friday, May 07, 2021 at 1:36 PM
> From: "Berry, Charles via General discussions about Org-mode." <emacs-orgmode@gnu.org>
> To: "michael-franzese@gmx.com" <michael-franzese@gmx.com>
> Cc: "Help Emacs Orgmode" <emacs-orgmode@gnu.org>
> Subject: Re: displaying equations with ob-latex
>
>
>
> > On May 6, 2021, at 4:20 PM, michael-franzese@gmx.com wrote:
> >
> > After I do "C-c C-c", I just get a message saying "Code block evaluation complete."
> >
>
>
> Are you doing this in a buffer that has ONLY the text between the `cut here' lines and exactly that?
>
> If not, please try it in such a buffer.
>
> It may help to copy and paste as typos in header names or values can be unnoticed and drastically alter behavior. If your mail client reformats text, maybe try copy and paste from the mail list archive.
>
> Also, check with point in the src block using C-c C-v C-i that the header args got processed properly. You should see lines like these in the *Help* buffer:
>
> :	:exports	none
>
> :	:results	drawer replace
>
>
> If you did it in such a buffer and the buffer is unaltered but still displays the message, I have to admit that I cannot tell from here what the problem might be.
>
> On my setup, things behave just as outlined.
>
> When I start emacs with -q, then M-S-; (require 'ob-latex) RET, then paste the text to *scratch* and delete the lisp comment at the top, then M-x org-mode RET, then C-c C-c with point in the src block, answer 'y e s RET' to the query, I get the equation displayed in the results drawer. And the export goes OK.
>
> I am using org-version 9.4.5.
>
> HTH,
>
> Chuck
>
>
>
>


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

* Re: displaying equations with ob-latex
  2021-05-06 23:20       ` michael-franzese
@ 2021-05-07  1:36         ` Berry, Charles via General discussions about Org-mode.
  2021-05-07  2:33           ` michael-franzese
  2021-05-07  2:39           ` michael-franzese
  0 siblings, 2 replies; 19+ messages in thread
From: Berry, Charles via General discussions about Org-mode. @ 2021-05-07  1:36 UTC (permalink / raw)
  To: michael-franzese; +Cc: Help Emacs Orgmode



> On May 6, 2021, at 4:20 PM, michael-franzese@gmx.com wrote:
> 
> After I do "C-c C-c", I just get a message saying "Code block evaluation complete."
> 


Are you doing this in a buffer that has ONLY the text between the `cut here' lines and exactly that?

If not, please try it in such a buffer.

It may help to copy and paste as typos in header names or values can be unnoticed and drastically alter behavior. If your mail client reformats text, maybe try copy and paste from the mail list archive.

Also, check with point in the src block using C-c C-v C-i that the header args got processed properly. You should see lines like these in the *Help* buffer:

:	:exports	none

:	:results	drawer replace


If you did it in such a buffer and the buffer is unaltered but still displays the message, I have to admit that I cannot tell from here what the problem might be.

On my setup, things behave just as outlined.

When I start emacs with -q, then M-S-; (require 'ob-latex) RET, then paste the text to *scratch* and delete the lisp comment at the top, then M-x org-mode RET, then C-c C-c with point in the src block, answer 'y e s RET' to the query, I get the equation displayed in the results drawer. And the export goes OK.

I am using org-version 9.4.5.

HTH,

Chuck




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

* Re: displaying equations with ob-latex
  2021-05-06 22:52     ` Berry, Charles via General discussions about Org-mode.
  2021-05-06 23:20       ` michael-franzese
@ 2021-05-06 23:31       ` michael-franzese
  1 sibling, 0 replies; 19+ messages in thread
From: michael-franzese @ 2021-05-06 23:31 UTC (permalink / raw)
  To: ccberry; +Cc: Help Emacs Orgmode



> Sent: Friday, May 07, 2021 at 10:52 AM
> From: "Berry, Charles via General discussions about Org-mode." <emacs-orgmode@gnu.org>
> To: "michael-franzese@gmx.com" <michael-franzese@gmx.com>
> Cc: "Help Emacs Orgmode" <emacs-orgmode@gnu.org>
> Subject: Re: displaying equations with ob-latex
>
>
>
> > On May 6, 2021, at 3:08 PM, michael-franzese@gmx.com wrote:
> >
> > Did you manage to get the equations displayed, I have tried again and could not do
> > it.  It might be beneficial to give more details and some more examples on what to do.
> >
>
> Yes, the one equation was displayed as a preview.
>
> Maybe I was not clear in my directions so try this bit:
>
> --8<---------------cut here---------------start------------->8---
>
> 1. Copy the text between the `cut here' lines to its own org buffer.
> 2. Place cursor in the eqn1 src block.
> 3. Type ~C-c C-c~ and respond to any prompt about evaluating with ~y~.
> 4. An eqn1 results block should appear with a :results: drawer
>    containing an equation in it.
> 5. Type ~C-c C-x C-l~.
> 6. The equation should be previewed in the :results: drawer.
> 7. Export to LaTeX Buffer with ~C-c C-e C-b l L y~
> 8. Only an enumerate environment and the equation should appear in the
>    LaTeX buffer.
>
> #+name: eqn1
> #+begin_src latex :exports none :results drawer
>   \(y = x\beta + \epsilon\)
> #+end_src
>
> #+call: eqn1() :results latex
>
> --8<---------------cut here---------------end--------------->8---
>
>
>
>
> > Can I export on a window that is to right window of the code window?
>
> IIUC, the question is
>
> :  when I export (as in item 5 in the list above), will the LaTeX buffer
> :  open in a window to the right of the one containing the org buffer?
>
> This is what happens in my setup when I have the org buffer displayed in a frame with just one window.
>
> But how windows are displayed depends on many factors. See (info "(emacs) Windows") for some of the details. So you may need to customize or resize your frame to get the same behavior.
>
>
> >  I can one use plain
> > tex commands.  Texinfo mainly supports plain tex, org mode in basically latex, so the
> > two programs do not currently work well together.
> >
>
> Um, I don't see how this gets to the original question.

It is a side problem after the task of math display is achieved.

> > Texinfo has the good feature to show equations (but only for plain tex) whereas org
> > is good with latex (but not very adept at displaying the output in an emacs window).
>
> There are probably a lot of opinions in the org community about how well org handles previewing output. For me it works well. YMMV.

Surely you are right, but it is a problem of use case.  The lot of opinions suggest to me that
there should be various functionalities that can handle different approaches.

> HTH,
>
> Chuck
>
>


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

* Re: displaying equations with ob-latex
  2021-05-06 22:52     ` Berry, Charles via General discussions about Org-mode.
@ 2021-05-06 23:20       ` michael-franzese
  2021-05-07  1:36         ` Berry, Charles via General discussions about Org-mode.
  2021-05-06 23:31       ` michael-franzese
  1 sibling, 1 reply; 19+ messages in thread
From: michael-franzese @ 2021-05-06 23:20 UTC (permalink / raw)
  To: Berry, Charles; +Cc: Help Emacs Orgmode

After I do "C-c C-c", I just get a message saying "Code block evaluation complete."

> Sent: Friday, May 07, 2021 at 10:52 AM
> From: "Berry, Charles" <ccberry@health.ucsd.edu>
> To: "michael-franzese@gmx.com" <michael-franzese@gmx.com>
> Cc: "Help Emacs Orgmode" <emacs-orgmode@gnu.org>
> Subject: Re: displaying equations with ob-latex
>
>
>
> > On May 6, 2021, at 3:08 PM, michael-franzese@gmx.com wrote:
> >
> > Did you manage to get the equations displayed, I have tried again and could not do
> > it.  It might be beneficial to give more details and some more examples on what to do.
> >
>
> Yes, the one equation was displayed as a preview.
>
> Maybe I was not clear in my directions so try this bit:
>
> --8<---------------cut here---------------start------------->8---
>
> 1. Copy the text between the `cut here' lines to its own org buffer.
> 2. Place cursor in the eqn1 src block.
> 3. Type ~C-c C-c~ and respond to any prompt about evaluating with ~y~.
> 4. An eqn1 results block should appear with a :results: drawer
>    containing an equation in it.
> 5. Type ~C-c C-x C-l~.
> 6. The equation should be previewed in the :results: drawer.
> 7. Export to LaTeX Buffer with ~C-c C-e C-b l L y~
> 8. Only an enumerate environment and the equation should appear in the
>    LaTeX buffer.
>
> #+name: eqn1
> #+begin_src latex :exports none :results drawer
>   \(y = x\beta + \epsilon\)
> #+end_src
>
> #+call: eqn1() :results latex
>
> --8<---------------cut here---------------end--------------->8---
>
>
>
>
> > Can I export on a window that is to right window of the code window?
>
> IIUC, the question is
>
> :  when I export (as in item 5 in the list above), will the LaTeX buffer
> :  open in a window to the right of the one containing the org buffer?
>
> This is what happens in my setup when I have the org buffer displayed in a frame with just one window.
>
> But how windows are displayed depends on many factors. See (info "(emacs) Windows") for some of the details. So you may need to customize or resize your frame to get the same behavior.
>
>
> >  I can one use plain
> > tex commands.  Texinfo mainly supports plain tex, org mode in basically latex, so the
> > two programs do not currently work well together.
> >
>
> Um, I don't see how this gets to the original question.
>
> > Texinfo has the good feature to show equations (but only for plain tex) whereas org
> > is good with latex (but not very adept at displaying the output in an emacs window).
>
> There are probably a lot of opinions in the org community about how well org handles previewing output. For me it works well. YMMV.
>
> HTH,
>
> Chuck
>


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

* Re: displaying equations with ob-latex
  2021-05-06 22:08   ` michael-franzese
@ 2021-05-06 22:52     ` Berry, Charles via General discussions about Org-mode.
  2021-05-06 23:20       ` michael-franzese
  2021-05-06 23:31       ` michael-franzese
  0 siblings, 2 replies; 19+ messages in thread
From: Berry, Charles via General discussions about Org-mode. @ 2021-05-06 22:52 UTC (permalink / raw)
  To: michael-franzese; +Cc: Help Emacs Orgmode



> On May 6, 2021, at 3:08 PM, michael-franzese@gmx.com wrote:
> 
> Did you manage to get the equations displayed, I have tried again and could not do
> it.  It might be beneficial to give more details and some more examples on what to do.
> 

Yes, the one equation was displayed as a preview. 

Maybe I was not clear in my directions so try this bit:

--8<---------------cut here---------------start------------->8---

1. Copy the text between the `cut here' lines to its own org buffer.
2. Place cursor in the eqn1 src block.
3. Type ~C-c C-c~ and respond to any prompt about evaluating with ~y~.
4. An eqn1 results block should appear with a :results: drawer
   containing an equation in it.
5. Type ~C-c C-x C-l~.
6. The equation should be previewed in the :results: drawer.
7. Export to LaTeX Buffer with ~C-c C-e C-b l L y~ 
8. Only an enumerate environment and the equation should appear in the
   LaTeX buffer.

#+name: eqn1
#+begin_src latex :exports none :results drawer 
  \(y = x\beta + \epsilon\)
#+end_src

#+call: eqn1() :results latex

--8<---------------cut here---------------end--------------->8---




> Can I export on a window that is to right window of the code window?

IIUC, the question is 

:  when I export (as in item 5 in the list above), will the LaTeX buffer
:  open in a window to the right of the one containing the org buffer?

This is what happens in my setup when I have the org buffer displayed in a frame with just one window.

But how windows are displayed depends on many factors. See (info "(emacs) Windows") for some of the details. So you may need to customize or resize your frame to get the same behavior.


>  I can one use plain
> tex commands.  Texinfo mainly supports plain tex, org mode in basically latex, so the
> two programs do not currently work well together.
> 

Um, I don't see how this gets to the original question.

> Texinfo has the good feature to show equations (but only for plain tex) whereas org
> is good with latex (but not very adept at displaying the output in an emacs window).

There are probably a lot of opinions in the org community about how well org handles previewing output. For me it works well. YMMV.

HTH,

Chuck


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

* Re: displaying equations with ob-latex
  2021-05-06 18:14 ` Berry, Charles via General discussions about Org-mode.
  2021-05-06 21:54   ` Christopher Dimech
@ 2021-05-06 22:08   ` michael-franzese
  2021-05-06 22:52     ` Berry, Charles via General discussions about Org-mode.
  1 sibling, 1 reply; 19+ messages in thread
From: michael-franzese @ 2021-05-06 22:08 UTC (permalink / raw)
  To: ccberry; +Cc: Help Emacs Orgmode

Did you manage to get the equations displayed, I have tried again and could not do
it.  It might be beneficial to give more details and some more examples on what to do.

Can I export on a window that is to right window of the code window?  I can one use plain
tex commands.  Texinfo mainly supports plain tex, org mode in basically latex, so the
two programs do not currently work well together.

Texinfo has the good feature to show equations (but only for plain tex) whereas org
is good with latex (but not very adept at displaying the output in an emacs window).



> Sent: Friday, May 07, 2021 at 6:14 AM
> From: "Berry, Charles via General discussions about Org-mode." <emacs-orgmode@gnu.org>
> To: "michael-franzese@gmx.com" <michael-franzese@gmx.com>
> Cc: "Help Emacs Orgmode" <emacs-orgmode@gnu.org>
> Subject: Re: displaying equations with ob-latex
>
>
>
> > On May 6, 2021, at 12:50 AM, michael-franzese@gmx.com wrote:
> >
> >
> > I am trying to use ob-latex but equations are not being displayed in emacs
> > when I try to execute with "C-c C-c".
>
> Right. This is because `:results latex replace' is the default for latex src blocks and the leads to wrapping everything in a latex export block.
>
> The context inside that block is `export-block' - i.e. it is not a `greater-element' and cannot contain other elements.  AFAIK, there is not previewer for export blocks - latex or otherwise.
>
> The context for an equation inside a greater-element is latex-fragment. And those can be rendered via `org-latex-preview'.
>
> If you want to render equations for previewing, you could put them into a drawer that is not repeated in the export.
>
> To make this work, you probably want something like this
>
> #+begin_src org
>
>   ,#+name: eqn1
>   ,#+begin_src latex :exports none :results drawer
>   \(y = x\beta + \epsilon\)
>   ,#+end_src
>
>
>   Here is the equation for export:
>
>   ,#+call: eqn1() :results latex
>
> #+end_src
>
> Evaluating the latex src block (C-c C-c) will create a `results' drawer line this:
>
> #+RESULTS: eqn1
> :results:
> \(y = x\beta + \epsilon\)
> :end:
>
> but the `:exports none' will strip that out on export. The call line will create this on export:
>
> #+RESULTS:
> #+begin_export latex
> \(y = x\beta + \epsilon\)
> #+end_export
>
>
> HTH,
>
> Chuck
>
>
>
>
>


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

* Re: displaying equations with ob-latex
  2021-05-06 18:14 ` Berry, Charles via General discussions about Org-mode.
@ 2021-05-06 21:54   ` Christopher Dimech
  2021-05-06 22:08   ` michael-franzese
  1 sibling, 0 replies; 19+ messages in thread
From: Christopher Dimech @ 2021-05-06 21:54 UTC (permalink / raw)
  To: ccberry; +Cc: Help Emacs Orgmode

It would please many users if ob-latex was made to behave like other code blocks.
One can parse and show equations in emacs using mathjax as has been recently
implemented in texinfo using @display.

Regards
Christopher



> Sent: Friday, May 07, 2021 at 6:14 AM
> From: "Berry, Charles via General discussions about Org-mode." <emacs-orgmode@gnu.org>
> To: "michael-franzese@gmx.com" <michael-franzese@gmx.com>
> Cc: "Help Emacs Orgmode" <emacs-orgmode@gnu.org>
> Subject: Re: displaying equations with ob-latex
>
>
>
> > On May 6, 2021, at 12:50 AM, michael-franzese@gmx.com wrote:
> >
> >
> > I am trying to use ob-latex but equations are not being displayed in emacs
> > when I try to execute with "C-c C-c".
>
> Right. This is because `:results latex replace' is the default for latex src blocks and the leads to wrapping everything in a latex export block.
>
> The context inside that block is `export-block' - i.e. it is not a `greater-element' and cannot contain other elements.  AFAIK, there is not previewer for export blocks - latex or otherwise.
>
> The context for an equation inside a greater-element is latex-fragment. And those can be rendered via `org-latex-preview'.
>
> If you want to render equations for previewing, you could put them into a drawer that is not repeated in the export.
>
> To make this work, you probably want something like this
>
> #+begin_src org
>
>   ,#+name: eqn1
>   ,#+begin_src latex :exports none :results drawer
>   \(y = x\beta + \epsilon\)
>   ,#+end_src
>
>
>   Here is the equation for export:
>
>   ,#+call: eqn1() :results latex
>
> #+end_src
>
> Evaluating the latex src block (C-c C-c) will create a `results' drawer line this:
>
> #+RESULTS: eqn1
> :results:
> \(y = x\beta + \epsilon\)
> :end:
>
> but the `:exports none' will strip that out on export. The call line will create this on export:
>
> #+RESULTS:
> #+begin_export latex
> \(y = x\beta + \epsilon\)
> #+end_export
>
>
> HTH,
>
> Chuck
>
>
>
>
>

---------------------
Christopher Dimech
General Administrator - Naiad Informatics - GNU Project (Geocomputation)
- Geophysical Simulation
- Geological Subsurface Mapping
- Disaster Preparedness and Mitigation
- Natural Resource Exploration and Production
- Free Software Advocacy


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

* Re: displaying equations with ob-latex
  2021-05-06  7:50 michael-franzese
@ 2021-05-06 18:14 ` Berry, Charles via General discussions about Org-mode.
  2021-05-06 21:54   ` Christopher Dimech
  2021-05-06 22:08   ` michael-franzese
  0 siblings, 2 replies; 19+ messages in thread
From: Berry, Charles via General discussions about Org-mode. @ 2021-05-06 18:14 UTC (permalink / raw)
  To: michael-franzese; +Cc: Help Emacs Orgmode



> On May 6, 2021, at 12:50 AM, michael-franzese@gmx.com wrote:
> 
> 
> I am trying to use ob-latex but equations are not being displayed in emacs
> when I try to execute with "C-c C-c".

Right. This is because `:results latex replace' is the default for latex src blocks and the leads to wrapping everything in a latex export block. 

The context inside that block is `export-block' - i.e. it is not a `greater-element' and cannot contain other elements.  AFAIK, there is not previewer for export blocks - latex or otherwise.

The context for an equation inside a greater-element is latex-fragment. And those can be rendered via `org-latex-preview'.

If you want to render equations for previewing, you could put them into a drawer that is not repeated in the export.

To make this work, you probably want something like this

#+begin_src org

  ,#+name: eqn1
  ,#+begin_src latex :exports none :results drawer 
  \(y = x\beta + \epsilon\)
  ,#+end_src

 
  Here is the equation for export:

  ,#+call: eqn1() :results latex

#+end_src

Evaluating the latex src block (C-c C-c) will create a `results' drawer line this:

#+RESULTS: eqn1
:results:
\(y = x\beta + \epsilon\)
:end:

but the `:exports none' will strip that out on export. The call line will create this on export:

#+RESULTS:
#+begin_export latex
\(y = x\beta + \epsilon\)
#+end_export


HTH,

Chuck





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

* displaying equations with ob-latex
@ 2021-05-06  7:50 michael-franzese
  2021-05-06 18:14 ` Berry, Charles via General discussions about Org-mode.
  0 siblings, 1 reply; 19+ messages in thread
From: michael-franzese @ 2021-05-06  7:50 UTC (permalink / raw)
  To: Help Emacs Orgmode


I am trying to use ob-latex but equations are not being displayed in emacs
when I try to execute with "C-c C-c".






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

end of thread, other threads:[~2021-05-07  4:40 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-06  9:54 displaying equations with ob-latex michael-franzese
2021-05-06 12:37 ` Christopher Dimech
2021-05-06 12:44 ` pietru
  -- strict thread matches above, loose matches on Subject: below --
2021-05-06  7:50 michael-franzese
2021-05-06 18:14 ` Berry, Charles via General discussions about Org-mode.
2021-05-06 21:54   ` Christopher Dimech
2021-05-06 22:08   ` michael-franzese
2021-05-06 22:52     ` Berry, Charles via General discussions about Org-mode.
2021-05-06 23:20       ` michael-franzese
2021-05-07  1:36         ` Berry, Charles via General discussions about Org-mode.
2021-05-07  2:33           ` michael-franzese
2021-05-07  2:39           ` michael-franzese
2021-05-07  3:14             ` Ihor Radchenko
2021-05-07  3:20               ` michael-franzese
2021-05-07  3:36               ` michael-franzese
2021-05-07  4:40                 ` Displaying " Christopher Dimech
2021-05-07  3:18             ` displaying " Berry, Charles via General discussions about Org-mode.
2021-05-07  3:22               ` michael-franzese
2021-05-06 23:31       ` michael-franzese

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