Mimetex doesn't work

Mimetex doesn't work

by Livia Spini -
Number of replies: 20
Hi!
I've installed moodle 1.9 on Linux server (not my own server). I 've enabled Latex and Algebric notation filters.
I've set correct permission (755) for files filter/tex/mimetex.xxxx... but my $$LaTeX$$ expressions doesn't work.
I see the expression as I wrote ( for example, if I wrote $$2^3$$, I see 2^3). If I click on it, I enter in debug window, but none of test works.
I've contacted my provider. They have enabled cgi mimetex on my domain and they have test it with this php script:
<HTML>
<img src="../cgi-bin/mimetex.cgi?f(x)=\int_{-\infty}^xe^{-t^2}dt" alt="" border=0 align=middle>
</HTML>

The script is on my domain and it works fine, but my expressions between couple of $ no!triste
Thanks!
Average of ratings: -
In reply to Livia Spini

Re: Mimetex doesn't work

by Marc Grober -
So, did you read the docs on Moodle tex filter and run the script to provide debugging information on your TeX installation?
In reply to Marc Grober

Re: Mimetex doesn't work

by Livia Spini -
What script?
I try the six options of TeX Filter Debugger and
  1.  answers
    "DB cache_filters entry for 6+8 not found" 
  2. answers: Could not delete DB cache_filters entry for 6+8 because it could not be found.
  3.  answers: Can not output detailed information due to security concerns, please
    turn on debug mode first.No text output available
  4. answers: http://miosito.it/filter/tex/textdebug.php?tex=6%2b8&action=ShowImageTex
  5. answers: Can not output detailed information due to security concerns, please turn on debug mode first.

6. answers: If the following image displays correctly, set your Administration->Server->HTTP setting for slasharguments to file.php/1/pic.jpg: 97d185dbdb43b4b1c527069e4310fb1b.gif

Otherwise set it to file.php?file=/1/pic.jpg It should display correctly as pix.php?file=97d185dbdb43b4b1c527069e4310fb1b.gif

If neither equation image displays correctly, please seek further help at moodle.org at the Mathematics Tools Forum

No text output available



I don't understand what "settings for slasharguments.." means.
The only right suggestion, for me is " seek further
help at moodle.org..."  Tanks for help! 
In reply to Livia Spini

Re: Mimetex doesn't work

by Marc Grober -
run http://yourmoodle.tld/filter/tex/texdebug.php, zip the result and post
http://docs.moodle.org/en/TeX_notation_filter#Debugging_TeX_filter

re slasharguments, open your admin block from inside moodle and go to Server, then in the server menu go to HTTP and set slasharguments as directed.

In reply to Marc Grober

Re: Mimetex doesn't work

by Livia Spini -
Thanks!
Sorry, I'm a newbe, and I don't understand your answer. How can I zip the debug result? It isn't a file but it is an interactive window.
About slashargument: I've opened in admin block Server->HTTP. I've found only a check box named "Use the slash argument". It is checked. The lower explanation talks about two option on side of explanation, but I don't see them.
In reply to Livia Spini

Re: Mimetex doesn't work

by Marc Grober -
You can do a screen capture? - then zip the captured file and attach. Or you can send me URL
In reply to Marc Grober

Re: Mimetex doesn't work

by Livia Spini -
Ok. I attach the sceenshots of six test. They are divided in parts due to size of images.
Thanks!
In reply to Livia Spini

Re: Mimetex doesn't work

by Livia Spini -
Screenshot of tests 3 and 5
In reply to Livia Spini

Re: Mimetex doesn't work

by Marc Grober -
sorry, your files show as corrupt and show as just a few k(custom here is to post files with simple zip extension)

how about running the algebra command from the debug page and then copy and paste that into your response in this forum. If debug mode is turned on it will provide detaisl on your binaries
In reply to Livia Spini

Re: Mimetex doesn't work

by Mauno Korpelainen -

Livia,

debugging is not enabled on your site. Set first from

Administration > Server > Debugging > Debug messages ALL: Show all reasonable PHP debug messages

and

Display debug messages: Yes

and check if you get new messages from texdebug.php...

One recent bug http://tracker.moodle.org/browse/MDL-22006 prevented rendering tex with php 5.3. but it was fixed in April.

And even if file filter/mimetex.linux had permissions set to 755 it is possible that some disabled functions of php prevent executing executable scripts like mimetex.linux outside cgi folder or your moodledata subfolder filter/tex might not allow writing...

But let's see if we get some new debugging messages when it is enabled.

In reply to Mauno Korpelainen

Re: Mimetex doesn't work

by Livia Spini -
Thanks, Mauno!
I follow your advice and now I get new messages from Tex Filter Debugger.
If I try the 3th option (Show a graphic image of the algebraic expression rendered with mimetex), I get these messages:

Notice: Undefined variable: status in /var/www/vhosts/xxx.it/httpdocs/filter/tex/texdebug.php on line 140

Warning: system() has been disabled for security reasons in /var/www/vhosts/xxx.it/httpdocs/filter/tex/texdebug.php on line 140

Warning: shell_exec() has been disabled for security reasons in /var/www/vhosts/xxx.it/httpdocs/filter/tex/texdebug.php on line 151


