Open aceross opened 4 years ago
How did you set up emacs-jupyter with respect to Julia?
This works for me at least.
like this:
@variables A B a b c d e f g h i j k l m n o p q r A=[a b c; d e f;]
transpose(A)
\begin{equation} \left[ \begin{array}{cc} a & d \ b & e \ c & f \ \end{array} \right] \end{equation}
and installation: (use-package jupyter :ensure t)
(org-babel-do-load-languages 'org-babel-load-languages '( ;;old (dot . t) (plantuml . t) (gnuplot . t) (ess-julia . t) ;;new (emacs-lisp . t) (julia . t) (python . t) (jupyter . t)))
sudo dnf install python3-jupyter-console
FYI
I am trying out the Julia Symbolics package, but I prefer to see the latex-preview. However, we can make things work with org-latex-preview
as follows:
As for latex equations, the export
block is not required, I am using the header argument :results raw
.
However, different from @jave his results, the output here gets wrapped between $$
. Also, for the equation
environment, the $$
is not required so I have added the following advice to remove them:
(defun jupyter-julia-trim-latex (orig-fun data)
(apply orig-fun (list (string-trim data "[ $]+" "[ $]+"))))
(advice-add 'jupyter-org--parse-latex-element :around #'jupyter-julia-trim-latex)
Only problem is that the :RESULTS
do not automatically get replaced. But we can use org-babel-remove-result(-one-or-many)
.
Hope this might be useful to anybody (and that users will find it here :)
@dalanicolai Latexify with symbolics was working fine before https://github.com/JuliaSymbolics/Symbolics.jl/pull/763
I made a comment on that PR to try to understand why that change was made so hopefully we can know what the right fix here might be.
What's the correct solution here? It's really annoying that this used to work fine. @akirakyle I notice no one cared to respond to your comment on the Symbolics.jl PR I doubt that will get reversed now.
After further investigation both Jupyter lab/notebook and Pluto render this ok. IIRC they are MathJax based.
The workaround from @dalanicolai works fine in org-mode src-blocks (👍) but multiline $$ stuff is not rendered properly in jupyter-repl which is a pain.
I added this using @dalanicolai filter
(advice-add 'jupyter-insert-latex :around #'jupyter-julia-trim-latex)
I wonder where it will crop up again AFAICT $$
is not the right way to do this but I'm no LaTeX guru.
I tracked it to down to a bug in org-format-latex
-- which has a hardcoded regex to find latex fragments and ignores any :matchers
in org-format-latex-options
which normally includes $$. See here also: https://emacs.stackexchange.com/questions/78093/removing-certain-latex-preview-matchers-from-org-mode - so this should go away sometime soon.
Every time I execute a source block with Julia (e.g.
C-c C-c
), I get the messageCode block produced no output
The source blocks start a Julia REPL but do not send any lines to it. The error provided is:Error running timer ‘jupyter-event-handler’: (wrong-type-argument number-or-marker-p t)
I have tried this in both Ubuntu 20.04 and MacOS 10.15 "Catalina".
Given that others seem to use the package without this issue, I am a bit baffled as to what is going on.
Thanks in advance for any advice that can be offered.