[texhax] special characters in \includegraphics arg?

Karl Berry karl at freefriends.org
Mon Sep 3 20:09:58 CEST 2007

    >   \includegraphics{c:\somefile#.jpg}

    Try to avoid this. 

Of course, but I was looking for an actual solution.

For the record, it seems resetting catcodes works, at least with pdftex
-- see below.  And with \usepackage{grffile}, you can have spaces too
(with pdftex).  Not that I tried very hard to break it, I'm sure there
are fragilities.

The main annoyance is having to explicitly end the group with the reset
catcodes.  I didn't see any kind of hook to regain control after
\includegraphics does the real work.  Oh well.




\myincludegraphics{a\# b.png}|endgroup
% nb that's a file whose base name has five characters:
% a <backslash> <hashmark> <space> b

More information about the texhax mailing list