Notice: Undefined variable: status in /var/www/vhosts/xxx.it/httpdocs/filter/tex/texdebug.php on line 152
The shell command
"/var/www/vhosts/xxx.it/httpdocs/filter/tex/mimetex.linux" -e "/var/www/vhosts/xxx.it/private/moodledata/filter/tex/ce5776e7cfaf1b5d86d31435e089b509.gif" -- '\Large 5^4'
returned status =

Notice: Undefined variable: status in /var/www/vhosts/xxx.it/httpdocs/filter/tex/texdebug.php on line 153

Notice: Undefined variable: status in /var/www/vhosts/xxx.it/httpdocs/filter/tex/texdebug.php on line 155

Notice: Undefined variable: status in /var/www/vhosts/xxx.it/httpdocs/filter/tex/texdebug.php on line 157
File size of mimetex executable /var/www/vhosts/xxx.it/httpdocs/filter/tex/mimetex.linux is 830675
The file permissions are: 100755
The md5 checksum of the file is 56bcc40de905ce92ebd7b083c76e019e
Image not found!
No text output available

Thanks!


In reply to Livia Spini

Re: Mimetex doesn't work

by Mauno Korpelainen -

Well there you have the answer:

system() has been disabled for security reasons ...
shell_exec() has been disabled for security reasons ...

Your site has some disabled function of php that you can see in php info and they prevent executing of these scripts/commands.

If you check Administration > Server > PHP info you might see a list of disabled functions from row

disable_functions

You could ask from your host if it is possible to use

disable_functions =

in a local php.ini (no disabled function)

or at least remove those system and shell_exec.

If it is not possible you can for example use your cgi mimetex with img tags with your editor image plugin...and without tex filter like this:
\alpha\beta
where tags given by editor plugin are <img title="\alpha\beta" align="middle" alt="\alpha\beta" src="http://www.imathas.com/cgi-bin/mimetex.cgi?\alpha\beta" border="0" hspace="0" complete="true" /> (in IE)

Note: I used here imathas.com but you should use your site cgi mimetex there...

Attachment example.gif
In reply to Mauno Korpelainen

Re: Mimetex doesn't work

by Livia Spini -
Tanks!
I've got through to my host and I hope they resolve my problem. I've also tryed the solution with img tag and it works, but it seems me a bit complicated to use for my students.
I'd prefer the first solution, if possible.
I've installed Jsmath plugin and it works too.
What the differences between Jsmath and native tex?
Thanks!

In reply to Livia Spini

Re: Mimetex doesn't work

by Mauno Korpelainen -

JsMath is using javascript to render some most common LaTeX syntax using images - the same way as successor of JsMath - MathJax - or AsciimathML/LatexMathML which use MathML for Firefox and image fallback for other browsers. That way none of these scripts work if javascript is disabled but in most cases javascript is enabled in browsers.

(La)TeX on the other hand has many distributions with different extra packages and different external renderers use some special syntax but mostly all of them are based on the same TeX syntax.

In reply to Mauno Korpelainen

Re: Mimetex doesn't work

by Livia Spini -
Tex (without tag img) has another advantage, in my opinion. It teaches students how build formulas. In fact, if you click on the formula, a window with the source is opened. This doesn't happen with formulas with tag img or jsMath.
In reply to Livia Spini

Re: Mimetex doesn't work

by Livia Spini -
If I double click on jsMath formula, the tex source is been displayed too!! grande sorriso
Good!
In reply to Mauno Korpelainen

Re: Mimetex doesn't work

by Valeria Gancheva -
Hi,
We have similar problem - \frac{1}{8} is workong, but \frac{1}{9}, \frac{5}{12} etc. can't be seen. The messages from texdebbuger are the same as above (shown by Livia Spini). It seems that the problem is not with the permissions. The problem appeared on 28 of may. It spread and on the old TeX formulas.
May you help?
Thank you.
In reply to Valeria Gancheva

Re: Mimetex doesn't work

by Mauno Korpelainen -

It is possible that this \frac{1}{8} was read from your tex filter cache - and the old image was in your moodledata subfolder filter/tex/ and your host disabled some functions of php for security reasons on 28th of May. In that case you could contact your host and ask if they have some workarounds to use those disabled functions on your site (local php.ini or .htaccess files or sometimes changes to other extra security settings/modules) - or you could change host - or you could use some other tex renderer...

Check first Administration > Server > PHP info (disable_functions row)

In reply to Mauno Korpelainen

Re: Mimetex doesn't work

by Valeria Gancheva -
Thank you for your answer. We have already contact our host. They answered that haven't changed anything. After May 28 one by one the TeX formulas from old courses that used TeX also disaperead. The host (on our request) restored the system from a backup. The old courses now work but the new written formulas work very selectively.

The PHP info (disable_functions row) reads like this:
ini_alter,system,passthru,shell_exec,leak,listen,chgrp,apache_setenv,define_syslog_variables,openlog,syslog,ftp_exec,posix_getpwuid,posix_getpwnam,symlink

Another problem persisits:
On the first page of our moodle site (http://www.regalia6.eu/moodle/) (this is, in index.php) appears a spam.

Thank you in advance