Show a static image.
Download file: StaticImages.pg
DOCUMENT();
loadMacros('PGstandard.pl', 'PGML.pl', 'PGcourse.pl');
Preamble
These standard macros need to be loaded.
BEGIN_PGML
[!graph of a decreasing exponential function!]{'image.png'}{400}{
image_options => { tex_size => 600 }
}
END_PGML
ENDDOCUMENT();
Statement
Use the PGML image syntax to include static images. For
accessibility you should always include an alternate text describing the
image in detail.
For each PG problem with static images, both the PG file and the
image files should be place into a separate subdirectory. This
subdirectory should be located somewhere under the course templates
directory and have the same root name as the PG file. For example, if
you have a PG file called Contour-plots.pg which uses
static graphic files Contour-plot-01.pngand
Contour-plot-02.png, you should create a subdirectory
somewhere under the course templates directory called
Contour-plots and put the PG file and all the PNG files in
it. Putting a PG file and all of its graphics files into their own
separate subdirectory like this makes it easier to find the graphics
files that go with each PG file, thereby making the problem easier to
maintain. Another reason for having the subdirectory and the root name
of the PG file be the same is that when the library is browsed via
directories, the library browser in WeBWorK is configured to recognize
that when a subdirectory has the same name as the root name of the only
PG file in that subdirectory, the subdirectory and PG file should be
treated as a single entity.
Image options such as the tex_size can be set as shown.
If the tex_size option is set, then dividing by 10 gives
the percentage of the available line width used by the graphic. So for
tex_size => 600 as shown in this example, the image will
occupy 60 percent of the line width. Usually the available space is
constrained by the width of one column of a two-column printed page.