MathTran and MathJax

MathTran and MathJax

by Ravi Vare -
Number of replies: 10
continue from thread
http://moodle.org/mod/forum/discuss.php?d=170712#p750389
Mauno,

#1)i think, we have installed MathJax Successfully.
can we make same symbols(tokens) for 'displaymath' and 'inlinemath' of MathTran and Mathjax?

Then we disable the Mathtran and only use MathJax for rendering the 'Maths Expression'.
Will this LOGIC work?

MathJax Quality is Nice.
i think, it may be perfect option for rendering the 'maths expression' .

#2)MathsJax works in dropdown menu.
but 'option' disappear after selection.

pl. think about #1

Best Regards
Ravi

Average of ratings: -
In reply to Ravi Vare

Re: MathTran and MathJax

by Ravi Vare -
Hei Mauno and moodler

I read following statement for number of times.

{If you have Tex filter or MathTran filter enabled it will use the same delimiters as those inline math delimiters (double dollars and backslash + square brackets) by default. So you should use some other delimiters than double dollars for mathJax inline maths if you want to use either MathTran filter or Tex filter at the same time as MathJax - that's the main reason for configuration of delimiters. What you see in your drop down menu is most likely Mathtran code - not mathjax.}

Actually i understood it.
Now i want to disable MathTran Totally.
and use only MathJax.
For that
Old Latex Code which are supported by MathTran must be supported by MathJax.

So i made change
OLD code in meta.php in custom theme
tex2jax: {displayMath: '@d','@d', inlineMath: $$','$$
'],['\\\[','\\\]'">'$$','$$'],['\\\[','\\\]'},

NEW code in same file -made by me
tex2jax: {displayMath: '@d','@d', inlineMath: $$','$$'],['$$\[','\]$$'],['\[','\]'">'$$','$$'],['$$\[','\]$$'],['\[','\]'},

i add more delimiter
['$$\[','\]$$'] AND ['\[','\]']

Then i made MathTran Disabled.
But
Math Expression - 'CENTERED' Not align properly.
RED \[ ........ \] around Expression

Is there any Problem?
I had also added following script to 'header' file in my custom theme.
src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
My Next option will be to use separate delimiter for MathJax (As you said)
i think it will be @@
for that
tex2jax: {displayMath: '@d','@d', inlineMath: $$','$$'],['\\\[','\\\]'],['@@','@@'">'$$','$$'],['\\\[','\\\]'],['@@','@@'},
Am i Right?

plzzz say something
TIA
Ravi

P.S. ['\\\[','\\\]'] i can't understand this 'delimiter'.
we never use this one
In reply to Ravi Vare

Re: MathTran and MathJax

by Mauno Korpelainen -

You can use attachments to post your code to these forums - otherwise moodle.org tex filter tries to render your delimiters as latex and it is hard to guess what your code looks like.

Anyway my guess is that you are trying to use 2 separate MathJax installs at the same time. If you added to your theme header.html a script tag with

src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"

it will use most likely the default configuration of cdn.mathjax.org MathJax and if you read http://www.mathjax.org/docs/1.1/configuration.html you notice that default configuration of MathJax is using single dollars for inline maths and double dollars for displaymaths. On the other hand your previous files (meta.php) were using MathJax from your site moodle subfolder lib/MathJax. You only need one of them with one configuration.

I thought some of your previous quiz examples was using backslashes followed by square brackets as optional delimiters - if you don't need them you can as well delete these optional delimiters for your inline maths in meta.php

, [ ... ] but be careful and do not delete the closing square bracket of

inlineMath: [ [ ' $ $ ' , ' $ $ ' ] ]

(note - without spaces, do not copy this - I used spaces here because moodle.org is filtering double square brackets as Moodle docs wiki links and double dollars as Latex.)

You can choose to use any delimiters you want for your maths - you must just know how to write the code for you delimiters to a php file or to a javascript tag. If you use single or double quotes make sure that they are not mixed in a wrong order. If you use some special characters (non-alphabet) check if you need backslashes in code. In order to show a backslash in php, we need to double it "\\". If you use brackets / parentheses check that delimiter characters are not mixed with configuration code characters - brackets are used in arrays and you need commas to separate different parts of optional delimiter pairs in array. smile

Check once more the example image from http://moodle.org/mod/forum/discuss.php?d=170712#p749186 - it should explain the second optional pair of delimiters \ [ ... \ ] used by tex filter and MathTran filter.

In reply to Mauno Korpelainen

Re: MathTran and MathJax

by Ravi Vare -
hei,
I have removed following tag from 'header' of custom theme.
{ src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"> }

Now we are using only LOCAL distribution of MathJax.
Am i right?

But i am suspicious about 'header''s "ENDING"

Is it proper ending?

Now i will try for its "Delimiter".
One copy of above/last post i have sent to you through private email.
because you can easily understand.

Thanks for response.

Ravi


Attachment header in custom theme.JPG
In reply to Ravi Vare

Re: MathTran and MathJax

by Mauno Korpelainen -

That ending of header.html is fine in this theme (high-school-classes-theme).

It was actually funny to notice that (even if I thought that number of backslashes is essential)

tex2jax: { displayMath: [ [ ' @ d ' , ' @ d ' ] ] ,  inlineMath: [ [ ' $ $ ' , ' $ $ ' ] , [ ' \ \ \ [ ' , ' \ \ \ ] ' ] ] } ,

and

tex2jax: { displayMath: [ [ ' @ d ' , ' @ d ' ] ] ,  inlineMath: [ [ ' $ $ ' , ' $ $ ' ] , [ ' \ \ [ ' , ' \ \ ] ' ] ] } ,

both seem to render tex between \ [ ... \ ] ok and

tex2jax: { displayMath: [ [ ' @ d ' , ' @ d ' ] ] ,  inlineMath: [ [ ' $ $ ' , ' $ $ ' ] , [ ' \ [ ' , ' \ ] ' ] ] } ,

and

tex2jax: { displayMath: [ [ ' @ d ' , ' @ d ' ] ] ,  inlineMath: [ [ ' $ $ ' , ' $ $ ' ] , [ ' [ ' , ' ] ' ] ] } ,

both seem to render tex between [ ... ] ok.

I am not sure why you had that 3rd "combination" pair

[ ' $ $ \ \ \ [ ' , ' \ \ \ ] $ $ ' ]

but otherwise I did not notice any odd things in your files. smile

In reply to Mauno Korpelainen

Re: MathTran and MathJax

by Ravi Vare -
Hei,
Today MathTran was 'disable'.

i tried only for Mathjax
Pl see attachment

#1) Now problem is
For DROP DOWN MENU

Mathjax render 'Maths Expression' in dropdown menu.
But after selection.
it disappear.
Pl. suggest something
This is main Problem. PLz. solve it.
could we try image tag (in MOODLE not in Quizport)

Thanks, Thanks, Thanks.......
After "Drop down issue" this 'post' may be last.

TIA
Ravi
In reply to Ravi Vare

Re: MathTran and MathJax

by Mauno Korpelainen -

It can't be easily solved because HTML element SELECT works that way - it was designed to use plain text including html entities. You can show maths in OPTION elements or it is possible to use jQuery etc to change the whole element type but that's a really long story (image drop down menus) so you just have to live with this core feature - see for example http://tracker.moodle.org/browse/MDL-19440

To prove that this is not actually a bug in moodle you can for example create a html document or test with http://www.w3schools.com/tags/tryit.asp?filename=tryhtml_option the code and the result looks the same - unfortunately... and one workaround is to start each option with some text like a, b, c - then you will at least see the choice you made.

Not possible

In reply to Mauno Korpelainen

Re: MathTran and MathJax

by Ravi Vare -
Hei Mauno,
To know/understand properly above POST, i require Some time.

But journey to know Maths symbols in moodle was interesting.
Now i think i got it 99%

I want to take Preview.
# Tex filter was OK for Local PC.but not working for website.
# that time we couldn't install TEXLIVE to website.
#Then we installed MathTran. Solve the problem temporarily.
# For nice looking purpose and determinant purpose, we installed MathJax.

Interesting thing is now!!!
i can installed TEXLIVE......./filter/tex/install-tl.zip

Q1.is this a perfect place? .....wait to unzip it.
Q2. Where do i place image magic-6.6.5-10 (for binary conversion-Am i right?)

i may also want Latex PATH.

Now i got the meaning of this thread properly
http://moodle.org/mod/forum/discuss.php?d=164858#p724951

Thanks again for your uncomparable support.

pl. say something about TEXLIVE.

Ravi
In reply to Ravi Vare

Re: MathTran and MathJax

by Mauno Korpelainen -

I would ask first if your host could offer full package of texlive and imagemagick so that all users of your server could use it. On Windows servers (like yours) users need permission to execute the executable files from texlive bin subfolder and convert.exe of ImageMagick

If they agree to install (or have already installed) these packages and give you the paths for latex.exe,  dvips.exe and convert.exe you are lucky   smile

The full package of Texlive is HUGE - over 2 Gigabytes unzipped - so if you unzip install-tl.zip and install Texlive to some of your directly web accessible subfolders like filter/tex you may get into real trouble with direct web access (security) and run out of disc quota (hard disc space) if you have a limitid space available.

In reply to Mauno Korpelainen

Re: MathTran and MathJax

by Ravi Vare -

Hei Mauno,

i got above thread perfectly.

Now, Time comes.

I have to face 'Such interesting Topic'.

With deep gratitude, without you, this Journey is impossible.

Q. ? Everywhere i have to PUT 'above script of MathJax'.

TIA,

Ravi