I am running moodle 1.9.5 and 1.9.7 on the same machine.(RHEL5,php5.3)
The LaTeX renderer Settings are correct (installed) and the paths:
/usr/bin/latex
/usr/bin/dvips
/usr/bin/convert
Its working fine on 1.9.5 but on 1.9.7 it shows the correct link but not the image.
All permissions are identical for both instances.
The same server have two moodle versions: 1.9.5 and 1.9.7. Currently LaTex is working fine on Moodle 1.9.5, but the problem is on version 1.9.7. It shows the correct link but not the image.
We test the output of Tex on moodle using texdebug.php.
we got the error: The image “http://ourdomain/filter/tex/texdebug.php?tex=%5Crho&action=ShowImageMimetex” cannot be displayed, because it contains errors.
Folder and file permissions are the same on both instances.
Any hints?Is there a bug on 1.9.7?
regards,
amer
Option 3 in texdebugging.php - Show a graphic image of the algebraic expression rendered with mimetex - is using code
if ($action=='ShowImageMimetex') {
tex2image($texexp);
}
and it tries to use executable mimetex file from folder filter/tex (or if you have created a symbolic link from executable mimetex some local version of mimetex elsewhere)
Option 4 - Show a graphic image of the algebraic expression rendered with Tex/Ghostscript - is using
if ($action=='ShowImageTex') {
TexOutput($texexp, true);
exit;
}
and it tries to render tex image with local binaries you mentioned but f(x)=\Bigint_{-\infty}^x~e^{-t^2}dt should not be used because \Bigint is mimetex syntax...
If tex filter does not seem to work at all and permissions of executable files are correct doublecheck the settings from Administration > Modules > Filters > TeX Notation or try to re-upload files of folder filter/tex - some file might be corrupted.
I appreciate your reply!
All i did, was unzip moodle 1.9.7 on a server which already has 1.9.5 running very well.
File permission: -rwxr-xr-x 1 root root 812K Jul 16 2009 mimetex.linux
Latex Renderer settings are exactly same as the snapshot you attached.
When i check moodle data folder/filter/tex, i see the pictures are already created there. I deleted them too, and are re-created.
So whats going wrong then?
thnx!
amer
This shows, that the pictures are being generated.
Permissions on their folder is 777
What might be the cause?
amer
On same machine the 195 is working!!!
regards,
amer
I don't know for sure any good explanation.
It might have something to do with version of php - since moodle 1.9.5 some security fixes were added to tex filter but my test sites have had no such problems with tex filter. Or some kind of a server cache issue (image is created but not found when moodle is trying to render it using possibly wrong/cached path???)
I could try to test a fresh local XAMPP install with php 5.3.1 during this weekend and check if some 1.9.7/8 tex filter commands are incompatible with php 5.3 - other people have reported before that moodle 1.9.7 is not fully compatible with php 5.3 (elsewhere)
i really appreciate your help and your investigation. Thankyou for giving this issue some of your time!
i cant downgrade to php 5.2.x because of many security breaches found in that version. i recommend to upgrade php asap.
Meanwhile, i will use an alternative method to write these "roman characters", using html entities rather than tex.
I hope this gets the attention of the related developers and get it solved soon.
regards,
amer
Re: Tex filter not working on 1.9.7 or 1.9.8 with php 5.3.X
Because Petr said that they are definitely NOT going to do any changes like this (ereg-preg changes) in STABLE branch I tested a quick fix that seems to get tex notations back on my test moodle 1.9.8 with php 5.3.1 (XAMPP):
In filelib.php
line 499
if (eregi('\.([a-z0-9]+)$', $filename, $match)) {
can be changed for example to
if (preg_match('/\.([a-z0-9]+)$/', $filename, $match)) {
or if you want to use tildes instead of slashes try
if (preg_match('~\.([a-z0-9]+)$~', $filename, $match)) {
and the same way in moodlelib.php
lines 467 to 470 from
$param = ereg_replace(':cntrl:|[<>"`\|\':]', '', $param);
$param = ereg_replace('\.\.+', '', $param);
$param = ereg_replace('//+', '/', $param);
return ereg_replace('/(\./)+', '/', $param);
to
$param = preg_replace('~:cntrl:|[&<>"`\|\':]~', '', $param);
$param = preg_replace('~\.\.+~', '', $param);
$param = preg_replace('~//+~', '/', $param);
return preg_replace('~/(\./)+~', '/', $param);
Note - when you edit moodlelib.php use only such text editor that does not change UTF-8 coding of moodlelib.php and does not add BOMs to moodlelib.php...
Re: Tex filter not working on 1.9.7 or 1.9.8 with php 5.3.X
Btw I just said we are not going to change all eregs to pregs only to eliminate some warnings, but if some of them cause problems I agree we need to fix them in 1.9.8+ asap.
Re: Tex filter not working on 1.9.7 or 1.9.8 with php 5.3.X
Well, in a way it is a new issue (or old issue) but there is another fix too - like you suggested in that other post changing the error_reporting in filter/tex/pix.php and then those previous tags can stay as they are.
So if line 29 is changed from
error_reporting(E_ALL);
to
error_reporting(E_ALL & ~E_DEPRECATED);
php 5.3 does not show the deprecated functions warnings that otherwise would prevent showing of tex images.
In the long run all deprecated features of php 5.3.X should be fixed in core code like suggested in php.net/manual/en/migration53.deprecated.php because those deprecated features won't work at all in php 6 (will be removed for ever) but that's not necessary today or before moodle 2.0 is released...
Re: Tex filter not working on 1.9.7 or 1.9.8 with php 5.3.X
Petr,
I created a new tracker report http://tracker.moodle.org/browse/MDL-22006 about this php 5.3.X tex filter issue
Not a big thing and easy to "fix" in core code
I try it in localhost and very ok but when i upload to website and i don't show math.
Cant u help me.
Sounds like localhost version you are running has supports for Math and server does not.
Remotely hosted? Check with hosting provider.
Operating system? Makes a difference installing supports needed for TeX Notation - ie the Math app that draws graphics of the text representations of math.
Site Admin Mehu
Modules
Filders
Manage Filters - TeX Notation ON (little eye icon is open)
Settings:
On a CentOS/RedHat standalone (not shared) server path to latex library is:
/usr/bin/latex
Path to dvips library is
/usr/bin/dvips
Path to convert library is
/usr/bin/convert
** NOTE: no trailing slash in above as they are pointers to 'executables'.
Moodle 2.2.2
Site Admin
Plugins
Filters
Manage Filters
TeX Notation ON.
Settings almost same as version 1.9
version 1.9.x and 2.x of Moodle
http://yoursite/[moodle]/filter/tex/texdebug.php
and
http://yoursite/[moodle]/filter/tex/texdebug.php#help
If remotely hosted, contact your hosting provider to check on supports (latex, dvips, and convert) installation and paths.
'spirit of sharing', Ken
I tried the fix mentioned in this thread and there was no "E_ALL" error function on page 29 (I assume it was changed on 1.9.9)
I made a directory comparison between my 1.9.9 /filter/tex/ directories and found around 150 differences. No wanting to make so many tweaks I simply copied my old tex directory into my current moodle install and it now works perfectly.
Not sure why or if this is related to the php incompatibilities but there is a fix for anyone who is stuck.
I would certainly not recommend the OP's action as a fix, and arguably the action taken now precludes further troubleshooting.
Is there a tracker item for this issue yet?
I install for the first time 1.9.9 on my computer. The tex filter not working and /latex is not readable.
Were is in pix.php line 29 ?
Have you any suggestion ?