korsbo / Latexify.jl

Convert julia objects to LaTeX equations, arrays or other environments.
MIT License
562 stars 59 forks source link

Issue rendering chemical reaction system in VSCode #237

Open gaurav-arya opened 1 year ago

gaurav-arya commented 1 year ago

MWE (to be run in VSCode):

using Latexify, LaTeXStrings

latex_string = L"\begin{align*}
\require{mhchem}
\ce{ A &->[${\lambda}1$] B}
\end{align*}"

latexify(rn) |> s -> render(s, MIME("juliavscode/html")) 
latexify(rn) |> s -> render(s, MIME("image/png"))

Here, latex_string is the LaTeX output of a Catalyst chemical reaction: see https://github.com/SciML/Catalyst.jl/issues/566 for further discussion. The PNG output renderes correctly, but the juliavscode/html option (which is the default in VSCode) displays an error: image which seems to be due to the ${\lambda}1$ (which is valid LaTeX and accepted by the other mimes).

gustaphe commented 1 year ago

I don't use VSCode, so I would need more specific instructions for how to test this out.

This is probably an error on MathJax's part.

gaurav-arya commented 1 year ago

One needs to open up VSCode, create a file with content equal to that MWE, and run that file by pressing the triangle in the top right.

I agree it's probably a MathJax error. I posted it here because the juliavscode/html handling logic is in the source code of this repository -- do all the other MIME types not use MathJax? If so, then I guess it's just a bug with MathJax itself.