Tex filter not functioning

Tex filter not functioning

by Danny "Real Deal" DuncanHines -
Number of replies: 10
I have a whole slew of math problems that were functioning last year, and since then I have migrated to a different server and I'm trying to get the Tex equations to display properly again.

When I check the Tex Filter settings, I see that the Latex and dvips binaries are in the right place but not the Path of convert binary (/usr/bin/convert). Is this the only problem preventing Tex code from displaying as equations, and if so what can I do to remedy the situation? Really, I don't even know what "a binary" is.

Also, I should ask if Tex is the simplest way to convert code to equations (as opposed to jsMath or something).

Thanks in advance! Below are the Tex Filter Debugger messages:

1. See the cache_filters database entry for this expression (if any).
DB cache_filters entry for f(x)=\\Bigint_{-\\infty}^x~e^{-t^2}dt not found.

3. Show a graphic image of the algebraic expression rendered with mimetex:
sh: /hermes/web07c/b1531/moo.thecomedi/moodle/filter/tex/mimetex.linux: Permission denied
The shell command
"/hermes/web07c/b1531/moo.thecomedi/moodle/filter/tex/mimetex.linux" -e "/hermes/web07c/b1531/moo.thecomedi/moodledata/filter/tex/d1e56126337cd6e29b16fe759232ce90.gif" -- '\Large f(x)=\\Bigint_{-\\infty}^x~e^{-t^2}dt'
returned status = 126
File size of mimetex executable /hermes/web07c/b1531/moo.thecomedi/moodle/filter/tex/mimetex.linux is 830675
The file permissions are: 100755
The md5 checksum of the file is 56bcc40de905ce92ebd7b083c76e019e
Image not found!
Warning: Cannot modify header information - headers already sent by (output started at /hermes/web07c/b1531/moo.thecomedi/moodle/filter/tex/texdebug.php:150) in /hermes/web07c/b1531/moo.thecomedi/moodle/filter/tex/texdebug.php on line 105
No text output available

4. Show a graphic image of the algebraic expression rendered with Tex/Ghostscript.
Warning: filemtime() [function.filemtime]: stat failed for /hermes/web07c/b1531/moo.thecomedi/moodledata/temp/latex/d1e56126337cd6e29b16fe759232ce90.gif in /hermes/web07c/b1531/moo.thecomedi/moodle/lib/filelib.php on line 687
Warning: filesize() [function.filesize]: stat failed for /hermes/web07c/b1531/moo.thecomedi/moodledata/temp/latex/d1e56126337cd6e29b16fe759232ce90.gif in /hermes/web07c/b1531/moo.thecomedi/moodle/lib/filelib.php on line 688
Warning: Cannot modify header information - headers already sent by (output started at /hermes/web07c/b1531/moo.thecomedi/moodle/lib/filelib.php:687) in /hermes/web07c/b1531/moo.thecomedi/moodle/lib/filelib.php on line 719
Warning: fopen(/hermes/web07c/b1531/moo.thecomedi/moodledata/temp/latex/d1e56126337cd6e29b16fe759232ce90.gif) [function.fopen]: failed to open stream: No such file or directory in /hermes/web07c/b1531/moo.thecomedi/moodle/lib/filelib.php on line 100 5. Show command execution output from the algebraic expression rendered with Tex/Ghostscript. Checking executables
latex executable (/usr/bin/latex) is readable
dvips executable (/usr/bin/dvips) is readable
Error: convert executable (/usr/bin/convert) is not readable

base filename for expression is 'd1e56126337cd6e29b16fe759232ce90'

Processing TeX expression:

f(x)=\Bigint_{-\infty}^x~e^{-t^2}dt

$ /usr/bin/latex --interaction=nonstopmode /hermes/web07c/b1531/moo.thecomedi/moodledata/temp/latex/d1e56126337cd6e29b16fe759232ce90.tex
OUTPUT: This is pdfTeXk, Version 3.141592-1.40.3 (Web2C 7.5.6)
%&-line parsing enabled.
I can't find the format file `latex.fmt'!
RETURN CODE: 1

$ /usr/bin/dvips -E /hermes/web07c/b1531/moo.thecomedi/moodledata/temp/latex/d1e56126337cd6e29b16fe759232ce90.dvi -o /hermes/web07c/b1531/moo.thecomedi/moodledata/temp/latex/d1e56126337cd6e29b16fe759232ce90.ps
OUTPUT:
RETURN CODE: 1

