Forum archive 2000-2006

Jeff Denny - pdf generation problem and image problem

Jeff Denny - pdf generation problem and image problem

by Arnold Pizer -
Number of replies: 0
inactiveTopicpdf generation problem and image problem topic started 8/18/2005; 11:16:36 AM
last post 9/7/2005; 9:17:54 PM
userJeff Denny - pdf generation problem and image problem  blueArrow
8/18/2005; 11:16:36 AM (reads: 2699, responses: 35)
Although I had no troubles before classes started, my students and I cannot now generate pdf files for some sets. Also, my students and colleagues are often seeing dots in the places of the images when using the images setting for equations. I've yet to see this problem on any machine that I've tried, but I'm hearing lots of reports. Any ideas on these problems would be greatly appreciated.

Below is the error message that we get when generating pdf files. ----------------


The error is:

WeBWorK has encountered a software error while attempting to process this problem. It is likely that there is an error in the problem itself. If you are a student, report this error message to your professor to have it corrected. If you are a professor, please consult the error output below for more information. Error messages

Failed to generate PDF from tex Error details

Call to /usr/bin/pdflatex --shell-escape failed: Inappropriate ioctl for device Some pdf output was produced and is available here. pdflatex ran, but did not succeed. This suggests an error in the TeX version of one of the problems, or a problem with the pdflatex system.

<| Post or View Comments |>


userJohn Jones - Re: pdf generation problem and image problem  blueArrow
8/18/2005; 12:20:05 PM (reads: 2773, responses: 0)
Hi,

My first guess is that someone accidentally changed permissions on webwork2/tmp, so I would check that.

Next, you could look in the apache error log for clues.

Next, I would set $WeBWorK::ContentGenerator::Hardcopy::PreserveTempFiles =1; in Constants.pm, restart the web server, and then trigger the error. Then you should be able to look at the latex file, run pdflatex on it yourself to see if that reveals anything.

John

<| Post or View Comments |>


userMichael Gage - Re: pdf generation problem and image problem  blueArrow
8/18/2005; 4:04:01 PM (reads: 2747, responses: 0)
It turns out that this was an error in the TeX code generated by problem set 0. (Clicking on the link to the partially generated pdfile gives you some idea of what TeX errors might have occured.) The extensive TeX error messages below the passage that Jeff quotes also gives clues as to what might have gone wrong.

In this case a problem 8 added to set 0 was a screenHeader.pg file which is only suitable for display on the screen. It gives TeX fits, mainly because it contains equations that are not enclosed by ( ) (begin math and end math) symbols.

<| Post or View Comments |>


userHal Sadofsky - Re: pdf generation problem and image problem  blueArrow
8/18/2005; 4:12:10 PM (reads: 2751, responses: 0)
I'm having this sort of problem too. But a little different. Here is the error message I get (it's not big on detail).

------------------------


WeBWorK Error

WeBWorK has encountered a software error while attempting to process this problem. It is likely that there is an error in the problem itself. If you are a student, report this error message to your professor to have it corrected. If you are a professor, please consult the error output below for more information.

Error messages

Failed to generate PDF from tex

Error details

Failed to create /usr/local/webwork/tmp/webwork-hardcopy.1pbqkjJv/dance.999999999.Homework1.pdf for no apparent reason.

--------------------


So I checked permissions on /usr/local/webwork/tmp.

In fact, I set them to 777 and tried again. That didn't help. (They were already at 775, and the director is in the same group as apache, so that should have been OK anyhow).

The Apache log reveals nothing.

I tried changing the PreserveTempFiles variable (and restarting Apache) as John suggests. No files seem to be being created at all in /usr/local/webwork/tmp, which I don't understand!

Hal

<| Post or View Comments |>


userMichael Gage - Re: pdf generation problem and image problem  blueArrow
8/18/2005; 9:04:25 PM (reads: 2814, responses: 0)
Setting the PreserveTempFiles =1 in WeBWorK/Constants.pm is the right first step.

What I would expect to see then is various files created inside

/usr/local/webwork/tmp/webwork-hardcopy.1pbqkjJv/

The actual temporary directory used to work with TeX is defined at

# Contains non-web-accessible temporary files, such as TeX working directories. $webworkDirs{tmp} = "$webworkDirs{root}/tmp";

which is in your global.conf file, but the address in the error message looks like the default.

One thing to make sure of is that the webserver can actually get to that directory. This means that it needs execute permission on all of the directories above tmp and it needs write permission on tmp itself (which apparently it already had).

If the temporary files are being preserved then you should see something like

bash-2.05b$ ls webwork-hardcopy.UK7Fq4Od/
hardcopy.aux hardcopy.log hardcopy.tex

However, reading through the code in Hardcopy.pm I also see a bug in the error message. at about line 610 there is a message:

"Failed to create $finalFile for no apparent reason.\n"
which should read
"Failed to create $hardcopyFilePath for no apparent reason.\n"
so the error message is actually giving an incorrect path.

I suspect that the place where the permission problem is occuring may be in the destination file for delivering the hardcopy file. This should be the directory:

.../myCourse/html/tmp/hardcopy/

and the file name will be something like Homework1.pdf (the dance.999999. bit in the file name above looks a bit fishy to me, but it might be ok).

Hope this helps.

-- Mike

<| Post or View Comments |>


userHal Sadofsky - Re: pdf generation problem and image problem  blueArrow
8/18/2005; 9:40:55 PM (reads: 2796, responses: 0)
Thank you Mike. That was very helpful. Now I see the .tex file is where it is supposed to be, but not the .log or .aux.

So checking global.conf for the 38th time, I now notice that I've specified the latex command where I was supposed to have specified the pdflatex command.

<| Post or View Comments |>


userJeff Denny - Re: pdf generation problem and image problem  blueArrow
8/24/2005; 2:42:22 PM (reads: 2664, responses: 0)
We have identified the pdf generation problem. We created our usernames using the university's e-mail addresses for the students by taking their e-mail userids as the webwork usernames. Unfortunately, our school uses names like "jeff.k.denny" When webwork tries to create a pdf, latex gets confused by the periods in the username when looks for the png extension. Then, webwork produces an error message.

The only thing I can come up with is to change the usernames to the students' university id numbers. Of course, the problem is that the username in webwork appears to be the one thing that can't be changed in the database for each user.

Does anyone have a suggestion?

Thanks!

<| Post or View Comments |>


userJeff Denny - Re: pdf generation problem and image problem  blueArrow
8/24/2005; 3:35:35 PM (reads: 2661, responses: 0)
Okay, on the image generation problem, I have a solution. Many students report that they cannot see the equations in image mode. It turns out the Internet Explorer does not display these png files well, while firefox, netscape, etc. do. So, the students can switch browsers or use jsmath.

<| Post or View Comments |>


userArnold K. Pizer - Re: pdf generation problem and image problem  blueArrow
8/24/2005; 4:01:15 PM (reads: 2659, responses: 1)
Hi Jeff,

MSIE has several problems, but we have never had a report of it not being able to view png images and obviously thousands of students are using it to view problems in images mode. Does your course allow practice users? If so, can you give the URL as I would like to check this out for myself.

Unfortunately TeX has a problem with periods in directory names. A hack might be to do the following. When a user_id is used as part of the name of a directory, first replace all periods by (say) underscores. This would have to be done both when the directory is created and when it is read. Does someone have a better idea?

Arnie

<| Post or View Comments |>


userAndras Balogh - Re: pdf generation problem and image problem  blueArrow
8/24/2005; 7:23:08 PM (reads: 2736, responses: 0)
I am working on my "Failed to generate PDF from tex" problem but with no image problem. I don't always get this message, it is definitely not a headder problem. It seems to me there might be a LaTeX/multicol bug here.

In the TeX log file I don't get any error message, not even warning. I am stripping down the TeX file, and got to the following short file that slipps through TeX without generating any dvi or pdf file.

\documentclass[10pt]{amsart}
\usepackage{multicol}
\begin{document}
The primary purpose of WeBWorK is to let you know that you are getting the correct answer or to alert
\begin{multicols}2
\columnwidth=linewidth
\end{multicols} % close off the columns from the set above
\end{document}

Interesting part: I tried this TeX file on three different tetex:
Did not get dvi/pdf with tetex-3.0-4 (fedora 4),
but got the right output with tetex-2.0.2-21.3 (fedora 3)
and also with tetex-1.0.7-57.1 (redhat 8)

Classes starts tomorrow. Any help would be appreciated.

Andras

<| Post or View Comments |>


userAndras Balogh - Re: pdf generation problem and image problem  blueArrow
8/24/2005; 7:50:23 PM (reads: 2699, responses: 0)
In my case the problem was that there were multiple copies of multicol.sty, one at
/usr/share/texmf/tex/latex/tools/multicol.sty
and another at
/usr/share/texmf/ptex/platex209/multicol.sty

