Matrices in HTML editor- not seen properly

Matrices in HTML editor- not seen properly

by Ravi Vare -
Number of replies: 13
Hi everybody,
i am using moodle 1.9.10
Mathtran Filter is -enabled

for Code creation, i am using 'MathType'

Specifically, for Matrices,
In MathType, i use TRANSLATOR- "Tex-PlainTex"

Otherwise, translator is "LaTex 2.09 and later"

OK
My Problem is,
Matrices created in (Mathtype-translator-Tex-Plain Tex) are NOT seen properly in HTML editor.

But seen properly in 'OPTIONS'.

Basically it is problem for '3X3' Matrix

pl. suggest.
TIA
Ravi
Attachment matrices in HTML editor.JPG
Average of ratings: -
In reply to Ravi Vare

Re: Matrices in HTML editor- not seen properly

by Bob Mathews -

Ravi,

Not sure what version of MathType you're using, but we introduced a new "Moodle TeX filter" translator in MathType 6.7 for Windows (and will also be included soon in MathType 6.7 for Macintosh). If you're using this translator, here's what your 2x2 and 3x3 matrices look like:

$$\left( {\begin{array}{ccccccccccccccc}{{a_{11}}}&{{a_{12}}}\\{{a_{21}}}&{{a_{22}}}\end{array}} \right)$$

$$\left( {\begin{array}{ccccccccccccccc}{{a_{11}}}&{{a_{12}}}&{{a_{13}}}\\{{a_{21}}}&{{a_{22}}}&{{a_{23}}}\\{{a_{31}}}&{{a_{32}}}&{{a_{33}}}\end{array}} \right)$$

Bob Mathews
Design Science

In reply to Bob Mathews

Re: Matrices in HTML editor- not seen properly

by Ravi Vare -
Hi Bob,
MathType is Excellent. No Doubt !!
I am using MathType 5.2

My Question is What proper Code for 3X3 Matrix.
which will render properly by Mathtran.
Where do i get 'such' information.

for Matriices, i will enter code manually.(If Mathtype 5.2 is unable to create code for 3X3)

Thanks
and thanks for MathType

Ravi
In reply to Ravi Vare

Re: Matrices in HTML editor- not seen properly

by Bob Mathews -

Ravi, here is the code I used for the 3x3 above:

$ $\left( {\begin{array}{ccccccccccccccc}{{a_{11}}}&{{a_{12}}}&{{a_{13}}}\\{{a_{21}}}&{{a_{22}}}&{{a_{23}}}\\{{a_{31}}}&{{a_{32}}}&{{a_{33}}}\end{array}} \right)$ $

Except don't put a space between the dollar signs.

In reply to Bob Mathews

Re: Matrices in HTML editor- not seen properly

by Mauno Korpelainen -

The MathType code itself is ok ( 3 times c would be enough for a 3 column matrix) but Ravi's problem is caused by the renderer - mathTran - which is using custom syntax for matrices and roots. See http://www.mathtran.org/wiki/index.php/Syntax_differences

It is a little bit painful to enter large matrices manually but code like

http://www.mathtran.org/cgi-bin/mathtran?tex=\left%28+\matrix+{{a_{11}}+%26+{a_{12}}+%26+{a_{13}}+\cr+{a_{21}}+%26+{a_{22}}+%26+{a_{23}}+\cr+{a_{31}}+%26+{a_{32}}+%26+{a_{33}}}+\right%29

should render

Matrix

with mathtran.

In reply to Mauno Korpelainen

Re: Matrices in HTML editor- not seen properly

by Mauno Korpelainen -

And to get this url code and

Matrix

Ravi should probably use syntax like

\left( \matrix {{a_{11}} & {a_{12}} & {a_{13}} \cr {a_{21}} & {a_{22}} & {a_{23}} \cr {a_{31}} & {a_{32}} & {a_{33}}} \right)

IF Mathtran filter encodes "(" to "%28" and "&" to "%26" and ")" to "%29" and space to "+" with \cr as new line in urls.