$ /usr/bin/convert -density 240 -trim /hermes/web07c/b1531/moo.thecomedi/moodledata/temp/latex/d1e56126337cd6e29b16fe759232ce90.ps /hermes/web07c/b1531/moo.thecomedi/moodledata/temp/latex/d1e56126337cd6e29b16fe759232ce90.gif
OUTPUT:
RETURN CODE: 127 6. Check slasharguments setting. Warning: Cannot modify header information - headers already sent
by (output started at
/hermes/web07c/b1531/moo.thecomedi/moodle/filter/tex/texdebug.php:266)
in /hermes/web07c/b1531/moo.thecomedi/moodle/filter/tex/texdebug.php
on line 105

No text output available
Average of ratings: -
In reply to Danny "Real Deal" DuncanHines

Re: Tex filter not functioning

by Colin Fraser -
Picture of Documentation writers Picture of Testers
At a first guess, I would suggest that the problem may lie here:

Error: convert executable (/usr/bin/convert) is not readable


Or perhaps just one problem. Check the path to Ghostscript. Make sure that the Ghostscript conversion files are in the right place. Are they the right version? I am not sure of versions are an issue, but may be. That would be the place to start, I would suggest.
In reply to Colin Fraser

Re: Tex filter not functioning

by Danny "Real Deal" DuncanHines -
Thanks for the quick reply, Colin.

Can I ask what Ghostscript is and how I can tell if its files are in the right place? I'm new to the Tex rendering world and the documentation is a bit lacking. Thanks!
In reply to Danny "Real Deal" DuncanHines

Re: Tex filter not functioning

by Mauno Korpelainen -

http://en.wikipedia.org/wiki/Ghostscript but you could also use Imagemagick http://en.wikipedia.org/wiki/ImageMagick for that file format conversion (convert executable)

Both of them can be separately installed to your server if they do not already exist...or are not found from given path...or are not readable and executable...

In reply to Mauno Korpelainen

Re: Tex filter not functioning

by Colin Fraser -
Picture of Documentation writers Picture of Testers
What is your setup? Are you the Administrator of the Moodle and the Network Manager? Or Moodler but on a hosted service? Have a talk to your host or network manager. What happens, as I understand it, is that the TeX filters uses the identifiers, the $$$ symbols, and converts the string to an intermediary code, then passes it to the graphic converter, Ghostscript or Image Magick, which creates a binary image file which is then rendered by the graphics engine to a gif or png file.

Try and find out if you have access to Ghostscript and its path. I am on a Windows server at work and use XP at home on one box and now I have a box for Linux will be setting that up soonish so I use Image Magick for the converter.

If one of these paths is not correct, nothing will work, so from your comments I would suggest that it is falling over at the conversion point. It may be that the Host uses Image Magick, so you will need to develop that path, or perhaps that path has changed recently and is no longer accessible. Ask if you do not have access to the server, or install one of those programs and set the path right if you do. Cheers..
In reply to Colin Fraser

Re: Tex filter not functioning

by Danny "Real Deal" DuncanHines -
Colin: Thanks for the simple explanation about what happens when Tex code is converted into an image. I don't know why it isn't stated so simply in the documentation!

I am the Administrator for Moodle, but I'm on a hosted service with fatcow.com. I talked to them today and found the paths to both ImageMagick and Ghostscript ('/usr/local/lib/ImageMagick' and '/usr/local/bin/gs' respectively). I pasted each one of these into the "path to convert binary" blank in the Tex Notation Filter Settings and saved the chages, but to no affect for either of them. There's still a little red X telling me the path isn't right. The server is a Linux server if that helps any.

Can I do something like install ImageMagick or GhostScript in a folder on the FTP server and then set the path to that folder? It appears that I'm in a bit over my head here...
In reply to Danny "Real Deal" DuncanHines

Re: Tex filter not functioning

by Marc Grober -
the paths you describe are not the paths to the binary needed.....
the path will likely be /usr/local/bin/ as opposed to /usr/bin/ and you can double check this if you have shell access
In reply to Marc Grober

Re: Tex filter not functioning

by Danny "Real Deal" DuncanHines -
Marc,

You are right. I changed the path to usr/local/bin and a check mark appeared. Yes! The bad news is that it has done nothing to affect the functionality of the Tex filter.

Are there any other procedures recommended for tracking down the problem?

Thanks again for your help.
In reply to Danny "Real Deal" DuncanHines

Re: Tex filter not functioning

by Marc Grober -
First, do you have green checks for all the binaries, and if so what happens when you run the debug routines?
In reply to Marc Grober

Re: Tex filter not functioning

by Danny "Real Deal" DuncanHines -

All the checks are green.

Here are the results of the debugger:

1. See the cache_filters database entry for this expression (if any)
cache_filters entry for f(x)=\\Bigint_{-\\infty}^x~e^{-t^2}dt not found

3. Show a graphic image of the algebraic expression rendered with mimetex

