abricotine
abricotine copied to clipboard
Use Katex for rendering math
From #7
I know MathJax is being used now, but I would like to recommend Katex. The basic reason is, it is fast, very much faster than MathJax. It does lack extremly advanced features, But it has many. There is also a package of markdown-katex for atom.
MathJax is definitely very heavy, an alternative solution like Katex would be much appreciated.
Hi, Please don't move to Katex. We want full support in the {align} environment.
Or to the least allow the user to toggle between MathJax and Katex. Thank You.
@RoyiAvital can you please give an working example of {align} environment used in Abricotine? I don't see how it looks like.
Also I found this PR in Katex repo: https://github.com/Khan/KaTeX/pull/398 Isn't this the feature you are asking for?
I agree that we don't want useful features to be removed from the app. However we have to keep in mind that MathJax is almost 60 Mo unzipped, which is like 20 times heavier than KateX.
Hi,
Here is a sample which code works using StackEdit:
\begin{align}
20 * 40 & = \left( 30 - 10 \right ) \left( 30 + 10 \right ) \\
& = {\left( 30 \right )}^{2} - {\left( 10 \right )}^{2} \\
& = 900 - 100 = 800
\end{align}
It should look like that:
http://i.imgur.com/xsnLPQE.png
Mind the numbers which are not aligned correctly. This is a bug in Online LaTeX.
By the way, I think the right way would be having a choice in the settings whether to use KaTeX or MathJax.
By the way, I think the right way would be having a choice in the settings whether to use KaTeX or MathJax.
In my opinion the main interest of Katex is to avoid bundling MathJax in Abricotine. And it will be even worse if we decide to use both of them...
But KaTeX supports only subset of the Feature MathJax can support. some of those are very important to display math correctly.
Please allow both of them. No need to worry about the size of Abricotine. It is not something important these days in my opinion.
Well, I'm not planning to replace MathJax with Katex until it has a decent support for such important features. I'm adding the "wontfix" label to this issue to make it clear.
However Katex is still a new project and it is very promising. It is on active development (for example, align environment has been introduced since your first message in this thread). I think it is worth a look since it is much faster and lighter than MathJax, so I suggest to keep this idea in mind.
I agree it is promising. But how hard would it be to support both of them and let the user chose which to use?
You know what, even having MathJax as an additional Download (Manual).
But how hard would it be to support both of them and let the user chose which to use? You know what, even having MathJax as an additional Download (Manual).
I think this would require considerable development time for a small benefit at the end. Right now we should keep it simple in my opinion.
FYI, since you're in Electron and don't need to support old browsers, you can significantly reduce MathJax size: https://github.com/mathjax/MathJax-docs/wiki/Guide%3A-reducing-size-of-a-mathjax-installation
which one can render complex math equation? for example
$$
\begin{align}
T1 &= \left[\begin{array}{r}\cos{\left (\theta_{0} \right )} & - \sin{\left (\theta_{0} \right )} & 0\\\sin{\left (\theta_{0} \right )} & \cos{\left (\theta_{0} \right )} & 0\\0 & 0 & 1\end{array}\right]\\
&=\left[\begin{array}{r}\cos{\left (\dfrac{\pi}{6} + \dfrac{\pi}{2} \right )} & - \sin{\left (\dfrac{\pi}{6} + \dfrac{\pi}{2} \right )} & 0\\\sin{\left (\dfrac{\pi}{6} + \dfrac{\pi}{2} \right )} & \cos{\left (\dfrac{\pi}{6} + \dfrac{\pi}{2} \right )} & 0\\0 & 0 & 1\end{array}\right]\\
&=\left[\begin{array}{r}- \dfrac{1}{2} & - \dfrac{\sqrt{3}}{2} & 0\\\dfrac{\sqrt{3}}{2} & - \dfrac{1}{2} & 0\\0 & 0 & 1\end{array}\right]\\
&=\left[\begin{array}{r}-0.5 & -0.866025403784439 & 0\\0.866025403784439 & -0.5 & 0\\0 & 0 & 1.0\end{array}\right]
\end{align}
$$
@retsyo , MathJaX can easily handle that. It can handle any Math string that LaTeX can handle.
KaTeX is a bit more limiting with its capabilities (Yet still very good).