PREP 2013 Question Authoring - Archived

pspicture (LaTeX packages)

pspicture (LaTeX packages)

by Joan Hart -
Number of replies: 3
Is there a way to load the LaTeX package pstricks (or other LaTeX packages)
in order to embed a pspicture graph in our problem?
In reply to Joan Hart

Re: pspicture (LaTeX packages)

by Paul Pearson -
Hi Joan,

If the graphic you are trying to include is a static graphic (i.e., not dynamically generated), then at present the best way to include it into a webwork question is to take a screen shot of the graphic, save it as a .png file, and include it using the technique found at

http://webwork.maa.org/wiki/StaticImages

It is also possible to have several static graphics and choose one at random.

Requests for the ability to use PStricks and TikZ / PGF directly in WeBWorK using LaTeX source code are frequently made. One reason this has not been done is that WeBWorK delivers content in primarily two modes (HTML for online use and TeX for the offline pdf hardcopy use) and PStricks and TikZ work well for generating pdf output but not for generating html usable output. I have looked at conversion from pdf to png in the past and have been dissatisfied with the quality of the results (text conversion has been particularly bad).

Best regards,

Paul Pearson
In reply to Paul Pearson

Re: pspicture (LaTeX packages)

by Joan Hart -
Is there a good way to compress a png file for use in a WeBWorK problem?
The png file I created from a pdf looks to be almost twice the size
of the pdf file from which "Preview" took a screen shot for me.
The graph expands nicely when I view it in WeBWorK,
but would a compressed version of it still work?
(For example, snapfish.com compresses photos to upload to its website.)

I ask because last fall some students complained that the graphs
were not loading in some problems I assigned. Another student
recommended not using wireless to access WeBWorK, and that
solved the problem. But if it's possible to load graphs that
use fewer KBs, I'd like to do that.

Thanks for all your help!
Joan
In reply to Joan Hart

Re: pspicture (LaTeX packages)

by Davide Cervone -
How big is the file? Can you attach it here? It is hard to tell what the situation is without seeing the file.

Remember that the PDF is font-based while the png is pixel based, so it may well be larger. Preview usually does a good job of creating small files, but if it has added an icon resource, that can make the file much larger (on the order of 100KB at times), so it might pay to remove that if it has one. I can tell you if you I can see the file.

Davide