[Tex/LaTex] \includegraphics: Dots in filename

file-lookupgraphicspunctuation

\includegraphics cannot handle filenames that contain more than the one dot, separating the filename from the extension. Apparently it uses everything after the first dot as extension and then, of course, complains about an unknown graphics extension.

This is annoying as I very often have filenames that contain parameter values, e.g. plot_a0.4_b0.6.pdf.

Is there a way to teach LaTeX to interpret only the string behind the last dot as extension?

Best Answer

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}}}
Related Question