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-franz...@gmx.com" <michael-franz...@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-franz...@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