TeX troubles

TeX troubles

by sean pearson -
Number of replies: 14
I'm having trouble getting the tex filter working. When running the /filter/tex/texdebug.php tests, this is the output I get the following results. For test 6 neither equation image displayed. Thanks in advance for any help!

1. DB cache_filters entry for f(x)=\\Bigint_{-\\infty}^x~e^{-t^2}dt not found

2. It isn't there so nothing to delete.

3. sh: /stash/webstuff/moodle/filter/tex/mimetex.linux: not found
The shell command
"/stash/webstuff/moodle/filter/tex/mimetex.linux" -e "/stash/webstuff/moodledata/filter/tex/4b826d100ad7b973056dd901f6a5efbf.gif" '\Large f(x)=\\Bigint_{-\\infty}^x~e^{-t^2}dt'
returned status = 127
File size of mimetex executable /stash/webstuff/moodle/filter/tex/mimetex.linux is 491043
The file permissions are: 100755
The md5 checksum of the file is c294ab11905323bb5cb0f451241bedc1
Image not found!
Warning: Cannot modify header information - headers already sent by (output started at /stash/webstuff/moodle/filter/tex/texdebug.php:186) in /stash/webstuff/moodle/filter/tex/texdebug.php on line 101
No text output available

4.
Warning: filemtime() [function.filemtime]: stat failed for /stash/webstuff/moodledata/temp/latex/d1e56126337cd6e29b16fe759232ce90.gif in /stash/webstuff/moodle/filter/tex/texdebug.php on line 283

Warning: Cannot modify header information - headers already sent by (output started at /stash/webstuff/moodle/filter/tex/texdebug.php:283) in /stash/webstuff/moodle/filter/tex/texdebug.php on line 287

Warning: Cannot modify header information - headers already sent by (output started at /stash/webstuff/moodle/filter/tex/texdebug.php:283) in /stash/webstuff/moodle/filter/tex/texdebug.php on line 288

Warning: Cannot modify header information - headers already sent by (output started at /stash/webstuff/moodle/filter/tex/texdebug.php:283) in /stash/webstuff/moodle/filter/tex/texdebug.php on line 289

Warning: Cannot modify header information - headers already sent by (output started at /stash/webstuff/moodle/filter/tex/texdebug.php:283) in /stash/webstuff/moodle/filter/tex/texdebug.php on line 290

Warning: Cannot modify header information - headers already sent by (output started at /stash/webstuff/moodle/filter/tex/texdebug.php:283) in /stash/webstuff/moodle/filter/tex/texdebug.php on line 291

Warning: filesize() [function.filesize]: stat failed for /stash/webstuff/moodledata/temp/latex/d1e56126337cd6e29b16fe759232ce90.gif in /stash/webstuff/moodle/filter/tex/texdebug.php on line 292

Warning: Cannot modify header information - headers already sent by (output started at /stash/webstuff/moodle/filter/tex/texdebug.php:283) in /stash/webstuff/moodle/filter/tex/texdebug.php on line 292

Warning: Cannot modify header information - headers already sent by (output started at /stash/webstuff/moodle/filter/tex/texdebug.php:283) in /stash/webstuff/moodle/filter/tex/texdebug.php on line 293

Warning: readfile(/stash/webstuff/moodledata/temp/latex/d1e56126337cd6e29b16fe759232ce90.gif) [function.readfile]: failed to open stream: No such file or directory in /stash/webstuff/moodle/filter/tex/texdebug.php on line 294

5. Checking executables

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 'd1e56126337cd6e29b16fe759232ce90'

Processing TeX expression:

