emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
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
Date: Thu, 6 May 2021 18:14:04 +0000	[thread overview]
Message-ID: <8E0D781F-7947-4616-BA73-1B6F7C45442A@health.ucsd.edu> (raw)
In-Reply-To: <trinity-fa92783e-7977-4008-8818-ec7a1744edb1-1620287456377@3c-app-mailcom-bs16>



> 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	other threads:[~2021-05-06 18:22 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-06  7:50 michael-franzese
2021-05-06 18:14 ` Berry, Charles via General discussions about Org-mode. [this message]
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
2021-05-06  9:54 michael-franzese
2021-05-06 12:37 ` Christopher Dimech
2021-05-06 12:44 ` pietru

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8E0D781F-7947-4616-BA73-1B6F7C45442A@health.ucsd.edu \
    --to=emacs-orgmode@gnu.org \
    --cc=ccberry@health.ucsd.edu \
    --cc=michael-franzese@gmx.com \
    --subject='Re: displaying equations with ob-latex' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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