Manish,

Your post may confuse some (it confuses me - lol) so I want to take a moment to recap:

1) Mimetex is a tool built by John Forkosh. It is currently at version 1.72 You can compile your own and run it with Moodle (I do) . It does not contain a full implementation of Tex and will balk at some tex constructs. You can invoke mimetex from inside Moodle documents using methods described by John and in the Math forum directly without the use of any filter, or through the use of js or other language, as is the case with ASCIIMATHML. If you invoke the mimetex installed on your server in your browser in the manner in which John describes (e.g. http://yourhost/yourcgi-bin/mimetex.cgi?\sqrt[x]{y}), and the equations are "broken", then this has nothing to do with Moodle whatsoever - it is an artifact of your mimetex.cgi or your text expression. If you initially displayed your equations using an img tag containing something like

img src="/yourcgi-bin/mimetex.cgi?{YOURTEXTEXTEXPRESSION}" align=middle

then that could explain in part why your equiations were mangled....

2) Moodle has a core filter, Tex, which can be turned on and of from inside Moodle. It includes a copy of mimetex built on Mimetex v1.70 (see http://cvs.moodle.org/moodle/filter/tex/ - don't bother to try and view the MDL-they are blockled) compiled, I am guessing by Petr. If one turns on the Tex filter, mimetex IS ONLY USED AS FALLBACK WHERE TEX IS NOT WORKING!

3) Moodle DOES NOT COME WITH TEX. The Tex filter is designed to point to three binaries. Historically only two came with Tex distributions while the third, convert, was present in ImageMagick and ghostscript. You can now hack the filter to avoid the use of convert altogether and there is a tracker item for that which I have been neglecting. http://tracker.moodle.org/browse/MDL-23350 You can and probably should install TexLive on your server if you wish to use the Moodle Tex filter, and point the Moodle Tex filtler to the necessary binaries on your system (use texdebug to assist.)

4) the Moodle core algebra filter is based on a perl filter used in WebworkS. It requires the use of the tex filter. The suggestin that it just uses mimetex (see, http://cvs.moodle.org/moodle/filter/algebra/filter.php?revision=1.34&view=markup) is grossly misleading as it converts algebra syntax to tex, and then passes the results to the Tex filter (i.e. my experience is that if the tex filter is not turned on, the algebra filter will not wrk, even though the mimetex binary is present) and I think the comments in that file should probably be edited....

5) From the standpoint of the Moodle core Tex filter there is no difference between the "formatting" tex and mimetex text expressions. I have no idea what you re changing, why you are changing it, etc, unless you were calling mimetex directly from your html using image tags (see Item 2 above). This would be the most difficult way I could imagine to display equations.

6) While the Tex filter can display equations as gif or png, one can move to MathML and avoid conversion to images. Both MathJax and ASCIIMathML can produce MathML which a compliant browser can display on the fly. Both can also be configured to fallback to another usage where the users browser cannot support MathML. MathJax is perhps the more elegant solution, but it is rather large and more complex while ASCIIMathML is relatively small, is self contained, and allows you to fall back to quite a few methods (while MathJax relies on its own internal fallback.) There is also an old mathml filter designed by the same person who did the work on the algebra filter, Zbigniew, (see, http://cvs.moodle.org/contrib/plugins/filter/mathml/) which has not been updated since 2004 and is discused in the forum back then.

7) Many use ASCIIMathML because it has a simpler syntax than tex, but is much richer than the algebra syntax (which is also of dubious provenance - that is to say the algebra filter does not have a clear and concise statement of its syntax available.) I think you would be much better off with ASCIIMathML than the algebra filter, and if you look at the moodle docs on it you will find a version that has fallback and /the ability to do SVG. ASCIIMathML is a couple of hundred K, can be installed almost anywhere and can be simply invoked from the theme header file (in moodle 2 there is a "better" way to do this, but there have been reports - as with much of Moodle 2 - that it doesn't work very well.)