f(x)=\Bigint_{-\infty}^x~e^{-t^2}dt
$ /usr/bin/latex --interaction=nonstopmode /stash/webstuff/moodledata/temp/latex/d1e56126337cd6e29b16fe759232ce90.tex
OUTPUT: This is pdfeTeX, Version 3.141592-1.30.5-2.2 (Web2C 7.5.5)
entering extended mode
(/stash/webstuff/moodledata/temp/latex/d1e56126337cd6e29b16fe759232ce90.tex
LaTeX2e <2003/12/01>
Babel and hyphenation patterns for english, usenglishmax, dumylang, noh
yphenation, loaded.
(/usr/share/texmf-texlive/tex/latex/base/article.cls
Document Class: article 2004/02/16 v1.4f Standard LaTeX document class
(/usr/share/texmf-texlive/tex/latex/base/size12.clo))
(/usr/share/texmf-texlive/tex/latex/base/inputenc.sty
(/usr/share/texmf-texlive/tex/latex/base/latin1.def))
(/usr/share/texmf-texlive/tex/latex/amslatex/amsmath.sty
For additional information on amsmath, use the `?' option.
(/usr/share/texmf-texlive/tex/latex/amslatex/amstext.sty
(/usr/share/texmf-texlive/tex/latex/amslatex/amsgen.sty))
(/usr/share/texmf-texlive/tex/latex/amslatex/amsbsy.sty)
(/usr/share/texmf-texlive/tex/latex/amslatex/amsopn.sty))
(/usr/share/texmf-texlive/tex/latex/amsfonts/amsfonts.sty)
(/usr/share/texmf-texlive/tex/latex/amsfonts/amssymb.sty)
(/usr/share/texmf-texlive/tex/latex/base/latexsym.sty)
(./d1e56126337cd6e29b16fe759232ce90.aux)
(/usr/share/texmf-texlive/tex/latex/amsfonts/umsa.fd)
(/usr/share/texmf-texlive/tex/latex/amsfonts/umsb.fd)
(/usr/share/texmf-texlive/tex/latex/base/ulasy.fd)
! Undefined control sequence.
l.8 $ f(x)=\Bigint
_{-\infty}^x~e^{-t^2}dt $
[1] (./d1e56126337cd6e29b16fe759232ce90.aux) )
(see the transcript file for additional information)
Output written on d1e56126337cd6e29b16fe759232ce90.dvi (1 page, 436 bytes).
Transcript written on d1e56126337cd6e29b16fe759232ce90.log.
RETURN CODE: 1
$ /usr/bin/dvips -E /stash/webstuff/moodledata/temp/latex/d1e56126337cd6e29b16fe759232ce90.dvi -o /stash/webstuff/moodledata/temp/latex/d1e56126337cd6e29b16fe759232ce90.ps
OUTPUT:
RETURN CODE: 0
$ /usr/bin/convert -density 240 -trim /stash/webstuff/moodledata/temp/latex/d1e56126337cd6e29b16fe759232ce90.ps /stash/webstuff/moodledata/temp/latex/d1e56126337cd6e29b16fe759232ce90.gif
OUTPUT:
RETURN CODE: 1

6. If the following image displays correctly, set your Administration->Configuration->Variables setting for slasharguments to file.php/1/pic.jpg:

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

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


Warning: Cannot modify header information - headers already sent by (output started at /stash/webstuff/moodle/filter/tex/texdebug.php:311) in /stash/webstuff/moodle/filter/tex/texdebug.php on line 101
No text output available

Average of ratings: -
In reply to sean pearson

Re: TeX troubles

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
$ /usr/bin/convert -density 240 -trim /stash/webstuff/moodledata/temp/latex/d1e56126337cd6e29b16fe759232ce90.ps /stash/webstuff/moodledata/temp/latex/d1e56126337cd6e29b16fe759232ce90.gif
OUTPUT:
RETURN CODE: 1

That should be a return code of zero I would have thought. Strange there's no error message if it has failed though.

Are the permissions on your moodledata directory definitely ok? Is everything else (e.g., file upload, creating folders) working ok?
In reply to Howard Miller

Re: TeX troubles

by sean pearson -
Thanks. Running the convert command by hand, it seems the problem was that the gs package wasn't installed. After installing it everything works fine.
In reply to sean pearson

Re: TeX troubles

by Adam Weyhaupt -
(Sorry to post in such an old thread, but this seemed like a very similar problem).

I'm having a similar problem, but I'm not sure what you mean by the "gs" package.

I have a working Moodle 1.9.4 installation with the latest patches on Mac OS X 10.4.11. I think that Mimetex is working, since SOME TeX code is rendered correctly. I'd like to use the full TeX distribution. When I use texdebug.php and show the full command execution output (to render, say, \mathbb{H}), I get: the output shown below.

If I run the convert command in a terminal window as the webserver user (www) the command successfully executes with no error and generates a nice looking .gif file. I'm unsure how to proceed from here. Why is the convert command failing in texdebug.php but seems to work fine if run by hand? I'm not very clear about what permissions to check, but the rest of the site seems to be working fine.

I've included the command output below.

Thanks!

Adam

----

latex executable (/usr/local/teTeX/bin/i386-apple-darwin-current/latex) is readable
dvips executable (/usr/local/teTeX/bin/i386-apple-darwin-current/dvips) is readable
convert executable (/usr/local/bin/convert) is readable
base filename for expression is '64e0e6087259e61c78260d102ab9406f'

Processing TeX expression:

\mathbb{H}
$ /usr/local/teTeX/bin/i386-apple-darwin-current/latex --interaction=nonstopmode /Library/WebServer/moodledata/temp/latex/64e0e6087259e61c78260d102ab9406f.tex
OUTPUT: This is pdfeTeX, Version 3.141592-1.30.4-2.2 (Web2C 7.5.5)
entering extended mode
(/Library/WebServer/moodledata/temp/latex/64e0e6087259e61c78260d102ab9406f.tex
LaTeX2e <2005/12/01>
Babel and hyphenation patterns for american, french, german, ngerman, d
utch, italian, norsk, portuges, spanish, swedish, nohyphenation, loaded.
(/usr/local/teTeX/share/texmf.local/tex/latex/base/article.cls
Document Class: article 2005/09/16 v1.4f Standard LaTeX document class
(/usr/local/teTeX/share/texmf.local/tex/latex/base/size12.clo))
(/usr/local/teTeX/share/texmf.local/tex/latex/base/inputenc.sty
(/usr/local/teTeX/share/texmf.local/tex/latex/base/latin1.def))
(/usr/local/teTeX/share/texmf.tetex/tex/latex/amsmath/amsmath.sty
For additional information on amsmath, use the `?' option.
(/usr/local/teTeX/share/texmf.tetex/tex/latex/amsmath/amstext.sty
(/usr/local/teTeX/share/texmf.tetex/tex/latex/amsmath/amsgen.sty))
(/usr/local/teTeX/share/texmf.tetex/tex/latex/amsmath/amsbsy.sty)
(/usr/local/teTeX/share/texmf.tetex/tex/latex/amsmath/amsopn.sty))
(/usr/local/teTeX/share/texmf.tetex/tex/latex/amsfonts/amsfonts.sty)
(/usr/local/teTeX/share/texmf.tetex/tex/latex/amsfonts/amssymb.sty)
(/usr/local/teTeX/share/texmf.local/tex/latex/base/latexsym.sty)
(./64e0e6087259e61c78260d102ab9406f.aux)
(/usr/local/teTeX/share/texmf.tetex/tex/latex/amsfonts/umsa.fd)
(/usr/local/teTeX/share/texmf.tetex/tex/latex/amsfonts/umsb.fd)
(/usr/local/teTeX/share/texmf.local/tex/latex/base/ulasy.fd) [1]
(./64e0e6087259e61c78260d102ab9406f.aux) )
Output written on 64e0e6087259e61c78260d102ab9406f.dvi (1 page, 204 bytes).
Transcript written on 64e0e6087259e61c78260d102ab9406f.log.
RETURN CODE: 0
$ /usr/local/teTeX/bin/i386-apple-darwin-current/dvips -E /Library/WebServer/moodledata/temp/latex/64e0e6087259e61c78260d102ab9406f.dvi -o /Library/WebServer/moodledata/temp/latex/64e0e6087259e61c78260d102ab9406f.ps
OUTPUT:
RETURN CODE: 0
$ /usr/local/bin/convert -density 240 -trim /Library/WebServer/moodledata/temp/latex/64e0e6087259e61c78260d102ab9406f.ps /Library/WebServer/moodledata/temp/latex/64e0e6087259e61c78260d102ab9406f.gif
OUTPUT:
RETURN CODE: 1

