# How can I configure q2a to support mathtex or latex

10.4k views
in Q2A Core
I'm looking to implement q2a as a way to slowly move new students into asking questions more readily.  A q&a solution that removes the embarrassment some students have(especially freshmen) to asking a question.  However, a lot of these are math related, and I find that writing... for example: a^2 + b^2 = c^2 ... is a bit daunting and not as clear as it could be.

Is there a way then, to integrate mathtex/latex with q2a?

by

On the output/rendering side, you could do this with a TeX to HTML translator such as:

http://hutchinson.belmont.ma.us/tth/

The appropriate place to do this is after the following line in qa_post_html_fields(...) in qa-app-format.php:

$fields['content']=qa_html($post['content'], true);

After installing the Tex to HTML tool on your web server as an executable, the PHP code should:

a) Detect TeX code within $post['content'] (to make this easier, perhaps ask your students to start and finish with a special character sequence). b) Pass the detected TeX code through to the translator executable using one of PHP's program execution functions (the most appropriate one will depend on exactly how the tool does input and output): http://www.php.net/manual/en/ref.exec.php c) Substitute what you get back from the executable into$post['content'].
by
Thanks for the detailed comment gidgreen!  I started experimenting with jsmath a few hours after answering this question as well, however I think the tex to html tool will be much more efficient!
by
I am very new in programming. I have install the q2a in my website where the school student can ask there question. I am trying to include the Math formula just like writing math equation. I have told my website hosting service provider to install the Tet to HTML and they have install it also. I have include the line $fields['content']=qa_html($post['content'], true); as per your guideline. but still unable to include the Math formula.
by
I believe there is a Javascript you can include that will do the Mathjax stuff for you. Check out http://math.stackexchange.com/ and see what they use.