Tell LaTex how to handle unknown graphics file extensions

Ipe is a very nice drawing tool which also interacts with LaTeX in a way that, e.g., you can use the math environment, use LaTeX packages, etc. In order to distinguish PDF files produced with Ipe from other PDF files, I use the file extension ipe.pdf which confuses pdflatex when used inside the includegraphics command:

includegraphics{cyk.ipe.pdf}

yields

! LaTeX Error: Unknown graphics extension: .ipe.pdf.

We may tell pdflatex how to handle this unknown graphics extension with the following command:

\DeclareGraphicsRule{.ipe.pdf}{pdf}{.ipe.pdf}{}

Here is the meaning of the parameters:

  1. .ipe.pdf is the extension which is unknown to the compiler. Each included file with such an extension will be handled by this rule. Removing this extension yields the “basename” of the file.
  2. pdf is the format as which pdflatex shall treat the file
  3. .ipe.pdf is the extension to append to the “basename” after potential conversion commands. This should be the name of the file as it can be found on the disk.
  4. <empty> conversion command. In our case, the file is already a valid PDF document and no action is necessary. But in case pdflatex could not handle this file type, we may specify a conversion command here, e.g., jpeg2ps #1 which would take a JPEG file and convert it to Postscript. In this case we would need to specify ps as third argument (or leave it out because LaTeX will guess the correct extension) since the file produced by the converter will have a ps extension.

Links

  • [1] ipe project at Sourceforge.net

Leave a Reply