In reply to Adam Weyhaupt

Re: TeX troubles

by Mauno Korpelainen -

gs is GhostScript - you need to have either ImageMagick or GhostScript installed to be able to use PostScript files (ps)

Return code 1 can for example mean that the last conversion is not made (executable file is not executable or your GhostScript or ImageMagick does not work as it should) http://docs.moodle.org/en/TeX_filter#Path_of_convert_binary

Your server has teTeX so you would probably not need Mimetex at all but when you said "SOME TeX code is rendered correctly" can you give some example... just to check if it is mimetex or teTeX that renders your TeX...

Does \Heart or \heartsuit work? ( \Heart is mimetex heart \Heart or \heartsuit is teTeX heart $$\heartsuit$$ )

In reply to Mauno Korpelainen

Re: TeX troubles

by Adam Weyhaupt -
Mauno - Thanks so much for your reply.

The convert executable exists:

client153-167:/usr/local/bin adam$ ls -al convert
-rwxr-xr-x 1 root admin 34656 Apr 18 2006 convert

It is, I think, this command that texdebug.php is running. I can run that command in the terminal and the conversion from ps to gif works just fine.

Yes, the server has teTeX. If, in a forum, I type both dollar dollar \Heart dollar dollar then I see a heart. On the other hand, dollar dollar \heartsuit dollar dollar that does not give a graphic. I see only [\heartsuit?]

