Subsection 4.14.1 Raster Images
A raster image is an image described pixel-by-pixel, with different colors and intensities. Photographs are good examples. Common formats are Portable Network Graphics (PNG) and Joint Photographic Experts Group (JPEG, JPG), which will both work with
pdflatex
and modern web browsers. JPEG is a good choice for photographs since they are compressed on the assumption they will be viewed by a human, while PNG is a lossless format and good for line art, diagrams and similar images (if you do not have vector graphics versions, see below).To use these images, you simply provide the complete filename, with a relative path. A subdirectory such as
images
is a good choice for a place to put them. It is your responsibility to place these images where the LaTeX output will find them or where the HTML output will find them. Your PreTeXt source would look like:<image source="images/crocodiles.png" width="50%" />
Typically you would wrap this in a
<figure>
that might have an @xml:id
attribute for cross-references, with or without a caption. There is no @height
attribute, so the aspect ratio of your image is your responsibility outside of PreTeXt. The @width
attribute is a percentage of the available width of the text (outside of a <sidebyside>
panel).You may also provide a
<description>
which will aid accessibility for electronic formats. Keep such readers in mind and provide as much description as possible. Keep the markup simple, since this will typically migrate to an HTML attribute that cannot contain any structure. Be careful to avoid double-quotes. For example:<image source="images/crocodiles.jpeg" width="50%"> <description>Five crocodiles partially submerged.</description> </image>