Tex Filter difficulties in 2.6.2 / problem with convert

Tex Filter difficulties in 2.6.2 / problem with convert

by Adriano A Filho -
Number of replies: 6

I'm having problems in getting the TeX filter to work properly in a 2.6.2 Moodle site moved to a new server. The site evolved within a Bitnami Moodle Stack in EC2 (Ubuntu), and was moved to a new stack in the new server. Everything is working fine except the TeX filter. The problem seems with /usr/bin/convert (debug output below). The .tex, .dvi and .ps files are being properly generated in moodledata/temp/latex by Moodle, but not the final .png file. Convert is working fine in converting ps files to png in a Linux shell but not when used by Moodle.

Any help will be appreciated. 

A. Azevedo Filho

 

Debug´s output:

latex executable (/usr/bin/latex) is readable
dvips executable (/usr/bin/dvips) is readable
convert executable (/usr/bin/convert) is readable

base filename for expression is 'c4789a8ae55e12b03bc43ae790befb5e'

Processing TeX expression:

f(x)=\int_{-\infty}^x~e^{-t^3}dt

/usr/bin/latex --interaction=nonstopmode --halt-on-error /opt/bitnami/apps/moodle/moodledata/temp/latex/c4789a8ae55e12b03bc43ae790befb5e.tex
OUTPUT: This is pdfTeX, Version 3.1415926-1.40.10 (TeX Live 2009/Debian)
entering extended mode

(/opt/bitnami/apps/moodle/moodledata/temp/latex/c4789a8ae55e12b03bc43ae790befb5
e.tex
LaTeX2e <2009/09/24>
....
Output written on c4789a8ae55e12b03bc43ae790befb5e.dvi (1 page, 496 bytes).
Transcript written on c4789a8ae55e12b03bc43ae790befb5e.log.
RETURN CODE: 0

/usr/bin/dvips -E /opt/bitnami/apps/moodle/moodledata/temp/latex/c4789a8ae55e12b03bc43ae790befb5e.dvi -o /opt/bitnami/apps/moodle/moodledata/temp/latex/c4789a8ae55e12b03bc43ae790befb5e.ps
OUTPUT:
RETURN CODE: 0

/usr/bin/convert -density 240 -trim /opt/bitnami/apps/moodle/moodledata/temp/latex/c4789a8ae55e12b03bc43ae790befb5e.ps /opt/bitnami/apps/moodle/moodledata/temp/latex/c4789a8ae55e12b03bc43ae790befb5e.png
OUTPUT:
RETURN CODE: 1

 

Average of ratings: -
In reply to Adriano A Filho

Re: Tex Filter difficulties in 2.6.2 / problem with convert

by Adriano A Filho -

As an addition to my previous message...

In 2.6.2+ (in the stock distribution) mimetex.linux is not working properly in Ubuntu. I fixed this problem installing mimetex (sudo apt-get install mimetex) and replacing mimetex.linux by the new file /usr/bin/mimetex installed. Now the TeX filter fallback to mimetex works. However, I´m still with the problem with /usr/bin/convert execution by moodle, as described in the previous message.

regards, Adriano

In reply to Adriano A Filho

Re: Tex Filter difficulties in 2.6.2 / problem with convert

by Daniel Thies -
Picture of Core developers Picture of Plugin developers Picture of Testers

You might check whether convert is present on command line. This is part of the Imagemagick package (see TeX notation Filter documentation). Normally, it would be required by the Gnome desktop, but it may need to be added in a server environment with 'apt-get install imagemagick'.

When you migrated servers did you move from 32bit to 64bit instance? The binary for mimetex packaged with Linux is probably 32bit.  This should probably be updated or documented if it is the problem.

In reply to Daniel Thies

Re: Tex Filter difficulties in 2.6.2 / problem with convert

by Adriano A Filho -

Daniels, thanks for your comments. Convert is working fine as command line. ImageMagick is already installed. The problem appears when convert is called within Moodle.

About mimetex.linux, I´m using a 64 bits instance (moving from a 64 bits) and it is indeed very likely that the executable in the stock 2.6.* distribution is Linux 32 bits and the documentation is not mentioning it or I failed to find it.

After replacing the mimetex.linux by the /usr/bin/mimetex file installed with apt-get install mimetex, I could get the TeX Filter fallback to mimetex to work fine. The problem is still with convert to work in order to avoid the fallback and get nicer equations.

As a sideline, I´ve tested  MathtML, which worked fine, totally avoiding the TeX filter, but because I have lots of quizzes using $$ to define inline Math expressions, I believe it is not a practical solution at this time. 

In reply to Adriano A Filho

Re: Tex Filter difficulties in 2.6.2 / problem with convert

by Daniel Thies -
Picture of Core developers Picture of Plugin developers Picture of Testers

I believe that the standard error output is reported more explicitly in /var/log/apache2/error.log. Run texdebug and look at the last line of the file.  Return Code: 1 is probably a permission problem, but could be almost anything else. If that does not help try running on the command line:

sudo -u www-data /usr/bin/convert -density 240 -trim /opt/bitnami/apps/moodle/moodledata/temp/latex/c4789a8ae55e12b03bc43ae790befb5e.ps /opt/bitnami/apps/moodle/moodledata/temp/latex/c4789a8ae55e12b03bc43ae790befb5e.png

where the last part is copied from recent texdebug ourput. The files are normally kept in temp directory for some time. So this should execute successfully if binary and permissions are correct.

Incidently if you have tried MathJax the delimiters can be customized to be to use double $. It just takes a little patience to figure out the syntax. 

In reply to Daniel Thies

Re: Tex Filter difficulties in 2.6.2 / problem with convert

by Adriano A Filho -

Daniel, thanks again. It appears to me that the problem with convert started with the move from 2.6.1 to 2.6.2. I tested this in my old server, upgrading to 2.6.2.... there was a fallback to Mimetex in the Tex Filter. The full TeX convertion was taking place without problems in 2.6.1 and broke in 2.6.2. By the way, /usr/bin/convert run from command line, as you suggested, works fine, creating the png file. The problem is some place else.

In any case, I invested some time in MathJax configuration and ended up disabling the TeX filter, moving to the MathJax alternative. So far I´m pleased with the results. I´m following the discussion on having MathJax already integrated in Moodle 2.7. I believe that is good move.