# Math formula

772 views
in Plugins
edited

HI!
Do you have free plugin for users can write simple mathematical function ?

Q2A 1.7

+1 vote

edited
Answer is yes. If you can write $\frac{x}{2}$ which is in latex. all you need is a few lines to be copied to HEAD area in Admin. But there are a few other issues to handle like rendering maths on answer/comment submit without page load. Also, it would be better to have an editor support. I'm using MathJax with codecogs in ckeditor. If you can wait 3 days I shall share this code.

Its too))))))
>But there are a few other issues to handle like rendering maths on answer/comment submit without page load

Although these can be easily solved using AJAX callback, they are not really issues if the posting user has already previewed the Equation correctly and trusts the site's template.

IMHO, the posting user does not need to see the Equation immediately on an AJAX submit.
Other users will see the rendered Equation when they view the page.
OR does the AJAX do a live update for other viewing users?

I'll make a codecog integration with TinymceWrapper very soon.
After inspecting codecogs it appears there is working free plugin for TinyMCE
https://www.codecogs.com/latex/integration/tinymce_v4/install.php

And since codecog produces PHP images there is no need for Q2A MathJax renderer at all, whether for AJAX or not. @arjunsuresh please correct me if I am wrong.

Using PHP images might be a solution to those who are not keen on raw LaTex
Yes, codecogs do provide that. But I hate those images and MathJax ones do render much much better. So, what I do is simply change the codecogs image generation part and put a $-$ around them and thus using codecogs just for typing Latex equation.

>But there are a few other issues to handle like rendering maths on answer/comment submit without page load

This is actually important- a user wont like his typed stuffs to appear in $-$. And this is not hard to do though this requires a core hack. So, what I do is keep a separate file for this. Since, anyway I'm doing this I thought of sharing the entire code so that anyone requiring Latex can get them in Q2A without the trouble I had to do at beginning.
Added the plugin which can be used straight away if you dont need much customization.