whatever this platex is, renaming multicol.sty to multicol.sty_no in that directory solved the problem.

Andras

<| Post or View Comments |>


userJeff Denny - Re: pdf generation problem and image problem  blueArrow
8/24/2005; 9:08:23 PM (reads: 2722, responses: 0)
Arnie,

I am very interested in the hack you suggested. I think we can get it to work, but I need to know where I need to put the hack. Could you tell me which files to edit? Thank you!

Jeff

<| Post or View Comments |>


userArnold K. Pizer - Re: pdf generation problem and image problem  blueArrow
8/25/2005; 12:33:54 PM (reads: 2728, responses: 0)
Hi Jeff,

I see the problem with png's on your site but that's the only place I have seen it. Doing a Google search for "problem png MSIE" leads me to think that the problem may have to do with the transparency and number of colors in your png's.

What version of dvipng are you using?

Are you using the standard

$WeBWorK::PG::ImageGenerator::DvipngArgs = "-bgTransparent -D120 -q -depth";

in .../lib/WeBWorK/Constants.pm

Arnie

<| Post or View Comments |>


userJeff Denny - Re: pdf generation problem and image problem  blueArrow
8/25/2005; 1:23:58 PM (reads: 2642, responses: 0)
Arnie,

We are using dvipng version 1.6 and are using the standard values in Constants.pm.

Jeff

<| Post or View Comments |>


userJohn Jones - Re: pdf generation problem and image problem  blueArrow
8/25/2005; 1:46:24 PM (reads: 2722, responses: 1)
Hi,

In case there is still some question about pdf generation, the periods in user names (and the periods in filenames) should not be the problem with pdf generation. As Mike described above, when webwork 2 makes pdf files, it always uses a latex file named hardcopy.tex. It is put in its own temporary directory to avoid collisions if more than one pdf is being generated at once. That happens in one spot for the system, usually /opt/webwork2/tmp.

Once the pdf is created (and is now "hardcopy.pdf"), it is copied into /opt/webwork2/courses/MyCourseNameHere/html/hardcopy to have a filename which looks like MyCourseName.loginname.setname.pdf, and that file is sent to the student.

John

<| Post or View Comments |>


userArnold K. Pizer - Re: pdf generation problem and image problem  blueArrow
8/25/2005; 5:26:19 PM (reads: 2849, responses: 0)
Hi John,

I think there is a problem with periods in user names. I just created a user with user_id "new.user" and tried to download a hard copy of a set. I get the error:

! LaTeX Error: Unknown graphics extension: .user-1407-setDerivatives1prob14image1.png.

so I assume Latex "new.user" is part of the png file name and LaTeX is using everything after the first period as the extension.

As a further test, this set can be downloaded successfully by users without periods in their user_id name.

I'll report this as a bug.

Arnie

<| Post or View Comments |>


userJohn Jones - Re: pdf generation problem and image problem  blueArrow
8/26/2005; 12:25:18 AM (reads: 2616, responses: 0)
Ooops,

You're right. I forgot about the names made up for on-the-fly images. The cvs version of pg/cvs/PGgraphmacros.pl should fix that problem.

Up until just now, that file had not changed in 15 months, so it should be safe to drop it into a running system.

If anyone runs into other kinds of graphics which trigger an error on pdf generation, please post here.

John

<| Post or View Comments |>


userJeff Denny - Re: pdf generation problem and image problem  blueArrow
8/26/2005; 7:49:02 AM (reads: 2599, responses: 0)
John, This is great news! Thank you! I'll get our sys admin working on the install right away! (You just saved me tons of time today. I had another work-around in mind.)

Also, we are having problems with users (with any type of username) not being able to download pdfs when they check the box to include answers. Does anyone know how we can fix this problem?

Finally, we are using WW2 from the tarball that is dated in late June. Would updating from the CVS fix the problems we are seeing?

Thanks!

Jeff

<| Post or View Comments |>


userMichael Gage - Re: pdf generation problem and image problem  blueArrow
8/26/2005; 9:25:17 AM (reads: 2567, responses: 0)
There have been a lot of minor fixes in addition to a few major additions since the June tarball. The current CVS "HEAD" is fairly stable. It's what I am using on our machine for hosting other courses and on the machine serving courses at Rochester. To update to the most recent version of webwork use:

cvs update -A -d

The -A tells the update mechanism to take the latest versions of all files and the -d directive allows new directories to be constructed if needed.