I have not tested this with Mathtran filter - just with Mathtran img tags.

In reply to Mauno Korpelainen

Re: Matrices in HTML editor- not seen properly

by Bob Mathews -

Yes, of course. You answered Ravi's question more directly than I did. I was focusing on the MathType part, and didn't notice the Mathtran part.

Not quite sure why MathType puts so many c's in there.

In reply to Bob Mathews

Re: Matrices in HTML editor- not seen properly

by Ravi Vare -
Hi Bob,
i installed MathType 6.7a(30 daysTrial)
Translator -Plain TeX

I am surprised for 2X2 Matrix.

code generated - $ $\left( {\matrix{
a & b \cr
c & d \cr

} } \right)$ $

It doesn't show properly in HTML area,
But show properly in OPTION area

Pl. see screenchot

Still Mauno's trick, i haven't try.

Ravi


Attachment matrix.JPG
In reply to Ravi Vare

Re: Matrices in HTML editor- not seen properly

by Ravi Vare -
Hei Mauno,
i tried your code

\left( \matrix {{a_{11}} & {a_{12}} & {a_{13}} \cr {a_{21}} & {a_{22}} & {a_{23}} \cr {a_{31}} & {a_{32}} & {a_{33}}} \right)

with double dollars

It also same i.e.

Not OK in HTML area But
OK in 'Option' area
Pl see screenshot

Ravi
Attachment Matrix2.JPG
In reply to Ravi Vare

Re: Matrices in HTML editor- not seen properly

by Mauno Korpelainen -

This amp; issue is most likely caused by some other editor related problem - not the mathematical syntax itself.

My guess is that when you paste the code to editor ampersand & is converted to html entity & and inside mathematical notations like matrices such expressions show only first & to separate different parts of matrix code and rest of the entity amp; is shown at the beginning of the following part.

This might be a bug in Quiz module or some question type - have you tried to save your question in html mode ( press <> and save the question ) ?

( In editor mode you see typically & but in html mode HTMLArea changes all ampersands to &amp; entities and when you swich back from html mode to editor mode &amp; entities are again converted to ampersands )

Average of ratings: Useful (1)
In reply to Mauno Korpelainen

Re: Matrices in HTML editor- not seen properly

by Ravi Vare -
Hei Mauno,

100 % true.

In 'OPTION' area- It is already in HTML. That is why it renders properly.(NO "&" Problem)

But Moodle Editor (HTML) consider it (&) ..........> HTML entity.

Thanks again as usual

Ravi
In reply to Ravi Vare

Re: Matrices in HTML editor- not seen properly

by Ravi Vare -
Hei Mauno,
when HTML (< >) remain open.
it renders properly.
but,
i think it is not perfect solution because whenever we update the same question.

it repeats same Problem.

Now, i am trying

http://www.mathtran.org/cgi-bin/mathtran?tex=\left%28+\matrix+{{a_{11}}+%26+{a_{12}}+%26+{a_{13}}+\cr+{a_{21}}+%26+{a_{22}}+%26+{a_{23}}+\cr+{a_{31}}+%26+{a_{32}}+%26+{a_{33}}}+\right%29

Does it reuire any more delimiter or any other thing?

pl. suggest.

TIA
Ravi
In reply to Ravi Vare

Re: Matrices in HTML editor- not seen properly

by Mauno Korpelainen -

In my post I used image plugin of editor (in moodle 2 TinyMCE but it's almost similar in HTMLArea) and pasted the complete link to url field - preview shows

Matrix example

Example

Then you get <IMG> tags with encoded url.

In reply to Ravi Vare

Re: Matrices in HTML editor- not seen properly

by Mauno Korpelainen -

And one option is of course to disable editor from your user profile (When editing text - use standard web forms).

Then editor can't change the code and you can edit content of textarea as HTML.

That's not perfect either but it may be easier anyway to disable/enable editor from user profile than to start writing manually encoded urls...

Average of ratings: Useful (1)