How to include graphs with filename starting with # sign? Say I have an image #1-1.png. The following error message will pop up when I try to include it.
Package pdftex.def Error: File `##1-1.png' not found. \includegraphics[scale=0.7]{#1-1.png}*
As you discovered, # is a special character for TeX. If you don't plan to need things like
\includegraphics[...]{./subdir/#1-1.png}
but you just type the file name, you should be able to do with a new command:
\makeatletter
\edef\harry@hash{\string#}
\newcommand{\hashincludegraphics}[2][]{%
\includegraphics[#1]{\harry@hash#2}%
}
\makeatother
and use
\hashincludegraphics[scale=0.7]{1-1.png}
However, my advice is to rename those files.
#is a special character. Life will be infinitely easier if you rename the image as opposed to trying to persuade TeX to load a file containing weird and wonderful characters. It is just like avoiding spaces in file names. Even when it is possible to use extreme methods to force TeX to accept them, it is much, much easier just to use proper file names. – cfr Apr 27 '16 at 00:37detoxwhich saves even that trouble but may be a little less customisable. At least, that's what I would do/do do/have done. – cfr Apr 27 '16 at 01:52