While the question is answered for the generic case - I often have a case, where I have files with constant (unchanging), yet unstandard extensions; and where I'd like to use these files as input "as is" to pdflatex
in a batch script context (meaning, I wouldn't want to code any parsing logic in respect to filenames, either in the Latex code, or the batch code).
For instance, the usual \includegraphics{mydir/file01.csv_.pdf}
would fail with:
! LaTeX Error: Unknown graphics extension: .csv_.pdf.
One thing that works, is as per the answer by @DavidCarlisle:
\includegraphics[ext=.csv_.pdf,type=pdf,read=*]{mydir/file01}
... but this requires me to strip the extension from the filename, so I'd have to introduce filename parsing logic somewhere.
However, what really works for me is using \DeclareGraphicsRule{ext}{type}{read-file}{command}
(see grfguide.pdf: Packages in the 'graphics' bundle):
% preamble:
\DeclareGraphicsRule{.csv_.pdf}{pdf}{*}{}
% ...
\begin{document}
% ...
\includegraphics{mydir/file01.csv_.pdf}
... and this seems to work fine, without any changes to the filename argument of \includegraphics
. Note that command
argument can be left empty (it's for a system conversion otherwise), and read-file
is where do we read the size/bounding box information from: since the .csv_.pdf
is a .pdf
file proper, with *
we simply say - read the size from the same file that has matched the declared extension.