Jason-S-Ross / ox-context

An Org Mode export backend for ConTeXt
13 stars 4 forks source link

Doesn't play nicely with org-jupyter latex output #20

Open Jason-S-Ross opened 2 years ago

Jason-S-Ross commented 2 years ago

Problem: Code blocks like this

#+BEGIN_SRC jupyter-python
from sympy import *
from sympy.abc import z, zeta, m, p, R, alpha
phi = p * R / 4 * (
    zeta + (2 * exp(I * alpha) - m) / zeta
)
display(phi)
#+END_SRC

Make outputs like this:

#+RESULTS:
:RESULTS:
#+begin_export latex
$\displaystyle \frac{R p \left(\zeta + \frac{- m + 2 e^{i \alpha}}{\zeta}\right)}{4}$
#+end_export
:END:

because of how emacs-jupyter exports things. This appears to be hard-coded

We don't currently support latex export blocks because we can't guarantee that ConTeXt will be able to parse arbitrary LaTeX. Maybe there should allow the user the option of enabling LaTeX parsing.

Jason-S-Ross commented 2 years ago

Workaround for part 1:

#+BEGIN_SRC jupyter-python :session py :kernel python3 :results raw
from sympy import *
from sympy.abc import a, b
init_printing(use_latex="mathjax", latex_mode="equation")
display(a * b)
#+END_SRC

#+RESULTS:
\begin{equation}a b\end{equation}

A parser is in progress on 540d8e8.