You can hide the other dots by masking them from TeX's token scanner with { }
, i.e.:
\includegraphics{{plot_a0.4_b0.6}.pdf}
works fine.
Note that the extension can also be dropped, then a list of default extensions is used. See the graphicx
manual for more information.
If you want to do this, you need to double group the filename, which makes three together with the one for the arguments:
\includegraphics{{{plot_a0.4_b0.6}}}
The order of preference when files with the same name and different extensions is
.png .pdf .jpg .mps .jpeg .jbig2 .jb2 .PNG .PDF .JPG .JPEG .JBIG2 .JB2
which is stored in the macro \Gin@extensions
. So if you have both image.png
and image.pdf
, pdflatex
will load the former.
If you are mixing case in extensions, then
\DeclareGraphicsExtensions{%
.png,.PNG,%
.pdf,.PDF,%
.jpg,.mps,.jpeg,.jbig2,.jb2,.JPG,.JPEG,.JBIG2,.JB2}
will ensure that PNG are always preferred over PDF files. For the final version it will be sufficient to switch the two lines.
A handier way, suggested by Heiko Oberdiek, is to use the package grfext
:
\usepackage{grfext}
\PrependGraphicsExtensions*{.png,.PNG}
that will have the same effect without the need to check in pdftex.def
for the list of extensions.
If you want also automatic conversion, you can say
\usepackage{graphicx}
\usepackage{epstopdf}
\epstopdfDeclareGraphicsRule{.pdf}{png}{.png}{convert #1 \OutputFile}
\DeclareGraphicsExtensions{%
.png,.PNG,%
.pdf,.PDF,%
.jpg,.mps,.jpeg,.jbig2,.jb2,.JPG,.JPEG,.JBIG2,.JB2}
When image.pdf
exists but not image.png
, the file image-pdf-converted-to.png
will be created and loaded in its place. Add the options you prefer between convert
and #1
(for example -density 100
or something like that).
You need to call pdflatex
with the --shell-escape
option for this automatic conversion to work. Of course you'll comment out the \epstopdfDeclareGraphicsRule
command for the final version, when only PDF files should be loaded (and switch the order of precedence in the lines below).
Best Answer
The LaTeX
graphics
/graphicx
package uses the first dot to find the extension. Packagegrffile
changes the algorithm to check for known extensions (optionmultidot
, enabled by default):