emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: displaying equations with ob-latex


From: Berry, Charles
Subject: Re: displaying equations with ob-latex
Date: Thu, 6 May 2021 18:14:04 +0000


> 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






reply via email to

[Prev in Thread] Current Thread [Next in Thread]