EmilioLazo wrote:But what is happening anyway?
The error message is actually misleading. When you do
Code: Select all
\def\test{picture.jpg}
\def\testx{\test}
...
\includegraphics{\testx}
the error message means to say »
File `\test' not found«. The actual inclusion is done by the command
\Ginclude@graphics which calls
The
\filename@parse macro contains the code
which means that the argument of
\includegraphics is expanded once. This is why the first test succeeds. In the second case it finds the file »
\test«.
The above mentioned
\filename@parse now calls
\filename@path which in this case finds no directory specified and thus assumes the current path and calls
\filename@simple#1.\\ which checks for an extension. It finds none and lets
\filename@ext to
\relax. It also defines
\edef\filename@base{#1}. This is an
\edef which means it's contents get fully expanded. That means that
\filename@base is now
picture.jpg.
These macros now are checked by
\Ginclude@graphics. If
\filename@ext is equal to
\relax it looks for a match of
\filename@base plus one of the allowed extensions. This would be
picture.jpg.png, for example. Such a file does not exist so you get the error message. Without an extension this doesn't matter since
\filename@base would be
picture and it would find
picture.jpg.
Regards