On the other hand, on the texdebug.php page, if I type \Heart, then I get no graphic when the "render using mimetex" is selected. (Only the word "Heart" written in a slightly bold font.) If I type \heartsuit then I get an error when using TeX/Ghostscript:

The image “http://client153-167.sl.siue.edu/moodle/filter/tex/texdebug.php?tex=%5Cheartsuit&action=ShowImageTex” cannot be displayed, because it contains errors.

The command stack for \Heart shows that TeX can't compile it, but it compiles for \heartsuit and convert still fails.

Does this help?

Thanks,

Adam
In reply to Adam Weyhaupt

Re: TeX troubles

by Mauno Korpelainen -

I don't know - this could be some "Mac issue"... I hope somebody using Mac OS and teTeX reads this post and has seen a similar situation.

If you see a heart in a forum using \Heart it means that Tex filter is enabled but does not use teTeX - it uses Mimetex as a second option - and your convert script (GhostScript or ImageMagick) may not work correctly through tex filter although it works in terminal.

Have you tried to change the path for convert in Administration > Modules > Filters > TeX Notation if you have both ImageMagick and GhostScript installed or several versions of these scripts in different folders? (My paths in Debian Lenny are of course different)

Attachment tex.gif
In reply to Mauno Korpelainen

Re: TeX troubles

by Adam Weyhaupt -
Well, I'm more puzzled than ever. Here's what else I've tried to do to tease out a solution:

1) I installed Imagemagick, which installed convert to /opt/local/bin. I changed the path using the screen you referenced above, but I still get the same answer (return code of 1 is shown on texdebug.php when convert is run). Still no output from the convert command.

2) I moved this convert file to the same directory as latex and dvips, checked that the permissions were all the same, as well as owner and group, and still have the same problem.

3) I changed the "convert" command that texdebug.php runs to include the -verbose option. I did this hoping that convert would not fail silently. I still get no output shown on texdebug.php.

When I copy and paste the command that texdebug SAYS it is running and execute that command in the terminal, everything works fine (.gif is generated, and when subsequently running texdebug the image WILL show (although convert still fails, the image is now present).

I'm terribly puzzled why the command works in terminal but not in texdebug. Is there a way to tell WHY I'm getting the return code 1? It seems like the php file is just not able to use the exec command to run/find convert.

I appreciate your help so far. Any other thoughts on what I can try?

Thanks,

Adam
In reply to Adam Weyhaupt

Re: TeX troubles

by Adam Weyhaupt -
Here's another data point:

If I modify texdebug.php to have it simply execute "convert" (no arguments) I see in the output the list of options for conver and a return code of 0. When I have it execute "convert -verbose dog.ps dog.gif" I get no output in texdebug.php, even though this works fine in the terminal.

I can also have texdebug.php do an "ls" on the directory and these files ARE present.

Adam
In reply to Adam Weyhaupt

Re: TeX troubles

by Nicola Vitacolonna -
Most probably, the 'gs' executable cannot be found by convert. Now, since you can run convert from the command-line, you must have it installed in a non-standard location (such as /opt/local/bin), which you have set, most probably, in your .profile. Then, the problem is that the PATH environment variable is not correctly set when the command is run within Moodle. You may verify that by temporarily removing or renaming your .profile (or equivalent file) from your home directory and executing the convert command from the Terminal. That will show you the error you're trying to discover.

I propose two solutions:

1) create a symlink to /opt/local/bin/gs (or wherever gs is located) into /usr/bin:

sudo ln -s /opt/local/bin/gs /usr/bin

(you need admin privileges for this, and updating Mac OS X may result in this symlink to disappear);

2) or, go to Site Administration -> Modules -> Filters -> TeX notation and change the path to convert binary to "source /Users/yourusername/.profile; /opt/local/bin/convert" (without quotes). This will result in a red cross next to this command, but it will actually work.

Hope this helps,
Nicola

In reply to Nicola Vitacolonna

Re: TeX troubles

by Adam Weyhaupt -
Nicola and others -

Sorry that I didn't reply earlier --- I just saw this post. Your diagnosis and solution was exactly correct. My gs was in /usr/local/bin, but PHP didn't have that in its path, and so convert couldn't find it. I made the symlink to /usr/bin (which was in the path of PHP) and it's works great.

To aid those googling this problem: this occured in both Mac OS X 10.4 and Mac OS X 10.5 using PHP 5.

Thanks again,

Adam

In reply to Nicola Vitacolonna

Re: TeX troubles

by Jim Peterson -
I had a problem that seemed very similar and made the sym link. Now instead of all my latex going to the debug page it all, no matter what I put in looks like two parallel lines. See the graphic below for an example. I tried making the directory where all my latex stuff resides in the path of the php user, but that has not worked and I am not sure I did it right either. Is there a specific program that I need to make a symlink to to make the latex appear correctly?
20091203-adt2qsjt7hhrg12m8tajkc3r5.png
In reply to Adam Weyhaupt

Re: TeX troubles

by E R -
I am sorry to post on a old thread but it seems like I have the same problem. Latex is not rendering the images but showing a link to the debug page.

Here is the command execution mode output:

Checking executables

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 'a056208934d8a2c0b6e7b0d05fb60a97'

Processing TeX expression:

\beta=\bar{x}
$ /usr/bin/latex --interaction=nonstopmode /www/moodledata/temp/latex/a056208934d8a2c0b6e7b0d05fb60a97.tex
OUTPUT: This is pdfTeXk, Version 3.141592-1.40.3 (Web2C 7.5.6)
 %&-line parsing enabled.
entering extended mode
(/www/moodledata/temp/latex/a056208934d8a2c0b6e7b0d05fb60a97.tex
LaTeX2e <2005/12/01>
Babel  and hyphenation patterns for english, usenglishmax, dumylang, noh
yphenation, loaded.
(/usr/share/texmf-texlive/tex/latex/base/article.cls
Document Class: article 2005/09/16 v1.4f Standard LaTeX document class
(/usr/share/texmf-texlive/tex/latex/base/size12.clo))
(/usr/share/texmf-texlive/tex/latex/base/inputenc.sty
(/usr/share/texmf-texlive/tex/latex/base/latin1.def))
(/usr/share/texmf-texlive/tex/latex/amsmath/amsmath.sty
For additional information on amsmath, use the `?' option.
(/usr/share/texmf-texlive/tex/latex/amsmath/amstext.sty
(/usr/share/texmf-texlive/tex/latex/amsmath/amsgen.sty))
(/usr/share/texmf-texlive/tex/latex/amsmath/amsbsy.sty)
(/usr/share/texmf-texlive/tex/latex/amsmath/amsopn.sty))
(/usr/share/texmf-texlive/tex/latex/amsfonts/amsfonts.sty)
(/usr/share/texmf-texlive/tex/latex/amsfonts/amssymb.sty)
(/usr/share/texmf-texlive/tex/latex/base/latexsym.sty)
No file a056208934d8a2c0b6e7b0d05fb60a97.aux.
(/usr/share/texmf-texlive/tex/latex/amsfonts/umsa.fd)
(/usr/share/texmf-texlive/tex/latex/amsfonts/umsb.fd)
(/usr/share/texmf-texlive/tex/latex/base/ulasy.fd) [1]
(./a056208934d8a2c0b6e7b0d05fb60a97.aux) )
Output written on a056208934d8a2c0b6e7b0d05fb60a97.dvi (1 page, 268 bytes).
Transcript written on a056208934d8a2c0b6e7b0d05fb60a97.log.
RETURN CODE: 0
$ /usr/bin/dvips -E /www/moodledata/temp/latex/a056208934d8a2c0b6e7b0d05fb60a97.dvi -o /www/moodledata/temp/latex/a056208934d8a2c0b6e7b0d05fb60a97.ps
OUTPUT:
RETURN CODE: 0
$ /usr/bin/convert -density 240 -trim /www/moodledata/temp/latex/a056208934d8a2c0b6e7b0d05fb60a97.ps /www/moodledata/temp/latex/a056208934d8a2c0b6e7b0d05fb60a97.png
OUTPUT:
RETURN CODE: 0
I am running on php 5.2x and webserver is nginx.
In reply to E R

Re: TeX troubles

by E R -
Strangely, after I post this message, everything seems to be working smile