The Crash Course to DocBook

Chapter 8. Graphics

Below is a list of tags related to graphical objects:

screeninfo - Information about how a screenshot was produced
screenshot - Representation of what the user sees or might see on a computer screen
mediaobject - A picture, a sound, a text, that can be encoded in several different formats at the same time, not rendered in-line
inlinemediaobject - A picture, a sound, a text, that can be encoded in several different formats at the same time, to be rendered in-line
imagedata - One of the formats encoding the image, such as EPS when printing and PNG when displaying online

Documentation for graphical applications demands screenshots, pictures of icons and buttons, and other graphical elements. DocBook has tags to support screenshots, graphics, and inline graphics. The examples below contain the same picture as a screenshot and as an inline graphic.

Example 8-1. An inline media object


<para>
Here are a bunch of rectangles
<inlinemediaobject>
<imageobject> <imagedata fileref="rectangles.eps" format="EPS" /> </imageobject>
<imageobject> <imagedata fileref="rectangles.png" format="PNG" /> </imageobject>
<textobject> <phrase>A bunch of rectangles</phrase> </textobject>
</inlinemediaobject>
</para>

The <inlinemediaobject> tag is displayed alongside text. The fileref attribute of the <imagedata> tag contains the name of the graphic file, the format attribute contains the type of the graphic file, and the optional align attribute changes the alignment of the graphic. The example will look something like this when converted:

Here are a bunch of rectangles

Example 8-2. A screenshot


<screenshot>
<screeninfo>Colored Rectangles</screeninfo>
<mediaobject>
<imageobject> <imagedata fileref="rectangles.eps" format="EPS" /> </imageobject>
<imageobject> <imagedata fileref="rectangles.png" format="PNG" /> </imageobject>
<textobject> <phrase>A bunch of rectangles</phrase> </textobject>
<caption>
<para>Here are a bunch of rectangles</para>
</caption>
</mediaobject>
</screenshot> 

The <screenshot> tag designates a screenshot with the <screeninfo> tag providing a textual description of the screen shot. The heart of the screenshot is the <mediaobject> tag which points to a graphic file as explained in the first example. A screen shot looks something like this when converted:

Here are a bunch of rectangles