Cannot display TeX images.

Cannot display TeX images.

by Alan Greer -
Number of replies: 7

Running Moodle v 2.3

Installed TeX required packages: /usr/bin/latex /usr/bin/dvips /usr/bin/convert - all ticks.

Turned on debugging and ran the debug page "http://localhost/moodle/filter/tex/texdebug.php"

Selected option 3 and clicked on Do it.  Below is the output:

 

The shell command
"/var/www/html/moodle/filter/tex/mimetex.linux" -e "/var/moodledata/filter/tex/9608176195573c30c6beb3cf078fdf66.gif" -- '\Large f(x)=\int_{-\infty}^x~e^{-t^2}dt'
returned status = 0
File size of mimetex executable /var/www/html/moodle/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


Now if I run the command myself from the command line it works, provides an image which I can then open in gimp (or other editor).  However, re-executing this test deletes that image and gives me the same results.

I have no experience with this but I imagine I might have some permission issue, I tried to check by running the command as sudo -u apache (which again, works) so I'm a bit puzzled.  Also if there was a permission problem with my /var area I would imagine the test wouldn't be able to delete my already present image.

 

Can anyone help me with this?

Thanks in advance.

Average of ratings: -
In reply to Alan Greer

Re: Cannot display TeX images.

by Colin Fraser -
Picture of Documentation writers Picture of Testers

Dragmath is now in Core so you might want to have a look at this documentation. Read it carefully and you may want to pay particular attention to the decoupling process, that, as I understand it, allows you to use DragMath without interference from the default Mimetex... 

In reply to Colin Fraser

Re: Cannot display TeX images.

by Marc Grober -

OP wouldn't need that info unless he was gong to abandon his Tex installation. And from the sounds of it he is not using mimetex as his debug shoes the Tex inaries and convert to be installed and properly sourced.


My guess is that you have an issues with whom your web aps are running as. Perms are set ugo and are therefore relative as between the user and group of the file and the user and group that your daemon is running as. Does your web daemon user (wheel, apache, etc.) or the group that the user is in, have write access to the target directory for the images. By way of example,  if you open that target up completely, it is likely things will work....  now you don;t want to leave it that way so you want to figure out the minimal perms necessary for your daemon to be able to write the image file to the image file location.

In reply to Marc Grober

Re: Cannot display TeX images.

by Colin Fraser -
Picture of Documentation writers Picture of Testers

Is this error the same error message as described here? The returned status is different, 127 as opposed to 0... but that makes a difference? 

In reply to Colin Fraser

Re: Cannot display TeX images.

by Marc Grober -

well,  hvaing determined that the mobile interface for this forum is all but unusable from my mobile device I have retreated to something more prosaic from which ro respond smile

in the earlier thread the poster did not have Tex installed and was just wanting to get Tex expressions displayed ASAP. It made most sense to simply decouple and do MathJax.  In this thread the OP already has Tex installed and the issue is likly that the daemon does not have sufficient perms to write to the target directory,  or that there is a restriction via the OS or php barrin the writing (the httpd error logs might reveal which.)   Of course, the OP here could still decouple and use MathJax,  but that of wource would keep him from using the full power of the Tex he has installed.

In reply to Marc Grober

Re: Cannot display TeX images.

by Alan Greer -

Hi, thanks for the suggestions.  I'll look into the permissions.  I believe the daemon runs as user apache.  I tried from the command line:

sudo -u apache ........


and it appeared to work, but I think I'll test that again.  I'll reply with my results.

In reply to Alan Greer

Re: Cannot display TeX images.

by Alan Greer -

Ok, I can now produce the equations using step 4 in the debug.  To get this working I had to generate an additional latex format file and place it into the correct directory.

latex -ini latex.ltx

cp latex.fmt /var/moodledata/temp/latex

The initial step 3 test still doesn't work.  I checked permissions and there are no problems that I can find.

However, my site now produces the desired equations so I think I will not worry too much about this.

In reply to Colin Fraser

Re: Cannot display TeX images.

by Alan Greer -

Hello, I believe in this case the user didn't have the file present

"sh: /var/www/moodle/filter/tex/mimetex.linux: not found"

which resulted in the status 127.  In my case this exists and so I get the 0 status return.  Thank you for your suggestion though.