8. Inserting Pictures

It's necessary to insert pictures for all types of media on which the document will be published.

If you use the TeX format you'll need the images as a PostScript file. For online publishing you can use any kind of common image file, such as JPG, GIF or PNG.

The easiest way to insert pictures is the use of the attribute fileref. Usually pictures are generated in JPG and in PostScript (PS or EPS).

Example 5. Inserting a picture

    <figure>
       <title>Picture's Title</title>
       <graphic fileref="images/file"></graphic>
    </figure>

Replacing <figure> by <informalfigure> eliminates the need to insert a title for the picture.

There's still the float attribute on which the value 0 indicates that the picture should be placed exactly where the text flux appears. The value 1 allows the picture to be moved to a more convenient location (this location can be described on the style sheet used or even can be controlled by the application being used).

8.1. Alternative Methods

The first alternative to Example 5 is the elimination of elements <figure> or <informalfigure>.

Another interesting alternative when it's the decision to publish the text on media and pictures aren't accepted, is the use of a wrapper <imageobject>.

Example 6. Using <imageobject>

    <figure>
       <title>Title</title>
       <mediaobject>
          <imageobject>
             <imagedata fileref="images/file.eps" format="eps">
          </imageobject>
          <imageobject>
             <imagedata fileref="images/file.jpg" format="jpg">
          </imageobject>
          <textobject>
             <phrase>Here there's an image of this example</phrase>
          </textobject>
          <caption><para>Image Description. Optional. </para></caption>
       </mediaobject>
    </figure>

Files on the following formats are available BMP, CGM-BINARY, CGM-CHAR, CGM-CLEAR, DITROFF, DVI, EPS, EQN, FAX, GIF, GIF87A, GIF89A, IGES, JPEG, JPG, LINESPECIFIC, PCX, PIC, PS, SGML, TBL, TEX, TIFF, WMF, WPG.

This method presents an advantage: a better control of the application. The elements <imageobject> are consecutively tested until one of them is accepted. In case of the output format doesn't support images the element <textobject> will be used. However, the biggest advantage in usage of the format Example 6 is that on the release 5.0 of the DocBook the element <graphic> will cease to exist.

As a disadvantage there's the need for more than one representation code of the same information. It's up to the author to decide which method he will implement illustrations and pictures on his or hers document, but for compatibility reasons with future versions I recommend the use of this method for pictures and graphics.