Forum archive 2000-2006

Gavin LaRose - images in hardcopy

Gavin LaRose - images in hardcopy

by Arnold Pizer -
Number of replies: 0
inactiveTopicimages in hardcopy topic started 9/13/2006; 11:18:27 AM
last post 9/14/2006; 1:31:17 PM
userGavin LaRose - images in hardcopy  blueArrow
9/13/2006; 11:18:27 AM (reads: 233, responses: 5)
Hi all,

I'm having trouble getting images to include properly in hardcopies. I'm using WeBWorK 2.x out of HEAD, last updated probably a week or so ago. The following code

  ...
BEGIN_TEXT
An image: \{ image('testgr.gif') \}
...
END_TEXT

where the figure "testgr.gif" is in the same directory as the problem.pg file, displays fine on-line, but fails when trying to generate a hardcopy. It returns no error messages, but includes the text

  \{ \par  {\bf    image( 'testgr.gif' )  } \par \}

in the TeX output (rather than including the image, which was my intent). This, of course, isn't quite what I intended. Am I doing something obviously wrong here? I would swear that an identical problem worked fine last semester.

Thanks,
Gavin

<| Post or View Comments |>


userMichael Gage - Re: images in hardcopy  blueArrow
9/13/2006; 11:39:59 AM (reads: 281, responses: 0)
Gavin,

Try downloading a copy of the TeX version of the hardcopy (as opposed to PDF) and troubleshoot it using your TeX editor. (You'll need to grab a copy of the .gif image as well.)

Some pdflatex translators might not handle the .gif image (as opposed to .png image) but this should be come clear if you try to process the TeX output of the webwork set by hand.

-- Mike

<| Post or View Comments |>


userGavin LaRose - Re: images in hardcopy  blueArrow
9/13/2006; 11:49:26 AM (reads: 273, responses: 0)
Hi Mike,

Thanks. The TeX output includes, verbatim, the code I reproduced above. It appears (to me, for whatever that's worth) that the image() macro isn't being correctly translated into some sort of \includegraphics TeX command in the TeX output. It does, however, appear to deal fine with an included image using insertGraph. That is, something like

  $gr = init_graph(...)
...
BEGIN_TEXT
\{ image( insertGraph($gr), 'tex_size'=>450 ) \}
END_TEXT
works fine. Replacing $gr with a static graph, however, results in the TeX page not including any reference to an image.

Interestingly, with the static image, if I put the image() call outside of the BEGIN_TEXT/END_TEXT structure, the hardcopy generator fails with an error about not being able to generate a png file. I don't know if this is related or not to the other error, but in any event we were using the same problem last semester and didn't see any errors of this type.

Thanks,
Gavin

<| Post or View Comments |>


userMichael Gage - Re: images in hardcopy  blueArrow
9/13/2006; 9:35:24 PM (reads: 268, responses: 0)
Hi Gavin,

I'm not 100% positive but I think these errors are related. (And the error message isn't getting through.) Also this comment Further, pdflatex cannot incorporate GIF files in a generated PDF, so any graphics must be available in PNG format.

from http://httpd.apache.org/docs-project/docsformat.html squares with my memory that pdflatex will not handle .gif files and therefore we first create a .png file and pass its address into the TeX version.

I'm not sure what happens if the .png file can't be created.

Caveat -- I'm doing this from memory -- I don't have the code in front of me right at the moment, so I could be way off base.

You might look at the TeX code of a problem that works, if you haven't already, that might give you a clue. I also suspect that a static .png file would work.

The code is somewhere in dangerousMacros.pl -- probably in the alias subroutine.

Hope this helps.

Take care,

Mike

<| Post or View Comments |>


userDavide P. Cervone - Re: images in hardcopy  blueArrow
9/13/2006; 10:15:26 PM (reads: 257, responses: 0)
The reason you are getting the image command within your TeX file is because when a command is executed inside \{ and \} in BEGIN_TEXT/END_TEXT (or EV3 in general), and an error occurs, a warning is generated and the command is shown in bold at the location of the \{...\} in the text. So this suggests the image() command is failing. The warning message may not be being processed in the hardcopy output (or it may be at the very bottom of the page where you might not have noticed it). It may also be in the server log, so you might look there for it if it isn't showing up on the web page itself.

The problem is probably in generating the .png file as Mike suggests, as the image() call (defined in PGbasicmacros.pl) calls alias() which is where the conversion will take place. Check the write permissions on the tmp directories (and make sure the main tmp directory is writable, since it may need to create a png directory there). Also check that your file conversion commands are properly configured in global.conf (in particular the externalGif2PngPath variable). If you can find the warning message, that should help.

Good luck.

Davide

<| Post or View Comments |>


userGavin LaRose - Re: images in hardcopy  blueArrow
9/14/2006; 1:31:17 PM (reads: 252, responses: 0)
Hi Davide,

Ah-ha: this was the piece that was confusing me:

The reason you are getting the image command within your TeX file is because when a command is executed inside \{ and \} in BEGIN_TEXT/END_TEXT (or EV3 in general), and an error occurs, a warning is generated and the command is shown in bold at the location of the \{...\} in the text.

It appears that the problem is that we moved to a new server (RedHat Enterprise something or other), with a peculiarly buggy netpbm. On the image I'm using here, the RedHat giftopnm fails (dumps core); the version we had on the previous server (a Solaris box) has no trouble with it. I guess I'm off to follow up with my systems guys.

Thanks for the help,
Gavin

<| Post or View Comments |>