sh: /hermes/web07c/b1531/moo.thecomedi/moodle/filter/tex/mimetex.linux: Permission denied
The shell command
"/hermes/web07c/b1531/moo.thecomedi/moodle/filter/tex/mimetex.linux" -e "/hermes/web07c/b1531/moo.thecomedi/moodledata/filter/tex/d1e56126337cd6e29b16fe759232ce90.gif" -- '\Large f(x)=\\Bigint_{-\\infty}^x~e^{-t^2}dt'
returned status = 126
File size of mimetex executable /hermes/web07c/b1531/moo.thecomedi/moodle/filter/tex/mimetex.linux is 830675
The file permissions are: 100755
The md5 checksum of the file is 56bcc40de905ce92ebd7b083c76e019e
Image not found!
Warning: Cannot modify header information - headers already sent by (output started at /hermes/web07c/b1531/moo.thecomedi/moodle/filter/tex/texdebug.php:150) in /hermes/web07c/b1531/moo.thecomedi/moodle/filter/tex/texdebug.php on line 105
No text output available

4. Show a graphic image of the algebraic expression rendered with Tex/Ghostscript
Warning: filemtime() [function.filemtime]: stat failed for /hermes/web07c/b1531/moo.thecomedi/moodledata/temp/latex/d1e56126337cd6e29b16fe759232ce90.gif in /hermes/web07c/b1531/moo.thecomedi/moodle/lib/filelib.php on line 687

Warning: filesize() [function.filesize]: stat failed for /hermes/web07c/b1531/moo.thecomedi/moodledata/temp/latex/d1e56126337cd6e29b16fe759232ce90.gif in /hermes/web07c/b1531/moo.thecomedi/moodle/lib/filelib.php on line 688

Warning: Cannot modify header information - headers already sent by (output started at /hermes/web07c/b1531/moo.thecomedi/moodle/lib/filelib.php:687) in /hermes/web07c/b1531/moo.thecomedi/moodle/lib/filelib.php on line 719

Warning: fopen(/hermes/web07c/b1531/moo.thecomedi/moodledata/temp/latex/d1e56126337cd6e29b16fe759232ce90.gif) [function.fopen]: failed to open stream: No such file or directory in /hermes/web07c/b1531/moo.thecomedi/moodle/lib/filelib.php on line 1002

5. Show command execution output from the algebraic expression rendered with Tex/Ghostscript

Checking executables
latex executable (/usr/bin/latex) is readable
dvips executable (/usr/bin/dvips) is readable
Error: convert executable (/usr/local/bin) is not readable

base filename for expression is 'd1e56126337cd6e29b16fe759232ce90'

Processing TeX expression:

f(x)=\Bigint_{-\infty}^x~e^{-t^2}dt

$ /usr/bin/latex --interaction=nonstopmode /hermes/web07c/b1531/moo.thecomedi/moodledata/temp/latex/d1e56126337cd6e29b16fe759232ce90.tex
OUTPUT: This is pdfTeXk, Version 3.141592-1.40.3 (Web2C 7.5.6)
%&-line parsing enabled.
I can't find the format file `latex.fmt'!
RETURN CODE: 1

$ /usr/bin/dvips -E /hermes/web07c/b1531/moo.thecomedi/moodledata/temp/latex/d1e56126337cd6e29b16fe759232ce90.dvi -o /hermes/web07c/b1531/moo.thecomedi/moodledata/temp/latex/d1e56126337cd6e29b16fe759232ce90.ps
OUTPUT:
RETURN CODE: 1

$ /usr/local/bin -density 240 -trim /hermes/web07c/b1531/moo.thecomedi/moodledata/temp/latex/d1e56126337cd6e29b16fe759232ce90.ps /hermes/web07c/b1531/moo.thecomedi/moodledata/temp/latex/d1e56126337cd6e29b16fe759232ce90.gif
OUTPUT:
RETURN CODE: 126

6. Check slasharguments setting

Warning: Cannot modify header information - headers already sent by (output started at /hermes/web07c/b1531/moo.thecomedi/moodle/filter/tex/texdebug.php:266) in /hermes/web07c/b1531/moo.thecomedi/moodle/filter/tex/texdebug.php on line 105 No text output available
In reply to Danny "Real Deal" DuncanHines

Re: Tex filter not functioning

by Mauno Korpelainen -

There seem to be a couple of problems:

RETURN CODE: 126 means that command invoked cannot execute = Permission problem or command is not an executable. So most likely usr/local/bin is not directly executable and you need to change permissions to allow all users execute that binary or need to create a symbolic link to that binary or need to check that some disabled function of php (disable_functions in php.ini) or some security module does not prevent executing of this script...

File filter/tex/mimetex.linux returns the same code 126 even if the file permissions are 755 so my guess is that the problem is in some security settings (mod_security, disable_functions etc)