This is my third question in the series of transforming some (~167) documents from HTML to LaTeX. The other questions were related to {inputenc} and {wrapfig}.
The original document have several graphics (~168) from different sources and different naming conventions. I am using the graphicx package with the \includegraphics command. I don't have any problems with PNG and JPEG files with only letters, numbers and hyphens in their names.
I have a couple of GIF files (non-animated) which I attempted to solve using the receipt here: Convert gif image to png on the fly . Unsuccessfully. (Also command \epstopdfDeclareGraphicsRule fails in XeLaTeX, and as there are only two files I might rather convert them manually or with my conversion script.)
However I have a problem with PNG and JPEG files with special charactes, mainly those including a period . (includegraphics things that something.svg.png is an unrecognized .svg.png), an underscore _ (if I don't mask that character it attempts to shift to mathmode; if I mask it it does not find the file), and a percent sign % (as most of these files were downloaded from internet URL, special chars are masked using the percent sign and I preserved that convention in the filenames. Again, with the masked percent '\%' '\includegraphics' does not find the file and without it the TeX engine assumes it is an end-of-line and the code breaks).
While I can still rename the files to something LaTeX and graphicx will handle, I still would like to now what are the correct way to mask special characters, and particularly ., _, and %.
\includegraphics[ext=.png]{filename.with.dots}(not tested, but it should work theoritically). – kiss my armpit Nov 29 '13 at 20:09_should not cause any problem in the file name, only if you are typesetting a string with that in. you can use\@percentcharfor%(as long as @ is a letter) – David Carlisle Nov 29 '13 at 20:17grffilepackage for filenames with multiple dots. – Nicola Talbot Nov 29 '13 at 20:20Unknown graphics extension: .dots. – Carlos Eugenio Thompson Pinzón Dec 02 '13 at 11:40\@percentcharworks. I also declared a macro without @ si I didn't have to put \makeatletter \makeatother each time, however: Isn't there a macro already without @? – Carlos Eugenio Thompson Pinzón Dec 02 '13 at 11:46\usepackage[multidot]{grffile}– Martin Schröder Dec 03 '13 at 20:53_when the graphics file is in the directory of the source file but if I use a.styfile, it works fine. Weird – azetina Dec 04 '13 at 00:17\detokenize{faïlenèime}– PlasmaBinturong Nov 14 '19 at 14:45