Figure Inclusion

Presentation
Converting on the fly
Paths Lookup

Presentation

The expected format of the included figures depends on the backend driver used:

dvips:

EPS format is required.

pdftex:

PDF or PNG format is required.

In order to be able to use both backends, it is wise to not write the suffix of the file that references the figure. The suffix will be deduced from the backend used.

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

Example 3.2. 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

When it is needed dblatex tries to automatically convert the figures to the expected format (i.e. EPS or PDF). The principle is to detect the original figure format from the suffix of the fileref attribute. If no suffix is given, the tool checks if a file whose basename is conformant with the fileref attribute and with one of the predefined suffixes exists (that is, ".eps", ".fig", ".pdf", or ".png"). If such a file exists, conversion is done from the original format found.

The option -f fig_format allows to specify the default included figures format (fig_format), that will be used when automatic format scanning gives no result. Then, the tool converts the figures from the specified format to the expected one.

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 3.3. Figure conversion

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

% dblatex -f fig mydoc.sgml
   

Paths Lookup

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

Example 3.4. Figures lookup

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

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

And the document is compiled like this:

% dblatex -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.