Troubleshooting Equation Images
Try setting $WeBWorK::PG::ImageGenerator::PreserveTempFiles
to 1
(in webwork2/lib/WeBWorK/Constants.pm
). After that, you should see directories like ImageGenerator.xxxxxx
accumulating in webwork2/tmp/
. These contain files that ImageGenerator uses in generating each equation image:

equation.tex
 TeX source file 
equation.log
 log file written by LaTeX 
equation.dvi
 DVI file generated by LaTeX 
latex.out
,latex.err
 messages written to STDOUT and STDERR by LaTeX 
dvipng.out
,dvipng.err
 messages written to STDOUT and STDERR by dvipng
 If
latex.out
andlatex.err
don't exist, this indicates that LaTeX was never invoked. I'm not sure what would cause this.  If
equation.log
doesn't exist, then LaTeX was invoked, but probably never ran. Check for a properly installedlatex
and make sure that the path tolatex
inglobal.conf
is correct.  Check
equation.log
,latex.out
, andlatex.err
for errors. These might indicate problems in the TeX code being sent to LaTeX for processing. The errors might be in the equation itself in the PG file, or in the TexPreamble or TexPostamble, which are defined inConstants.pm
.  if
equation.dvi
does not exist, then LaTeX was not able to interpret its input successfully. Readequation.log
,latex.out
, andlatex.err
for errors.  Open
equation.dvi
in a DVI viewer and see if it contains a properly rendered equation.  Check
dvipng.out
anddvipng.err
for errors.
The PNG file that dvipng
produces is moved from the ImageGenerator.xxxxxx
directory and renamed, so you'll have to look at the HTML source of the problem page to find its name. It'll be something like e40d5b21c65856b95bbc6f4dfced571.png
. (That's the SHA1 hash of the TeX equation followed by 1.png
.) Make sure that file exists in webwork2/htdocs/tmp/equations/
. Check its permissions. Make sure it is webaccessible (check http://yourserver/webwork2_files/tmp/equations/filename.png
). See if it's a valid PNG, and see if it contains the proper equation image.
Inappropriate ioctl for device
This seems to occur when very old versions of dvipng
are in use, and the easiest way to resolve it is to upgrade to the latest version. If that is not possible, try the following:
[In ImageGenerator.pm I] had [to] use the command my $dvipngCommand = "cd $wd && $dvipng " . $DvipngArgs . " equation.dvi > dvipng.out 2> dvipng.err"; i.e. pass it equation.dvi rather than equation. Probably my old version of dvipng requires this. There certainly can't be any harm in this, correct? The newer versions of dvipng must accept this, correct?