Integration of KaTeX in OSSN to render math equation

Ranjan Rai Posted in Component Development 4 years ago

I am requesting the community to develop a plugin or component to support math equation's. Although there are two ways to achive this one by using KaTeX or MathJax but I personally prefer KaTeX because KaTeX is faster over MathJax, A link to the KaTeX project on github is KaTeX on Github

This topic has been closed!

[Topic is Close]

Replies
German Michael Zülsdorff Replied 4 years ago

Please remove version 1.0 and install version 1.1 to make immediate rendering of new posts work.

Regarding your question:
It's \( your_term \) for inline rendering.

Such things are well documented in KaTeX, so we ask for your understanding that the support of this library cannot mean that from now on WE are also obliged to answer library-related internals.

in Ranjan Rai Replied 4 years ago

Thanks ~Z~ Man for developing such a wonderful plugin, I found one small issue the mathematical codes are been displaying in display mode with $$\int_{-\infty}^\infty f\xi\,e^{2 \pi i \xi x} d\xi$$, but how to get inline mode?

German Michael Zülsdorff Replied 4 years ago

The component is available now at
https://www.opensource-socialnetwork.org/component/view/3814

Note that Ossn 5.2 must be installed to make Katex Rendering work.

German Michael Zülsdorff Replied 4 years ago

Well, I don't think that the chat is the right place because it comes with no editing option and so you'll need to type in the same formula again and again until it fits to your needs. That's why I won't implement it there - at least not in first place - maybe later.

You can use the editing option of the newsfeed instead to verify that KateX rendering is working as expected.

Yes: and all the best for 2020.

in Ranjan Rai Replied 4 years ago

I agree with you, not every body will be using KaTeX, so component will fix the missing link between beautiful mathematical formulas and OSSN, well in my last message I missed to mention one very important place to activate this plugin in the chat and chat-log page as this can also help to get an preview of the latex code and how KaTeX will render it in the feeds, blog and in the forum.
I wish you Happy New Year 2020 from India. :)

German Michael Zülsdorff Replied 4 years ago

Regarding your question:
The answer is quite simple, it's speed.
First, it takes enormous effort to parse the complete html for the existance of sequences like $$\pm\sqrt{a^2 + b^2}$$ and render these formulas in general.
And things are getting even more complicate when you made a typo and need to edit your formula. That is: In edit mode that formula must not appear rendered, but you need the source again. Thus a lot of extra computing is necessary to tell whether you're in edit mode or not...

So all in all it wouldn't be a good idea to have this big overhead running in the background just because someone might know KaTeX and wants to make use of it.

in Ranjan Rai Replied 4 years ago

Hi ~Z~ Man,
Thanks for showing your interest for developing a KaTeX component, well regarding your question I expect a support for news-feeds and blog as I a free version of OSSN but I am planing to implement Forum to our site so it would be great if this component support forum by default.
I am just thinking why not to include KaTeX in the core part so that every component are being supported by beautiful math formulas?

German Michael Zülsdorff Replied 4 years ago

Hi Ranjan,

I'm currently working on a KaTeX component. It'll be available in the beginning of 2020 when Ossn 5.2 is ready to download.

Could you please tell me in which parts of Ossn you want to use formulas ... newsfeed? blog? etc.

in Ranjan Rai Replied 4 years ago

Thanks Arsalan Shah for writing me,
Well I don't have proper skills to write proper codes in order to make it usable, so I requested to the community to port KaTeX on OSSN

Indonesian Arsalan Shah Replied 4 years ago

The instructions on github is much clear, did you tried their documentation?