16. Graphics

Graphics are not all that difficult but you have to do a little advanced planning. Here's some example SGML for a graphic:

<mediaobject>
   <imageobject>
      <imagedata fileref="images/newbieDocLogotype.ps" format="ps">
   </imageobject>

   <imageobject>
      <imagedata fileref="images/newbieDocLogotype.eps" format="eps">
   </imageobject>

   <imageobject>
      <imagedata fileref="../images/newbieDocLogotype.gif" format="gif">
   </imageobject>

   <textobject>
      <phrase>Newbiedoc: Docs for & by Debian newbies.</phrase>
   </textobject>

   <caption>
      <para>
      Newbiedoc: Docs for & by Debian newbies.
      </para>
   </caption>
</mediaobject>

You'll notice that there are two separate file formats listed. Seems redundant, but really what it's doing is giving the parser a choice. When your parser is run for rtf or a "printed" file format it uses the eps graphic. If you're outputting to html format then the other format is used. The "fileref" attribute gives the relative path to where the graphic is stored. The important thing to remember here is that for the "printed" version this is where the graphic "lives" prior to you rendering the document (it needs this because the graphic will be included in the document). The "fileref" attribute for the html version simply provides a link to the graphic and this is where the graphic "lives" after the document is rendered. Unfortunately, the only graphic formats currently permitted are mostly non-free types, so .png is outta there for now. The current list of supported formats is: "BMP", "CGM-CHAR", "CGM-BINARY", "CGM-CLEAR", "DITROFF", "DVI", "EPS", "EQN", "FAX", "GIF", "GIF87A", "GIF89A", "JPG", "JPEG", "IGES", "PCX", "PIC", "PS", "SGML", "TBL", "TEX", "TIFF", "WMF", and "WPG". Here's what it looks like parsed: