Hi, How can I align mathequations rendered by Tex filter with inline text as shown in the first equation. First one is rendered by mathjax. Second one is rendered by TeX filter. Also how can i control the font size in TeX.

Thanks in Advance

This discussion has been locked because a year has elapsed since the last post. Please start a new discussion topic.

Hi, How can I align mathequations rendered by Tex filter with inline text as shown in the first equation. First one is rendered by mathjax. Second one is rendered by TeX filter. Also how can i control the font size in TeX.

Thanks in Advance

Hello,

Maybe you can consider using the MathTran filter rather than the core TeX filter.

With MathTran, formulas are rendered on an external server and the server is calculating a vertical offset so that formulas are correctly aligned.

You can find a version for Moodle 1.9 here and a version for Moodle 2.0/2.1 here.

With MathTran you don't need to install Mimetex or any other TeX renderer, but of course that means you are limited by the features supported by the MatTran server (for instance no colors).

Images that Tex filter creates have class "texrender" included and if one of your theme css files has the following line:

.texrender {border:0px;vertical-align:middle;}

those images should be automatically vertically aligned. You can also add that css line to your custom theme css if it does not exist.

You can't freely control font size with tex filter - only change the default density from settings of tex filter. If you need different font sizes (fully scalable maths), colours etc use MathJax, it gives you much better output than typical image renderers

Hi thank you for your reply. Mathjax is cool but takes time to load also in mobile versions it is quite slow to render. Another problem is (I dont know if it is a problem with my code) math is being rendered properly in the question of quiz but not being rendered in the options of the quiz if they contain any math. It is just showing blank space. I am attaching my code here please check if there is any changes to be made.

There really is no perfect solution for all cases - all renderers have some good options and they fail in something.

If you mean such question types that use drop down lists, there is no cross browser compatible way to use math in dropdown lists. You can use plain text, html entities and unicode characters in drop down lists... but in all such question types and answers that do not use drop down lists you should be able to use both image and script based maths.

Your mathJax configuration looks basicly ok, you don't actually need to use several MathJax.Hub.Config-tags there but it should not matter even if you have more than one of them. The latter tags are just adding something to configuration that could be done within one MathJax.Hub.Config({...});

Using config=TeX-AMS-MML_HTMLorMML-full from cdn.mathjax.org means that you are loading the largest mathjax configuration - if you don't need all options of mathjax (for example mathml) you could use lighter configuration and instead of setting scale: 80 (overriding default 100) you could use default scale (or local files and local configuration) and if necessary scale mathjax for example with surrounding spans (any styles there) like http://www.mathjax.org/demos/scaling-math/ or for example with different predefined classes in your theme css files like

.small {...}

.big {...}

and on pages

\class{small}{maths_here}

\class{big}{maths_here}

One more example about these MathJax methods and \style :

http://korpelainen.net/m2mathwiki/index.php/Style

You can change both colours and font sizes with such distributions of latex as TexLive or change density / dpi but tex filter is not flexible enough for such cases. On Linux/Unix you could use cgi Mathtex together with your latex distribution - see some examples from http://moodle.org/mod/forum/discuss.php?d=152490 - or even google chart api tex http://moodle.org/mod/forum/discuss.php?d=133132#p584546 but the syntax there is a little complex and google chart api tex is not suitable for long mathematical formulas.

The main reason for slow rendering seems to be in your mathjax configuration line

<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/1.1-latest/MathJax.js?config=**TeX-AMS-MML_HTMLorMML-full**"></script>

Changing that to

<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=**TeX-AMS_HTML**"></script>

should make you cdn mathjax much faster (if you don't need mathml, only latex with AMS symbols)