Difference between revisions of "Troubleshooting Equation Images"
(6 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
== General troubleshooting == |
== General troubleshooting == |
||
− | Try setting <code>$WeBWorK::PG::ImageGenerator::PreserveTempFiles</code> to <code>1</code> (in <code>webwork2/lib/WeBWorK/Constants.pm</code>). |
+ | Try setting <code>$WeBWorK::PG::ImageGenerator::PreserveTempFiles</code> to <code>1</code> (in <code>webwork2/lib/WeBWorK/Constants.pm</code>). |
+ | (Note that there is a similar setting for hardcopy: <code>$WeBWorK::ContentGenerator::Hardcopy::PreserveTempFiles = 0;</code>. Don't confuse the two. ) |
||
+ | |||
+ | After that, you should see directories like <code>ImageGenerator.xxxxxx</code> accumulating in <code>webwork2/tmp/</code>. These contain files that ImageGenerator uses in generating each equation image: |
||
* <code>equation.tex</code> - TeX source file |
* <code>equation.tex</code> - TeX source file |
||
Line 16: | Line 16: | ||
If <code>equation.dvi</code> does not exist, then LaTeX was not able to interpret its input successfully. Read <code>equation.log</code>, <code>latex.out</code>, and <code>latex.err</code> for errors. |
If <code>equation.dvi</code> does not exist, then LaTeX was not able to interpret its input successfully. Read <code>equation.log</code>, <code>latex.out</code>, and <code>latex.err</code> for errors. |
||
+ | |||
+ | One common cause of errors is that the <code>preview.sty</code> file is not installed. <code>preview.sty</code> can be found as part of preview-latex in [http://www.ctan.org/tex-archive/macros/latex/contrib/preview/ CTAN] and many operating systems include a package for it. |
||
Open <code>equation.dvi</code> in a DVI viewer and see if it contains a properly rendered equation. |
Open <code>equation.dvi</code> in a DVI viewer and see if it contains a properly rendered equation. |
||
− | Check <code>dvipng.out</code> and <code>dvipng.err</code> for errors. One common cause of dvipng errors is that the <code>preview.sty</code> file is not installed. <code>preview.sty</code> can be found as part of preview-latex in [http://www.ctan.org/tex-archive/macros/latex/contrib/preview/ CTAN] and many operating systems include a package for it. |
||
+ | Check <code>dvipng.out</code> and <code>dvipng.err</code> for errors. |
||
The PNG file that <code>dvipng</code> produces is moved from the <code>ImageGenerator.xxxxxx</code> 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 <code>e40d5b21c65856b95bbc6f4dfced571.png</code>. (That's the SHA-1 hash of the TeX equation followed by <code>1.png</code>.) Make sure that file exists in <code>webwork2/htdocs/tmp/equations/</code>. Check its permissions. Make sure it is web-accessible (check <code>http://yourserver/webwork2_files/tmp/equations/filename.png</code>). See if it's a valid PNG, and see if it contains the proper equation image. |
The PNG file that <code>dvipng</code> produces is moved from the <code>ImageGenerator.xxxxxx</code> 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 <code>e40d5b21c65856b95bbc6f4dfced571.png</code>. (That's the SHA-1 hash of the TeX equation followed by <code>1.png</code>.) Make sure that file exists in <code>webwork2/htdocs/tmp/equations/</code>. Check its permissions. Make sure it is web-accessible (check <code>http://yourserver/webwork2_files/tmp/equations/filename.png</code>). See if it's a valid PNG, and see if it contains the proper equation image. |
||
Line 29: | Line 31: | ||
[In ImageGenerator.pm I] had [to] use the command |
[In ImageGenerator.pm I] had [to] use the command |
||
− | my $dvipngCommand = "cd $wd && $dvipng " . $DvipngArgs . " equation.dvi |
+ | 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 |
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 |
dvipng requires this. There certainly can't be any harm in this, correct? The |
||
newer versions of dvipng must accept this, correct? |
newer versions of dvipng must accept this, correct? |
||
+ | |||
+ | == RedHat issues: fmtutil: format directory `/.texmf-var/web2c' does not exist. == |
||
+ | |||
+ | This can happen if you run texconfig as root -- it seems to reset TeX's home directory to root. Use texconfig-sys instead. |
||
+ | |||
+ | See https://wiki.archlinux.org/index.php/TeX_Live_FAQ#Q:_I_want_to_have_some_configuration_app.21 for details. |
||
+ | |||
+ | You may find this error in latex.err in ImageGenerator generated directory (ImageGenerator.XXXXXXX) when PreserveTempFiles is enabled. Run texconfig-sys as root, change something, and save. It should solve the problem. |
||
[[Category:Troubleshooting]] |
[[Category:Troubleshooting]] |
Latest revision as of 17:58, 14 May 2011
General troubleshooting
Try setting $WeBWorK::PG::ImageGenerator::PreserveTempFiles
to 1
(in webwork2/lib/WeBWorK/Constants.pm
).
(Note that there is a similar setting for hardcopy: $WeBWorK::ContentGenerator::Hardcopy::PreserveTempFiles = 0;
. Don't confuse the two. )
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 fileequation.log
- log file written by LaTeXequation.dvi
- DVI file generated by LaTeXlatex.out
,latex.err
- messages written to STDOUT and STDERR by LaTeXdvipng.out
,dvipng.err
- messages written to STDOUT and STDERR by dvipng
If latex.out
and latex.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 installed latex
and make sure that the path to latex
in global.conf
is correct.
Check equation.log
, latex.out
, and latex.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 in Constants.pm
.
If equation.dvi
does not exist, then LaTeX was not able to interpret its input successfully. Read equation.log
, latex.out
, and latex.err
for errors.
One common cause of errors is that the preview.sty
file is not installed. preview.sty
can be found as part of preview-latex in CTAN and many operating systems include a package for it.
Open equation.dvi
in a DVI viewer and see if it contains a properly rendered equation.
Check dvipng.out
and dvipng.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 SHA-1 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 web-accessible (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?
RedHat issues: fmtutil: format directory `/.texmf-var/web2c' does not exist.
This can happen if you run texconfig as root -- it seems to reset TeX's home directory to root. Use texconfig-sys instead.
See https://wiki.archlinux.org/index.php/TeX_Live_FAQ#Q:_I_want_to_have_some_configuration_app.21 for details.
You may find this error in latex.err in ImageGenerator generated directory (ImageGenerator.XXXXXXX) when PreserveTempFiles is enabled. Run texconfig-sys as root, change something, and save. It should solve the problem.