Including Figures

Presentation

The expected format of the included figures depends on the specified output format:

dvi, ps:

EPS format is required.

pdf:

PDF, PNG, or JPG format is required.

In order to be able to publish in all the formats, do not write the suffix of the file that references the figure. The suffix will be deduced from the specified output.

The figures must either already exists in the expected format, or must be able to be converted on the fly.

Example 8.1. Figure inclusion

<figure id="fig-exemple1"> 
  <title>Components</title> 
  <mediaobject>
    <imageobject> 
      <imagedata fileref="path/figure1" align="center" scale="70"/> 
    </imageobject> 
  </mediaobject>
</figure>   

Converting on the fly

The option -f fig_format allows to specify the included figures format (fig_format). Then, the tool converts the figures from the specified format to the expected one (eps or pdf).

If the specified format is unknown, no conversion is done. The supported formats are:

fig:

native format of the figures produced by XFig.

eps:

Encapsulated PostScript format. This format shall be specified only when using the pdftex backend.

Example 8.2. Figure conversion

The following command compiles a document that contains figures produced with XFig.

% dbcontext -f fig mydoc.sgml
   

Paths Lookup

You can use the option -I path1 to specify where the figures are. The given paths can be absolute or not. The paths are added to the document root path.

Example 8.3. Figures lookup

This example shows how the figure lookup is done. Let's consider this document source:

<figure id="fig-example1"> 
  <title>Components</title> 
  <mediaobject>
    <imageobject> 
      <imagedata fileref="rep1/rep2/figure1" align="center" scale="70"/> 
    </imageobject> 
  </mediaobject>
</figure>   

And the document is compiled like this:

% dbcontext -I /another/path -I /last/case /initial/path/document.sgml
   

The figure1 lookup is done in the following directories, in respect of the order:

  • /initial/path/rep1/rep2,

  • /another/path/rep1/rep2,

  • /last/case/rep1/rep2.