I'd recommend updating to the latest CVS version. It may well fix many of the problems you are seeing, and it makes it much easier to fix and distribute patches for any remaining problems.

-- Mike

<| Post or View Comments |>


userJohn Jones - Re: pdf generation problem and image problem  blueArrow
8/26/2005; 10:02:44 AM (reads: 2597, responses: 1)
If you do a complete cvs update, you have to update both the pg part and the webwork2 parts. There have been several changes during the summer on the pg side which had related changes on the webwork2 side. You would also have to make a new global.conf from global.conf.dist. You can use your old global.conf as a guide, but there are new entries which must be present.

Finally, you may need to update the structure of the database for your courses. There is a script provided in the bin directory for doing this.

John

<| Post or View Comments |>


userBob Byerly - Re: pdf generation problem and image problem  blueArrow
8/26/2005; 11:37:53 AM (reads: 2665, responses: 0)
Hi John,

Could you or someone give more details on how to update the structure of the database?

Thanks,

Bob

<| Post or View Comments |>


userJohn Jones - Re: pdf generation problem and image problem  blueArrow
8/26/2005; 1:42:09 PM (reads: 2567, responses: 0)
It is only something I have run once per server. So, I don't know much about it. Maybe Gavin can comment.

It is bin/wwdb_addgw. It can handle sql and sql_single courses. For sql_single, I think it can figure out what courses you have. For the older sql, you have to tell it the course name. If you accidentally run it twice on a course, it is not a problem.

John

<| Post or View Comments |>


userDavide P. Cervone - Re: pdf generation problem and image problem  blueArrow
8/29/2005; 5:45:22 PM (reads: 2539, responses: 0)
We are using dvipng version 1.6 and are using the standard values in Constants.pm.

dvipng version 1.6 now produces images with alpha-channel transparency (new in this version). Unfortunately, MSIE does not handle alpha transparency without a lot of extra hoopla added into the image tag (I ran into this when writing the new image-font mode for jsMath). If you change -bgTransparent to -bgtransparent (i.e., remove the capitalization) in Constants.pm, then it will produce regular transparency rather than alpha-channel transparency, so it should work correctly with MSIE again. Don't forget to remove the old images, since they are cached by WW. (This process is documented elsewhere on this discussion board).

For those who don't know, alpha-level transparency would allow the images to smoothly blend into any background color. Without it, the antialiasing goes to a fixed color, so if you put the images on a different background, they won't look right.

Davide

<| Post or View Comments |>


userArnold K. Pizer - Re: pdf generation problem and image problem  blueArrow
8/29/2005; 6:06:19 PM (reads: 2534, responses: 0)
Thanks Davide,

We should probably modify Constants.pm to reflect this.

# Arguments to pass to dvipng. This is dependant on the version of dvipng. # # For dvipng < 1.0 # $WeBWorK::PG::ImageGenerator::DvipngArgs = "-x4000.5 -bgTransparent -Q6 -mode toshiba -D180"; # For dvipng >= 1.0 # $WeBWorK::PG::ImageGenerator::DvipngArgs = "-bgTransparent -D120 -q -depth"; #

Arnie

<| Post or View Comments |>


userJeff Denny - Re: pdf generation problem and image problem  blueArrow
8/29/2005; 7:02:40 PM (reads: 2515, responses: 0)
Thank you all for your help. I've made the Constants.pm change. We'll see how this runs as soon as I get mysql talking to webwork again. (See my latest post.)

<| Post or View Comments |>


userJeff Denny - Re: pdf generation problem and image problem  blueArrow
8/31/2005; 10:22:14 AM (reads: 2503, responses: 0)
Okay, my system is running again, and I changed to lower case t and deleted the equations directory. We had to do a hard reboot on the system, so the server should have restarted. However, I cannot see the images in IE and there are complaints about AOL.

Any thoughts?

<| Post or View Comments |>


userDavide P. Cervone - Re: pdf generation problem and image problem  blueArrow
8/31/2005; 12:28:51 PM (reads: 2508, responses: 0)
Jeff, are you using the default ur.css file? (Or have you customized it for your site?) In writing jsMath, I had some problems with images dissappering when they are inside a box that has no explicit position attribute (or it might have been FOLLOWING such a box -- I can't remember every bug I've run into in MSIE anymore). Entering "position: relative" in the style attribute of the enclosing (or preceding) tag fixed it. This seems like a long shot, though.

Are you SURE the change to lower-case t is in effect, and are you SURE you deleted the equation cache that is actually in use? (For example, if you moved the temporary folder somewhere else, you might have erased the equations from theior original position, but not the position where they are actually being used.)

Can you be more specific about the complaints for AOL? Are they also about images not being shown, or something else?

Davide

<| Post or View Comments |>


userJeff Denny - Re: pdf generation problem and image problem  blueArrow
8/31/2005; 2:48:20 PM (reads: 2477, responses: 0)
Davide,

I'm having my sys admin check on some of the details that you mentioned. We did do a hard reboot after I made the change in "t" and apache was restarted again by the sys admin afterward for another reason. So, I thik the right Constants.pm is in effect. I'll let my sys admin check the other details.

With AOL, I didn't get a full report from the students. They just indicated that they could not see the images, much as in IE.

Jeff

<| Post or View Comments |>


userMichael Gage - Re: pdf generation problem and image problem  blueArrow
8/31/2005; 4:57:26 PM (reads: 2490, responses: 0)
Jeff,

Once the sysadmin has some time, get him to look closely at the apache setup. You should not have to reboot the entire system in order to restart the apache server. I doubt that is causing your current problems, but it's a sign that something isn't set up quite right and who knows what side effects it has. In trouble shooting that original dvipng problem I'm pretty sure that the apache server was not actually restarted until we did the hardware reboot.

Good luck.

-- Mike

<| Post or View Comments |>


userJohn Jones - Re: pdf generation problem and image problem  blueArrow
8/31/2005; 5:04:20 PM (reads: 2495, responses: 0)
Hi Jeff,

Can you enable some guest logins for a course and point it to us? Looking at it through IE might help shed some light on it for us.

John

<| Post or View Comments |>


userJeff Denny - Re: pdf generation problem and image problem  blueArrow
8/31/2005; 8:58:57 PM (reads: 2487, responses: 1)
Okay, I've set up 3 guest accounts. Here is the link to a test course that I've been using for debugging.

http://mathww.mercer.edu/webwork2/jkdtest/

Thank you for your help!

Jeff

<| Post or View Comments |>


userJohn Jones - Re: pdf generation problem and image problem  blueArrow
9/1/2005; 12:06:54 PM (reads: 2469, responses: 1)
Thanks. I looked and I am pretty much stumped. Maybe you should try downgrading your copy of dvipng. We use version 1.0 and I haven't heard complaints.

John

<| Post or View Comments |>


userArnold K. Pizer - Re: pdf generation problem and image problem  blueArrow
9/1/2005; 12:55:32 PM (reads: 2560, responses: 0)
Version 1.5 seems to work fine also.

Arnie

<| Post or View Comments |>


userMichael Gage - Re: pdf generation problem and image problem  blueArrow
9/1/2005; 1:31:30 PM (reads: 2557, responses: 0)
using IE on the mac I can see all of the images of the equations, so it may be specific to the PC version of MSIE.

Can you view http://devel.webwork.rochester.edu:8002/webwork2/gage_course_single_sql/ (use login/password practice1/pracctice1) all right on a PC MSIE browser? We are using dvipng 1.5 on that site.

-- Mike

<| Post or View Comments |>


userDavide P. Cervone - Re: pdf generation problem and image problem  blueArrow
9/2/2005; 6:10:27 PM (reads: 2477, responses: 0)
I checked out your course, and some of the images are still being sent with alpha-channel transparency. For example, Problem 1 in set 2F05 has a "F(x)" that still has alpha transparency (it is image /webwork2_files/tmp/equations/c6/c71a777033e9626a9c44d20658adfd1.png).

It looks like common things such as F(x) and \tan^{-1}(x) have alpha transparency, while the problem-specific images do not. This suggests that you didn't (fully) clear the equation cache when you changed the dvipng settings. You probably need to use the remove_stale_images command as discussed in

http://webhost.math.rochester.edu/webworkdocs/discuss/msgReader$3530#3534

and

http://webhost.math.rochester.edu/webworkdocs/discuss/msgReader$2929#2933

to remove all the images. Otherwise old images that were generated before you changed the transparency will still cause MSIE trouble. The new (non-alpha images) appear to work fine for me, so I think the problem will be taken care of if you can clear the cache. (You might also want to clear the cache in your BROWSER after you have done this, just to be sure you are getting the latest copy from the server.)

Davide

<| Post or View Comments |>


userJeff Denny - Re: pdf generation problem and image problem  blueArrow